123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types = 1);
- namespace app\common\service;
- /**
- * 消息通知服务
- * Class Message
- * @package app\common\service
- */
- class Message extends BaseService
- {
- /**
- * 场景列表
- * [场景名称] => [场景类]
- * @var array
- */
- private static $sceneList = [
- // 短信验证码
- 'passport.captcha' => \app\common\service\message\passport\Captcha::class,
- // 订单支付成功
- 'order.payment' => \app\common\service\message\order\Payment::class,
- // 订单发货
- 'order.delivery' => \app\common\service\message\order\Delivery::class,
- // 订单退款
- 'order.refund' => \app\common\service\message\order\Refund::class,
- ];
- /**
- * 发送消息通知
- * @param string $sceneName 场景名称
- * @param array $param 参数
- * @param int $storeId 商城ID
- * @return bool
- */
- public static function send(string $sceneName, array $param, int $storeId)
- {
- if (!isset(self::$sceneList[$sceneName])) return false;
- $class = self::$sceneList[$sceneName];
- return (new $class($storeId))->send($param);
- }
- /**
- * 企业微信技术群公明腊肠系统监控zq
- * @param $msg
- */
- public static function wxRobot($msg){
- //$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=bf17777d-35ab-4b80-9361-13927929cce5';
- $url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=103b767e-2e8a-4816-8d54-66642e414615';
- $payload = '{
- "msgtype": "text",
- "text": {
- "content": "'.$msg.'",
- "mentioned_list":["@all"]
- }
- }';
- curl_post($url,$payload);
- }
- }
|