AI功能提交
This commit is contained in:
@@ -53,6 +53,9 @@ class MessageController extends BaseController
|
||||
->field('id,nickname,avatar')
|
||||
->find();
|
||||
$v['msgInfo'] = $friend;
|
||||
$v['unreadCount'] = Db::table('s2_wechat_message')
|
||||
->where(['wechatFriendId' => $v['wechatFriendId'],'isRead' => 0])
|
||||
->count();
|
||||
}
|
||||
|
||||
if (!empty($v['wechatChatroomId'])){
|
||||
@@ -61,12 +64,45 @@ class MessageController extends BaseController
|
||||
->field('id,nickname,chatroomAvatar as avatar')
|
||||
->find();
|
||||
$v['msgInfo'] = $chatroom;
|
||||
$v['unreadCount'] = Db::table('s2_wechat_message')
|
||||
->where(['wechatChatroomId' => $v['wechatChatroomId'],'isRead' => 0])
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
unset($v);
|
||||
|
||||
return ResponseHelper::success($list);
|
||||
}
|
||||
|
||||
|
||||
public function readMessage(){
|
||||
$wechatFriendId = $this->request->param('wechatFriendId', '');
|
||||
$wechatChatroomId = $this->request->param('wechatChatroomId', '');
|
||||
$accountId = $this->getUserInfo('s2_accountId');
|
||||
if (empty($accountId)){
|
||||
return ResponseHelper::error('请先登录');
|
||||
}
|
||||
if (empty($wechatChatroomId) && empty($wechatFriendId)){
|
||||
return ResponseHelper::error('参数缺失');
|
||||
}
|
||||
|
||||
$where = [];
|
||||
if (!empty($wechatChatroomId)){
|
||||
$where[] = ['wechatChatroomId','=',$wechatChatroomId];
|
||||
}
|
||||
|
||||
if (!empty($wechatFriendId)){
|
||||
$where[] = ['wechatFriendId','=',$wechatFriendId];
|
||||
}
|
||||
|
||||
Db::table('s2_wechat_message')->where($where)->update(['isRead' => 1]);
|
||||
|
||||
|
||||
return ResponseHelper::success([]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user