// +---------------------------------------------------------------------- namespace App\Http\Controllers\Admin; use App\Services\Common\MessageService; /** * 消息管理-控制器 * @author laravel开发员 * @since 2020/11/11 * @package App\Http\Controllers */ class MessageController extends Backend { /** * 构造函数 * @author laravel开发员 * @since 2020/11/11 */ public function __construct() { parent::__construct(); $this->service = new MessageService(); } public function index() { $pageSize = request()->get('limit', 10); $list = $this->service->getDataList(request()->all(), $pageSize); $message = array( "msg" => '操作成功', "code" => 0, "data" => isset($list['list'])? $list['list']:[], "count" => isset($list['total'])? $list['total']:0, ); return $message; } /** * 历史记录 * @return array * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function history() { $pageSize = request()->get('limit', 10); $list = $this->service->getDataList(request()->all(), $pageSize); $message = array( "msg" => '操作成功', "code" => 0, "data" => isset($list['list'])? $list['list']:[], "count" => isset($list['total'])? $list['total']:0, "unread" => isset($list['unread'])? $list['unread']:0, ); return $message; } /** * 聊天列表 * @return array * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function chatList() { $pageSize = request()->get('limit', 10); $list = $this->service->getChatList(request()->all(), $pageSize); $message = array( "msg" => '操作成功', "code" => 0, "data" => isset($list['list'])? $list['list']:[], "count" => isset($list['total'])? $list['total']:0, ); return $message; } /** * 选项列表 * @return mixed */ public function options(){ $result = $this->service->options(); return message(1002,true, $result); } }