Browse Source

拉黑优化

master
wanghongjun 1 week ago
parent
commit
90f624ecd7
  1. 10
      app/enterprise/model/Message.php

10
app/enterprise/model/Message.php

@ -102,12 +102,12 @@ class Message extends BaseModel
// 判断我是不是对方的客服 // 判断我是不是对方的客服
$cus = User::where(['user_id' => $param['toContactId']])->value('cs_uid'); $cus = User::where(['user_id' => $param['toContactId']])->value('cs_uid');
if ($cus != $uid) { if ($cus != $uid) {
$friend = Friend::where(['friend_user_id' => $uid, 'create_user' => $param['toContactId']])->find(); $friend = Friend::where(['friend_user_id' => $uid, 'create_user' => $param['toContactId'], 'status' => 1])->find();
if (!$friend) { if (!$friend) {
$this->error=lang('im.notFriend'); $this->error=lang('im.notFriend');
return false; return false;
} }
$otherFriend = Friend::where(['friend_user_id' => $param['toContactId'], 'create_user' => $uid])->find(); $otherFriend = Friend::where(['friend_user_id' => $param['toContactId'], 'create_user' => $uid, 'status' => 1])->find();
if (!$otherFriend) { if (!$otherFriend) {
$this->error=lang('im.friendNot'); $this->error=lang('im.friendNot');
return false; return false;
@ -290,8 +290,10 @@ class Message extends BaseModel
$user=new User(); $user=new User();
// 将聊天窗口的联系人信息带上,方便临时会话 // 将聊天窗口的联系人信息带上,方便临时会话
$sendData['contactInfo']=$user->setContact($sendData['toContactId'],$is_group,$sendData['type'],$sendData['content']); $sendData['contactInfo']=$user->setContact($sendData['toContactId'],$is_group,$sendData['type'],$sendData['content']);
// 向发送方发送消息 // 向发送方发送消息 # 失败不发送ws
wsSendMsg($toContactId,$type,$sendData,$is_group); if ($sendData['status'] != 'failed') {
wsSendMsg($toContactId,$type,$sendData,$is_group);
}
// 判断图片查看 // 判断图片查看
if (isset($param['file_id']) && $param['file_id']) { if (isset($param['file_id']) && $param['file_id']) {
$res = MessageView::addView($message->msg_id,$param['user_id'],$param['file_id'], $data['content']); $res = MessageView::addView($message->msg_id,$param['user_id'],$param['file_id'], $data['content']);

Loading…
Cancel
Save