From 05520417187cc1a9e18751af857f3741c43d8f6b Mon Sep 17 00:00:00 2001 From: lamson <171004297@qq.com> Date: Mon, 19 Feb 2024 21:48:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0notice=E5=87=BD?= =?UTF-8?q?=E6=95=B0(=E5=BE=85=E5=AE=8C=E6=88=90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/function.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/function.php b/src/function.php index 9cc983c..b09f12c 100644 --- a/src/function.php +++ b/src/function.php @@ -9,13 +9,6 @@ use EasySwoole\Redis\Redis; use EasySwoole\RedisPool\RedisPool; use EasySwoole\Spl\SplArray; -use WonderGame\EsUtility\Notify\DingTalk\Message\Markdown; -use WonderGame\EsUtility\Notify\DingTalk\Message\Text; -use WonderGame\EsUtility\Notify\Feishu\Message\Textarea; -use WonderGame\EsUtility\Notify\Feishu\Message\Text AS FeishuText; -use WonderGame\EsUtility\Notify\Feishu\Message\Card; -use WonderGame\EsUtility\Notify\EsNotify; -use WonderGame\EsUtility\Notify\WeChat\Message\Notice; use WonderGame\EsUtility\Common\Classes\CtxRequest; use WonderGame\EsUtility\Common\Classes\LamJwt; use WonderGame\EsUtility\Common\Classes\Mysqli; @@ -23,6 +16,13 @@ use WonderGame\EsUtility\Common\Http\Code; use WonderGame\EsUtility\Common\OrmCache\Strings; use WonderGame\EsUtility\HttpTracker\Index as HttpTracker; +use WonderGame\EsUtility\Notify\DingTalk\Message\Markdown; +use WonderGame\EsUtility\Notify\DingTalk\Message\Text; +use WonderGame\EsUtility\Notify\EsNotify; +use WonderGame\EsUtility\Notify\Feishu\Message\Card; +use WonderGame\EsUtility\Notify\Feishu\Message\Text as FeishuText; +use WonderGame\EsUtility\Notify\Feishu\Message\Textarea; +use WonderGame\EsUtility\Notify\WeChat\Message\Notice; if ( ! function_exists('is_super')) { @@ -520,6 +520,17 @@ function lang($const = '') } } +if ( ! function_exists('notice')) { + function notice($content = '', $title = null, $name = 'default') + { + // 富文本 + if ($title) { + config('ES_NOTIFY.driver') == 'feishu' ? feishu_textarea($content, true, $name) : dingtalk_markdown($title, $content, true, $name); + } else { + config('ES_NOTIFY.driver') == 'feishu' ? feishu_text($content, true, $name) : dingtalk_text($content, true, $name); + } + } +} if ( ! function_exists('wechat_notice')) { function wechat_notice($content = '', $name = 'default')