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

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

parent a1166f42
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -53,15 +53,31 @@ class MessageHandler
     * @param $content
     * @throws HttpResponseException
     */
    public function sendText($receiverIds, $content)
    public function sendText($receiverIds, $content, $sendUserId = null)
    {
        $application = $this->config->get('app_name');
        if (!$application) {
            throw new HttpResponseException("请设置应用名app_name");
        }
        $receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds];
        $sendUserId = Auth::id();
        $sendUserId =$sendUserId ?: Auth::id();
        $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);
    }

}