| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\api\controller;
- use \app\api\model\Imchat as ImchatModel;
- use app\api\service\User as UserService;
- /**
- * 聊天消息控制器
- * Class Imchat
- * @package app\api\controller
- */
- class Imchat extends Controller
- {
- /**
- * 历史消息列表
- * @return \think\response\Json
- */
- public function history()
- {
- // 获取列表数据
- $model = new ImchatModel;
- $pageSize = $this->request->param('pageSize', 15);
- $list = $model->getList($this->request->param(), $pageSize);
- return $this->renderSuccess(compact('list'));
- }
- /**
- * 获取最新消息用户列表
- * @return \think\response\Json
- */
- public function newList()
- {
- // 获取列表数据
- $model = new ImchatModel;
- $pageSize = $this->request->param('pageSize', 15);
- $userInfo = UserService::getCurrentLoginUser(true);
- $userId = isset($userInfo['user_id'])? intval($userInfo['user_id']) : 0;
- $list = $model->getListByUser($userId, $this->request->param(), $pageSize);
- return $this->renderSuccess(compact('list'));
- }
- }
|