Browse Source

撤回接口优化

master
wanghongjun 3 months ago
parent
commit
857be5a974
  1. 6
      app/enterprise/controller/Im.php

6
app/enterprise/controller/Im.php

@ -462,7 +462,7 @@ class Im extends BaseController
$fromUserName = lang('im.other'); $fromUserName = lang('im.other');
$toContactId = $message['to_user']; $toContactId = $message['to_user'];
if ($message['is_group'] == 1) { if ($message['is_group'] == 1) {
$fromUserName = $this->userInfo['realname']; $fromUserName = User::where('user_id',$message['from_user'])->value('realname');
$toContactId = explode('-', $message['chat_identify'])[1]; $toContactId = explode('-', $message['chat_identify'])[1];
// 如果是群聊消息撤回,需要判断是否是群主或者管理员,如果是则可以撤回 // 如果是群聊消息撤回,需要判断是否是群主或者管理员,如果是则可以撤回
if($message['from_user']!=$this->userInfo['user_id']){ if($message['from_user']!=$this->userInfo['user_id']){
@ -491,11 +491,11 @@ class Im extends BaseController
$data['is_last'] = $info['is_last']; $data['is_last'] = $info['is_last'];
$data['toContactId'] = $message['is_group'] == 1 ? $info['chat_identify'] : $toContactId; $data['toContactId'] = $message['is_group'] == 1 ? $info['chat_identify'] : $toContactId;
$data['isMobile'] = $this->request->isMobile() ? 1 : 0; $data['isMobile'] = $this->request->isMobile() ? 1 : 0;
wsSendMsg($toContactId, 'undoMessage', $data, $info['is_group']); wsSendMsg($toContactId, 'undoMessage', $data, $info['is_group']);
if($info['is_group']==0){ if($info['is_group']==0){
// 给自己也发一份推送,多端同步 // 给自己也发一份推送,多端同步
$data['content'] =lang('im.you'). $text; $data['content'] =lang('im.you'). $text;
wsSendMsg($this->userInfo['user_id'], 'undoMessage', $data, $info['is_group']); wsSendMsg($this->userInfo['user_id'], 'undoMessage', $data, $info['is_group']);
} }
return success(''); return success('');
} else { } else {

Loading…
Cancel
Save