verifyToken(); $code = -2; $msg = '错误'; if ($tokenStatus === false) { return json(['code' => $code, 'data' => [], 'msg' => $msg]); } try { // 获取用户信息. $getUserInfo = $this->getUserInfo(); // 获取字段. $wordsField = [ 'id', 'content', 'title', ]; // 条件. $userWordsWhere['user_id'] = $getUserInfo->id; // 查询用户私有快捷语. $userWords = model('words')->selectWords($wordsField, $userWordsWhere); return json(['code' => 200, 'data' => $userWords, 'msg' => '成功']); } catch (\Exception $e) { return json(['code' => $code, 'data' => [], 'msg' => $msg]); }//end try }//end userWords() /** * 快捷语修改 * * @access public * @return array JsonString */ public function updateWords() { // 验证token. $tokenStatus = $this->verifyToken(); $code = -2; $msg = '错误'; if ($tokenStatus === false) { return json(['code' => $code, 'data' => [], 'msg' => $msg]); } try { // 获取用户信息. $getUserInfo = $this->getUserInfo(); $userWordsWhere = [ 'user_id' => $getUserInfo->id, 'id' => input('post.id'), ]; $content = input('post.content'); $status = input('post.status'); $title = input('post.title'); // 更新内容. if (empty($content) === false) { $userWordsData['content'] = input('post.content'); } if (empty($status) === false) { $userWordsData['status'] = input('post.status'); } if (empty($title) === false) { $userWordsData['title'] = input('post.title'); } // 更新. if (isset($userWordsData) === true) { $updateWordsResult = model('Words')->updateWords($userWordsWhere, $userWordsData); if (empty($updateWordsResult) === false) { $result = true; } } // 参数返回. if (isset($result) === true) { return json(['code' => 200, 'data' => [], 'msg' => '成功']); } else { return json(['code' => 1, 'data' => [], 'msg' => 1]); } } catch (\Exception $e) { return json(['code' => $code, 'data' => [], 'msg' => $msg]); }//end try }//end updateWords() /** * 获取会话历史详细 * * @access public * @return array JsonString */ public function historyInfo() { // 验证token. $tokenStatus = $this->verifyToken(); $code = -2; $msg = '错误'; if ($tokenStatus === false) { return json(['code' => $code, 'data' => [], 'msg' => $msg]); } try { // 获取用户信息. $servicelogId = input('get.servicelog_id'); $chatLogField = ['*']; // 关联信息. $chatLogWhere['servicelog_id'] = $servicelogId; // 分页. $currentPage = input('get.currentPage', '1'); $pageSize = input('get.pageSize', '10'); $offset = (($currentPage - 1) * $pageSize); // 获取用户信息. $chatLog = model('ChatLog')->selectChatLog($chatLogField, $offset, $pageSize, $chatLogWhere); $countChatLog = model('ChatLog')->countChatLog($chatLogWhere); $result['total'] = $countChatLog; $result['countPage'] = (ceil(($result['total']) / $pageSize)); $result['currentPage'] = $currentPage; $result['list'] = $chatLog; $result['pageSize'] = $pageSize; return json(['code' => 200, 'data' => $result, 'msg' => '成功']); } catch (\Exception $e) { return json(['code' => $code, 'data' => [], 'msg' => $msg]); }//end try }//end historyInfo() }