Commit c81f753e authored by 王源's avatar 王源 🎧

添加自动发送模板消息方法

parent 78564e78
......@@ -53,17 +53,34 @@ class MessageHandler
* @param $content
* @throws HttpResponseException
*/
public function sendText($receiverIds, $content, $sendUserId = null)
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 =$sendUserId ?: Auth::id();
$sendUserId = Auth::id();
$this->messageService->send($receiverIds, $application, 0, $sendUserId, [], $content);
}
/**
* 自动发送模板消息
* @param $receiverIds
* @param $templateId
* @param array $replace
* @throws HttpResponseException
*/
public function sendAutoTemp($receiverIds, $templateId, $replace = [])
{
$application = $this->config->get('app_name');
if (!$application) {
throw new HttpResponseException("请设置应用名app_name");
}
$receiverIds = is_array($receiverIds) ? $receiverIds : [$receiverIds];
$this->messageService->send($receiverIds, $application, $templateId, 0, $replace);
}
/**
* 定时任务专用 发送文本消息
* @param $receiverIds
......
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