全栈小学生 504b4c96a8 up
2026-03-20 15:59:18 +08:00

57 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\service\core\notice;
use app\job\notice\Notice;
use app\model\sys\SysNotice;
use core\base\BaseCoreService;
use core\exception\NoticeException;
use think\facade\Log;
/**
* 支付渠道服务层
*/
class NoticeService extends BaseCoreService
{
public function __construct()
{
parent::__construct();
$this->model = new SysNotice();
}
/**
* 消息发送
* @param $key
* @param $data
* @return false|mixed
* @throws \Exception
*/
public static function send($key, $data)
{
try {
$template = (new CoreNoticeService())->getInfo($key);
Log::write("消息发送");
Log::write($template);
if (empty($template)) return false;
return Notice::dispatch(['key' => $key, 'data' => $data, 'template' => $template], is_async: $template['async']);
} catch (\Exception $e) {
throw new NoticeException($e->getMessage());
}
}
}