Commit d1e30900 authored by zw's avatar zw

bug

parent 34d82cd9
......@@ -609,23 +609,29 @@ class AppChat extends Basic
{
$params = $this->params;
/* $params = array(
"agent_id" => 5775
"agent_id" => 5775,
"user_id" => 123,
);*/
if (empty($params['agent_id'])) {
if (empty($params['agent_id']) && empty($params['user_id'])) {
return $this->response("101", "请求参数错误");
}
//todo 先获取是否有店铺或客户修改消息是否为0,大于0返回true,否则查询聊天消息是否有未读
$param["addressee_id"] = $params["agent_id"];
$param["is_read"] = 0;
//TODO 获取未读个数
$msgModel = new MPushMessage();
$param["type"] = array("in", "1,2,3,8");
$shop_count = $msgModel->getListCountByWhere($param);
if ($shop_count > 0) {
return $this->response("200", "success", ["is_show_red" => true]);
if (!empty($params['agent_id'])){
$param["addressee_id"] = $params["agent_id"];
$param["is_read"] = 0;
//TODO 获取未读个数
$msgModel = new MPushMessage();
$param["type"] = array("in", "1,2,3,8");
$shop_count = $msgModel->getListCountByWhere($param);
if ($shop_count > 0) {
return $this->response("200", "success", ["is_show_red" => true]);
}
$where["to_id"] = "agent_" . $params["agent_id"];
}else{
$where["to_id"] = "user_" . $params["agent_id"];
}
$where["to_id"] = "agent_" . $params["agent_id"];
$where["is_read"] = 0;
$chatModel = new ChatMsg();
$msg_count = $chatModel->getTotalByToId($where);
......
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