Commit e400b472 authored by clone's avatar clone

bug

parent f4db0488
...@@ -193,14 +193,15 @@ class AppChat extends Basic ...@@ -193,14 +193,15 @@ class AppChat extends Basic
public function getChatHistory() public function getChatHistory()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息 'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息
'from' => 'agent_5740', //发送人 'from' => 'agent_5740', //发送人
'target' => 'agent_5741', //接受人 'last_msg_id' => 123, //最后一条消息id 默认0 表示不处理
'page_no' => '1', //第几页 'target' => 'agent_5741', //接受人
'page_size' => '15' //每页多少条 'page_no' => '1', //第几页
);*/ 'page_size' => '15' //每页多少条
if (!isset($params['target_type']) || !isset($params['from']) || !isset($params['target'])) { );*/
if (!isset($params['target_type']) || !isset($params['from']) || !isset($params['target']) || !isset($params['last_msg_id'])) {
return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误"); return $this->response(ErrorCodeConst::ERROR_CODE_PARAM_NOT_EXIST, "请求参数错误");
} }
......
...@@ -61,6 +61,10 @@ class ChatMsg extends Model ...@@ -61,6 +61,10 @@ class ChatMsg extends Model
if (isset($params["body"])) { if (isset($params["body"])) {
$where_["b.body"] = array( 'like', "%" . trim($params["body"]) . "%" ); $where_["b.body"] = array( 'like', "%" . trim($params["body"]) . "%" );
} }
if (isset($params["last_msg_id"]) && $params["last_msg_id"] > 0) {
$where_["b.id"] = array( '>', $params["last_msg_id"] );
$where_or["b.id"] = array( '>', $params["last_msg_id"] );
}
$where_["a.is_del"] = 0; $where_["a.is_del"] = 0;
$data = $this->db->field($field) $data = $this->db->field($field)
...@@ -74,7 +78,7 @@ class ChatMsg extends Model ...@@ -74,7 +78,7 @@ class ChatMsg extends Model
->limit($page_size) ->limit($page_size)
->page($page_no) ->page($page_no)
->select(); ->select();
// echo $this->getLastSql(); echo $this->getLastSql();
return $data; return $data;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment