first commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\service\MessageService;
|
||||
use think\Exception;
|
||||
|
||||
class MessageController extends ApiController
|
||||
{
|
||||
protected $noAuth = [];
|
||||
|
||||
/**
|
||||
* @apiDefine Message 消息管理
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /message/send 1.发送消息(朱晓伟)
|
||||
* @apiName send
|
||||
* @apiGroup Message
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} user_id 用户id
|
||||
* @apiParam {Int} biz_type 业务类型 1:订单,2:企业认证,3售后服务
|
||||
* @apiParam {Int} biz_id 业务id
|
||||
* @apiParam {String} biz_title 业务描述
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"message_id": 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function send() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$data = model(MessageService::class)->send($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
} catch (Exception $exception) {
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @apiVersion 1.0.0
|
||||
* @api {post} /message/getList 2.消息列表(朱晓伟)
|
||||
* @apiName getList
|
||||
* @apiGroup Message
|
||||
* @apiHeader {String} authentication 验证
|
||||
* @apiParam {Int} [limit] 每页多少条(默认20)
|
||||
* @apiParam {Int} [page] 当前页(默认1)
|
||||
* @apiSuccessExample Success-Response:
|
||||
* {
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"data": {
|
||||
"total": 1,
|
||||
"per_page": 20,
|
||||
"current_page": 1,
|
||||
"last_page": 1,
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"biz_type": 1,
|
||||
"biz_id": 1,
|
||||
"biz_title": "这只是一个测试",
|
||||
"is_read": 0,
|
||||
"create_time": "2020-04-16",
|
||||
"biz_type_text": "订单信息"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
*/
|
||||
public function getList() {
|
||||
try {
|
||||
$parames = input('');
|
||||
$parames['user_id'] = $this->uid;
|
||||
$data = model(MessageService::class)->getList($parames);
|
||||
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
|
||||
} catch (Exception $exception) {
|
||||
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user