|
|
@ -20,6 +20,8 @@ class Message extends BaseModel |
|
|
protected $json = ["extends"]; |
|
|
protected $json = ["extends"]; |
|
|
protected $jsonAssoc = true; |
|
|
protected $jsonAssoc = true; |
|
|
protected static $fileType=['file','image','video','voice','emoji']; |
|
|
protected static $fileType=['file','image','video','voice','emoji']; |
|
|
|
|
|
// 判断是否为拉黑发送的数据 |
|
|
|
|
|
protected $blackData = false; |
|
|
|
|
|
|
|
|
// 添加聊天记录 |
|
|
// 添加聊天记录 |
|
|
public static function addData($data){ |
|
|
public static function addData($data){ |
|
|
@ -146,23 +148,15 @@ class Message extends BaseModel |
|
|
} |
|
|
} |
|
|
// 判断是否存在及数据有效性 |
|
|
// 判断是否存在及数据有效性 |
|
|
if (isset($param['msg_id']) && is_numeric($param['msg_id'])) { |
|
|
if (isset($param['msg_id']) && is_numeric($param['msg_id'])) { |
|
|
$where = [ |
|
|
$where = ['msg_id' => $param['msg_id'], 'status' => 2]; |
|
|
'msg_id' => $param['msg_id'], |
|
|
|
|
|
'status' => 2, |
|
|
|
|
|
'from_user' => $uid, |
|
|
|
|
|
'to_user' => $param['toContactId'], |
|
|
|
|
|
]; |
|
|
|
|
|
$message = $this->where($where)->find(); |
|
|
$message = $this->where($where)->find(); |
|
|
if (!$message) { |
|
|
if ($message) $this->blackData = true; |
|
|
$this->error = lang('system.error'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
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); |
|
|
$uid=self::$uid ?: ($param['user_id'] ?? 1); |
|
|
$toContactId=$param['toContactId']; |
|
|
$toContactId=$param['toContactId']; |
|
|
$manage=[]; |
|
|
$manage=[]; |
|
|
@ -232,7 +226,7 @@ class Message extends BaseModel |
|
|
} |
|
|
} |
|
|
$message=new self(); |
|
|
$message=new self(); |
|
|
$message->update(['is_last'=>0],['chat_identify'=>$chat_identify]); |
|
|
$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(); |
|
|
$message = $message->where('msg_id', $param['msg_id'])->find(); |
|
|
if (!$message) { |
|
|
if (!$message) { |
|
|
$message=new self(); |
|
|
$message=new self(); |
|
|
|