昵称问题
This commit is contained in:
@@ -8,6 +8,7 @@ use app\chat\model\ChatDoNotDisturb;
|
|||||||
use app\common\controller\ApiController;
|
use app\common\controller\ApiController;
|
||||||
use app\exception\MyBusinessException;
|
use app\exception\MyBusinessException;
|
||||||
use app\utils\Session;
|
use app\utils\Session;
|
||||||
|
use ba\Random;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
use support\Response;
|
use support\Response;
|
||||||
@@ -122,6 +123,7 @@ class GroupController extends ApiController
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
// 创建群
|
// 创建群
|
||||||
$group_id = Db::name('chat_group')->insertGetId([
|
$group_id = Db::name('chat_group')->insertGetId([
|
||||||
|
'id' => Random::build('alnum', 32),
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'shop_id' => $shop_id,
|
'shop_id' => $shop_id,
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class MessageController extends ApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 未读计数
|
// 未读计数
|
||||||
$unreadCount = Db::name('chat_unread_count')->where(['user_id' => $this->uid, 'session_id' => $session['session_id']])->value('count')?:0;
|
$unreadCount = Db::name('chat_unread_count')->where(['user_id' => $this->uid, 'session_id' => $session['to_id']])->value('count')?:0;
|
||||||
}
|
}
|
||||||
if($session['chat_type'] == 2) {
|
if($session['chat_type'] == 2) {
|
||||||
if($lastMsg) {
|
if($lastMsg) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class ChatMessage extends BaseModel
|
|||||||
}
|
}
|
||||||
// 单聊的话 两个人对话用一样的会话ID
|
// 单聊的话 两个人对话用一样的会话ID
|
||||||
$data[$k]['avatar'] = $avatar;
|
$data[$k]['avatar'] = $avatar;
|
||||||
|
$data[$k]['to_id'] = $data[$k]['user_id'];
|
||||||
$data[$k]['chat_type'] = $session['chat_type'];
|
$data[$k]['chat_type'] = $session['chat_type'];
|
||||||
$data[$k]['session_id'] = $session['session_id'];
|
$data[$k]['session_id'] = $session['session_id'];
|
||||||
$data[$k]['name'] = $name;
|
$data[$k]['name'] = $name;
|
||||||
|
|||||||
@@ -248,10 +248,10 @@ namespace extend\chat\model;
|
|||||||
// 对方是否在线,在线发 不在线存起来等上线了发
|
// 对方是否在线,在线发 不在线存起来等上线了发
|
||||||
if(Gateway::isUidOnline($str_uid)) {
|
if(Gateway::isUidOnline($str_uid)) {
|
||||||
// 加入未读计数
|
// 加入未读计数
|
||||||
if(!Db::name('chat_unread_count')->where(['user_id' => $message['to_id'], 'session_id' => $session_id])->find()) {
|
if(!Db::name('chat_unread_count')->where(['user_id' => $message['to_id'], 'session_id' => self::$user_info['uid']])->find()) {
|
||||||
Db::name('chat_unread_count')->insert(['user_id' => $message['to_id'], 'session_id' => $session_id, 'count' => 1, 'updated_time' => d()]);
|
Db::name('chat_unread_count')->insert(['user_id' => $message['to_id'], 'session_id' => self::$user_info['uid'], 'count' => 1, 'updated_time' => d()]);
|
||||||
}else {
|
}else {
|
||||||
Db::name('chat_unread_count')->where(['user_id' => $message['to_id'], 'session_id' => $session_id])->inc('count')->update(['updated_time' => d()]);
|
Db::name('chat_unread_count')->where(['user_id' => $message['to_id'], 'session_id' => self::$user_info['uid']])->inc('count')->update(['updated_time' => d()]);
|
||||||
}
|
}
|
||||||
Gateway::sendToUid($str_uid, self::sendReceive($notice_data));
|
Gateway::sendToUid($str_uid, self::sendReceive($notice_data));
|
||||||
}else {
|
}else {
|
||||||
@@ -285,10 +285,10 @@ namespace extend\chat\model;
|
|||||||
Business::setRedisMessage($grep['user_id'], $user_type, $notice_data);
|
Business::setRedisMessage($grep['user_id'], $user_type, $notice_data);
|
||||||
}
|
}
|
||||||
// 加入未读计数
|
// 加入未读计数
|
||||||
if(!Db::name('chat_unread_count')->where(['user_id' => $grep['user_id'], 'session_id' => $session_id])->find()) {
|
if(!Db::name('chat_unread_count')->where(['user_id' => $grep['user_id'], 'session_id' => $group_id])->find()) {
|
||||||
Db::name('chat_unread_count')->insert(['count' => 1, 'updated_time' => d(), 'user_id' => $grep['user_id'], 'session_id' => $session_id]);
|
Db::name('chat_unread_count')->insert(['count' => 1, 'updated_time' => d(), 'user_id' => $grep['user_id'], 'session_id' => $group_id]);
|
||||||
}else {
|
}else {
|
||||||
Db::name('chat_unread_count')->where(['user_id' => $grep['user_id'], 'session_id' => $session_id])->inc('count')->update(['updated_time' => d()]);
|
Db::name('chat_unread_count')->where(['user_id' => $grep['user_id'], 'session_id' => $group_id])->inc('count')->update(['updated_time' => d()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 更新对方会话列表
|
// 更新对方会话列表
|
||||||
|
|||||||
Reference in New Issue
Block a user