Commit 6fbd9515 authored by zw's avatar zw

chat

parent ad91d53b
......@@ -537,5 +537,27 @@ class AppChat extends Basic
$data["shop_count"] = $msgModel->getListCountByWhere($param);
return $this->response("200","success",$data);
}
public function getMessageIsRead(){
$params = $this->params;
$params = array(
"agent_id" => 1
);
//todo 先获取是否有店铺或客户修改消息是否为0,大于0返回true,否则查询聊天消息是否有未读
$param["addressee_id"] = $params["agent_id"];
$param["type"] = 2;
//TODO 获取未读个数
$msgModel = new MPushMessage();
$user_count = $msgModel->getListCountByWhere($param);
if($user_count > 0){
return $this->response("200","success",["is_show_red"=>true]);
}
$param["type"] = 1;
$shop_count = $msgModel->getListCountByWhere($param);
if($shop_count > 0){
return $this->response("200","success",["is_show_red"=>true]);
}
}
}
......@@ -87,15 +87,12 @@ class ChatMsg extends Model
if (isset($params["to_id"])) {
$where_["a.to_id"] = $params["to_id"];
//$where_or["a.to_id"] = $params["from"];
}
if (isset($params["from_id"])) {
$where_["a.from_id"] = $params["from_id"];
//$where_or["a.from_id"] = $params["target"];
}
if (isset($params["id"])) {
$where_["a.id"] = $params["id"];
// $where_or["a.id"] = $params["id"];
}
$where_["a.is_del"] = 0;
......@@ -103,9 +100,6 @@ class ChatMsg extends Model
->alias("a")
->join('chat_msg_ext b', 'a.id = b.msg_id', 'LEFT')
->where($where_)
/* ->whereOr(function ($query) use ($where_or) {
$query->where($where_or);
})*/
->order("a.created_at desc")
->count();
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