Commit f4a872b7 authored by zw's avatar zw

chat bug

parent 45801c42
......@@ -239,26 +239,24 @@ class AppChat extends Basic
public function getChatHistory()
{
$params = $this->params;
/* $params = array(
'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息
'from' => 'agent_5740', //发送人
'last_msg_id' => 123, //最后一条消息id 默认0 表示不处理
'target' => 'agent_5741', //接受人
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
/* $params = array(
'target_type' => 'users', // 消息类型 users 用户消息。chatgroups: 群消息,chatrooms: 聊天室消息
'from' => 'user_1691', //发送人
'last_msg_id' => 123, //最后一条消息id 默认0 表示不处理
'target' => 'agent_5775', //接受人
'page_no' => '1', //第几页
'page_size' => '15' //每页多少条
);*/
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, "请求参数错误");
}
$msgModel = new ChatMsg();
//进入详情页修改已读消息 只修改自己收到的消息为已读,自己发送的是在对方判断已读未读
if (!empty($params["last_msg_id"]) && $params["last_msg_id"] > 0) {
$where_arr["from"] = $params["from"];
$where_arr["target"] = $params["target"];
$update_arr["is_read"] = 1;
$msgModel->updateIsRead($where_arr, $update_arr);
}
$where_arr["from"] = $params["from"];
$where_arr["target"] = $params["target"];
$update_arr["is_read"] = 1;
$msgModel->updateIsRead($where_arr, $update_arr);
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
......@@ -541,7 +539,7 @@ class AppChat extends Basic
}
$param["addressee_id"] = $params["agent_id"];
$param["is_read"] = 0;
$param["is_read"] = 0;
$param["type"] = 2;
//TODO 获取未读个数
$data["user_count"] = $msgModel->getListCountByWhere($param);
......@@ -565,8 +563,8 @@ class AppChat extends Basic
}
//todo 先获取是否有店铺或客户修改消息是否为0,大于0返回true,否则查询聊天消息是否有未读
$param["addressee_id"] = $params["agent_id"];
$param["type"] = 2;
$param["is_read"] = 0;
$param["type"] = 2;
$param["is_read"] = 0;
//TODO 获取未读个数
$msgModel = new MPushMessage();
$user_count = $msgModel->getListCountByWhere($param);
......
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