新增问诊消息推送

This commit is contained in:
2023-03-28 15:56:39 +08:00
parent cfc7887ce9
commit d0d1e7494d
14 changed files with 288 additions and 82 deletions
-39
View File
@@ -276,43 +276,4 @@ class ImService extends BaseService
$message->sendMessage($arg);
}
// 发送自定义消息
public function sendCustomMessage(string $from_user_id,string $to_user_id,string $content,string $order_inquiry_id,int $inquiry_type, array $cloud_custom_data): void
{
if (!empty($from_user_id)){
// 检测并创建发送者资料
$this->setUserProfile($from_user_id);
}
// 检测并创建接收者资料
$this->setUserProfile($to_user_id);
$message = new Message();
$arg = array();
if (!empty($from_user_id)){
$arg['From_Account'] = $from_user_id; // 发送方user_id 如系统发送,无需填写
}
$arg['To_Account'] = $to_user_id; // 接收方user_id
$arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback','ForbidAfterSendMsgCallback'];
$arg['SendMsgControl'] = ['NoUnread'];
$arg['MsgBody'] = [
[
"MsgType" => "TIMCustomElem",
"MsgContent" => [
"Data" => $content,
],
]
];
// 自定义消息
$arg['CloudCustomData'] = "";
if (!empty($cloud_custom_data)){
$arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE);
}
$message->sendMessage($arg);
}
}