Commit 4dc39d99 authored by hujun's avatar hujun

微聊串设备推送聊天

parent 6c2fd7dd
......@@ -193,9 +193,9 @@ class Broker extends Basic
/*处理多个手机登录聊天*/
$m_chat_ext = new ChatUserExt();
$bind_where['is_forbidden'] = 0;
$bind_where['user_id'] = $agents_data['id'];
$bind_where['user_id'] = ['<>', $agents_data['id']];
$bind_where['type'] = 1;
$bind_where['push_id'] = ['<>', $params["push_id"]];
$bind_where['push_id'] = $params["push_id"];
$del_bind_id = $m_chat_ext->getChatUserExtByUserId($bind_where, 'a.id', 100);
if (count($del_bind_id) > 0) {
foreach ($del_bind_id as $v) {
......
......@@ -105,14 +105,23 @@ class ChatService
$where['ext_id'] = $chat_user_id;
$where['device_id'] = $device_id;
$where['push_id'] = $push_id;
$where['is_forbidden'] = 0;
$info = $this->chatUserExtModel->getChatUserExt($where, 'id,ext_id,device_id,push_id');
// $where['is_forbidden'] = 0;
$info = $this->chatUserExtModel->getChatUserExt($where, 'id,ext_id,device_id,push_id,is_forbidden');
$result = false;
if (count($info) > 0) {
$update_data = [];
if ($info[0]["push_id"] != $push_id) {
//update
$result = $this->chatUserExtModel->addChatUserExt([ 'push_id' => $push_id ], $info[0]['id']);
$update_data['push_id'] = $push_id;
}
if ($info[0]['is_forbidden'] == 1) {
$update_data['is_forbidden'] = 0;
}
if (count($update_data) > 0) {
$result = $this->chatUserExtModel->addChatUserExt($update_data, $info[0]['id']);
}
} else {
//todo 保存或更新push_id
......@@ -228,7 +237,7 @@ class ChatService
$user_type = $item["type"];
}
}
$where['is_forbidden'] = 0;
$info = $userExt->getChatUserExtByUserId($where, 'a.id,a.ext_id,a.device_id,a.push_id,b.user_id');
if (count($info) <= 0) {
......
......@@ -34,8 +34,6 @@ class ChatUserExt extends BaseModel
$where_ = [];
if (isset($params['is_forbidden'])) {
$where_['is_forbidden'] = $params['is_forbidden'];
} else {
$where_['is_forbidden'] = 0;
}
if (isset($params['ext_id'])) {
......
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