Commit 257f13f3 authored by zw's avatar zw

chat

parent cd4bf09a
This diff is collapsed.
......@@ -82,6 +82,36 @@ class ChatMsg extends Model
return $data;
}
/** 批量更新已看记录
* @param array $where_arr
* @param array $update_arr
* @return bool
*/
public function updateIsRead(array $where_arr,array $update_arr){
$where_ = [];
if (isset($where_arr["from"])) {
$where_["from_id"] = $where_arr["from"];
}
if (isset($where_arr["target"])) {
$where_["to_id"] = $where_arr["target"];
}
if(empty($where_)){
return false;
}
try {
$this->db->where($where_)
->update($update_arr);
return true;
} catch (\Exception $e) {
return false;
}
}
/**
* @param $params
* @param $field
* @return mixed
*/
public function getTotalUnread($params, $field)
{
......@@ -96,7 +126,9 @@ class ChatMsg extends Model
}
$where_["a.is_del"] = 0;
$data = $this->db->field($field)
$data = $this->db
->field($field)
->alias("a")
->join('chat_msg_ext b', 'a.id = b.msg_id', 'LEFT')
->where($where_)
......@@ -105,4 +137,11 @@ class ChatMsg extends Model
return $data;
}
public function getTotalByToId($params){
$data = $this->db
->where($params)
->count();
return $data;
}
}
\ No newline at end of file
......@@ -458,6 +458,7 @@ Route::group('chat', [
'getSystemMessageByShop' => ['chat/AppChat/getSystemMessageByShop', ['method' => 'post|get']],
'getSystemMessageByUser' => ['chat/AppChat/getSystemMessageByUser', ['method' => 'post|get']],
'updateSystemMessageIsRead' => ['chat/AppChat/updateSystemMessageIsRead', ['method' => 'post|get']],
'getMessageIsRead' => ['chat/AppChat/getMessageIsRead', ['method' => 'post|get']],
]);
......@@ -668,8 +669,8 @@ Route::group('broker', [
'getSiteListApp' => ['api_broker/Site/getSiteList', ['method' => 'POST|GET']], //获取站点列表
'getAgentSiteList' => [ 'api_broker/Site/getAgentSiteList', [ 'method' => 'POST|GET' ] ], //获取经纪人站点列表
'getPhoneBook' => [ 'api_broker/Agent/getPhoneBook', [ 'method' => 'POST|GET' ] ], //消息页面--通讯录
'getAgentSiteList' => ['api_broker/Site/getAgentSiteList', ['method' => 'POST|GET']], //获取经纪人站点列表
'getPhoneBook' => ['api_broker/Agent/getPhoneBook', ['method' => 'POST|GET']], //消息页面--通讯录
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
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