Commit 6435bf5f authored by 王源's avatar 王源
Browse files

MessageHandler添加发送文本消息方法

parent a2f85ee0
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -47,4 +47,21 @@ class MessageHandler
        $this->messageService->send($receiverIds, $application, $templateId, $sendUserId, $replace);
    }

    /**
     * 发送文本消息
     * @param $receiverIds
     * @param $content
     * @throws HttpResponseException
     */
    public function sendText($receiverIds, $content)
    {
        $application = $this->config->get('app_name');
        if (!$application) {
            throw new HttpResponseException("请设置应用名app_name");
        }
        $receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds];
        $sendUserId = Auth::id();
        $this->messageService->send($receiverIds, $application, 0, $sendUserId, [], $content);
    }

}