diff --git a/app/enterprise/model/Message.php b/app/enterprise/model/Message.php index 7df68fb..585e3b5 100644 --- a/app/enterprise/model/Message.php +++ b/app/enterprise/model/Message.php @@ -102,12 +102,12 @@ class Message extends BaseModel // 判断我是不是对方的客服 $cus = User::where(['user_id' => $param['toContactId']])->value('cs_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) { $this->error=lang('im.notFriend'); 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) { $this->error=lang('im.friendNot'); return false; @@ -290,8 +290,10 @@ class Message extends BaseModel $user=new User(); // 将聊天窗口的联系人信息带上,方便临时会话 $sendData['contactInfo']=$user->setContact($sendData['toContactId'],$is_group,$sendData['type'],$sendData['content']); - // 向发送方发送消息 - wsSendMsg($toContactId,$type,$sendData,$is_group); + // 向发送方发送消息 # 失败不发送ws + if ($sendData['status'] != 'failed') { + wsSendMsg($toContactId,$type,$sendData,$is_group); + } // 判断图片查看 if (isset($param['file_id']) && $param['file_id']) { $res = MessageView::addView($message->msg_id,$param['user_id'],$param['file_id'], $data['content']);