Commit 7e813db9 authored by 周智鹏's avatar 周智鹏

定时任务专用发送文本消息

parent a1166f42
...@@ -53,15 +53,31 @@ class MessageHandler ...@@ -53,15 +53,31 @@ class MessageHandler
* @param $content * @param $content
* @throws HttpResponseException * @throws HttpResponseException
*/ */
public function sendText($receiverIds, $content) public function sendText($receiverIds, $content, $sendUserId = null)
{ {
$application = $this->config->get('app_name'); $application = $this->config->get('app_name');
if (!$application) { if (!$application) {
throw new HttpResponseException("请设置应用名app_name"); throw new HttpResponseException("请设置应用名app_name");
} }
$receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds]; $receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds];
$sendUserId = Auth::id(); $sendUserId =$sendUserId ?: Auth::id();
$this->messageService->send($receiverIds, $application, 0, $sendUserId, [], $content); $this->messageService->send($receiverIds, $application, 0, $sendUserId, [], $content);
} }
/**
* 定时任务专用 发送文本消息
* @param $receiverIds
* @param $content
* @throws HttpResponseException
*/
public function sendCrontabText($receiverIds, $content)
{
$application = $this->config->get('app_name');
if (!$application) {
throw new HttpResponseException("请设置应用名app_name");
}
$receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds];
$this->messageService->send($receiverIds, $application, 0, 0, [], $content);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment