From dc5bb49682cc05bb44b92e58bb12f3f2e286e93c Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Tue, 22 Jul 2025 10:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E9=BB=91=EF=BC=8C=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E6=8B=89=E9=BB=91=E6=95=B0=E6=8D=AE=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/enterprise/model/Message.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/enterprise/model/Message.php b/app/enterprise/model/Message.php index 49f8955..9b8fc7d 100644 --- a/app/enterprise/model/Message.php +++ b/app/enterprise/model/Message.php @@ -20,6 +20,8 @@ class Message extends BaseModel protected $json = ["extends"]; protected $jsonAssoc = true; protected static $fileType=['file','image','video','voice','emoji']; + // 判断是否为拉黑发送的数据 + protected $blackData = false; // 添加聊天记录 public static function addData($data){ @@ -146,23 +148,15 @@ class Message extends BaseModel } // 判断是否存在及数据有效性 if (isset($param['msg_id']) && is_numeric($param['msg_id'])) { - $where = [ - 'msg_id' => $param['msg_id'], - 'status' => 2, - 'from_user' => $uid, - 'to_user' => $param['toContactId'], - ]; + $where = ['msg_id' => $param['msg_id'], 'status' => 2]; $message = $this->where($where)->find(); - if (!$message) { - $this->error = lang('system.error'); - return false; - } + if ($message) $this->blackData = true; } - return self::sendMsg($param,$is_group); + return self::sendMsg($param,$is_group,$this->blackData); } //实际发送消息 - public static function sendMsg($param,$is_group=0){ + public static function sendMsg($param,$is_group=0,$blackData=false){ $uid=self::$uid ?: ($param['user_id'] ?? 1); $toContactId=$param['toContactId']; $manage=[]; @@ -232,7 +226,7 @@ class Message extends BaseModel } $message=new self(); $message->update(['is_last'=>0],['chat_identify'=>$chat_identify]); - if (isset($param['msg_id'])) { + if (isset($param['msg_id']) && $blackData) { $message = $message->where('msg_id', $param['msg_id'])->find(); if (!$message) { $message=new self();