| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Http\Controllers\Admin;
- use App\Services\ChatMessageService;
- /**
- * 聊天管理-控制器
- * Class ChatController
- * @package App\Http\Controllers
- */
- class ChatController extends Backend
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- * ChatController constructor.
- */
- public function __construct()
- {
- parent::__construct();
- $this->service = new ChatMessageService();
- }
- /**
- * 获取聊天消息历史
- * @return array
- */
- public function index()
- {
- $pageSize = request()->post('limit', 30);
- $params = request()->all();
- $list = $this->service->getDataList($params, $pageSize);
- $message = array(
- "msg" => '操作成功',
- "code" => 0,
- "data" => isset($list['list'])? $list['list']:[],
- "count" => isset($list['total'])? $list['total']:0,
- );
- return $message;
- }
- /**
- * 获取最新的聊天窗口列表
- * @return array
- */
- public function newlist()
- {
- $pageSize = request()->post('limit', 30);
- $params = request()->all();
- $type = isset($params['type'])? $params['type'] : 2;
- if($type == 3){
- $list = $this->service->getDataList($params, $pageSize);
- }else{
- $list = $this->service->getWaitList($params, $pageSize);
- }
- $userId = $this->userInfo['user_type']==2? $this->userInfo['user_id'] : 1;
- $counts = $this->service->getNewCount($userId);
- $message = array(
- "msg" => '操作成功',
- "code" => 0,
- "data" => isset($list['list'])? $list['list']:[],
- "counts" => $counts,
- );
- return $message;
- }
- /**
- * 订单通知
- * @return array
- */
- public function notify()
- {
- $info = ChatMessageService::make()->getOrderNotify($this->userInfo['user_id']);
- return returnJson(1002,true, $info);
- }
- }
|