Commit 3d8453b8 authored by clone's avatar clone

bug

parent 6f91976f
...@@ -322,11 +322,11 @@ class AppChat extends Basic ...@@ -322,11 +322,11 @@ class AppChat extends Basic
public function getChatRelation() public function getChatRelation()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"target" => "user_2", "target" => "user_2",
"is_user" => 0,//0用户1经纪人 "is_user" => 0,//0用户1经纪人
"relation_list" => '[{"r_id":"2","msg_id":3536},{"r_id":"8","msg_id":3524}]', "relation_list" => '[{"r_id":"2","msg_id":3536},{"r_id":"8","msg_id":3524}]',
);*/ );*/
if (!isset($params['target']) || !isset($params["is_user"])) { if (!isset($params['target']) || !isset($params["is_user"])) {
return $this->response("300", "参数不全"); return $this->response("300", "参数不全");
} }
......
...@@ -441,11 +441,15 @@ class ChatService ...@@ -441,11 +441,15 @@ class ChatService
} }
try { try {
$where_["id"] = array( "between", array( $relation_list[$item["id"]][0]["msg_id"], $chat_info[0]["id"] ) ); if ($relation_list[$item["id"]][0]["msg_id"] > 0) {
//计算未读消息个数 $where_["id"] = array( "between", array( $relation_list[$item["id"]][0]["msg_id"], $chat_info[0]["id"] ) );
$unread_count = $msgModel->getTotalUnread($where_, "id"); //计算未读消息个数
//dump($unread_count); $unread_count = $msgModel->getTotalUnread($where_, "id");
$result[$key]["unread"] = $unread_count > 0 ? $unread_count - 1 : 0; $result[$key]["unread"] = $unread_count > 0 ? $unread_count - 1 : 0;
//dump($unread_count);
} else {
$result[$key]["unread"] = 0;
}
} catch (Exception $exception) { } catch (Exception $exception) {
$result[$key]["unread"] = 0; $result[$key]["unread"] = 0;
} }
......
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