| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace biz\message\classes;
- use Yii;
- use biz\base\classes\BaseClass;
- class InformAdminClass extends BaseClass
- {
-
- public static $baseFile = '\biz\message\models\InformAdmin';
-
- //宝贝售出通知 shish 2019.12.24
- public static function goodsSoldInformAdmin($params, $informWay = 0, $TMList = [])
- {
- $params = [];
- if ($informWay == 'wx') {
- //收入提醒
- $shortTempId = 'OPENTM207422813';
- $tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
- $tmData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
- "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
- "keyword1" => ["value" => (string)$orderId, "color" => "#173177"],
- "keyword2" => ["value" => $orderName, "color" => "#173177"],
- "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
- "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
- "keyword5" => ["value" => $userName, "color" => "#173177"],
- "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]]];
- return $tmData;
- }
- if ($informWay == 'sms') {
- return "客户" . $userName . "付款" . $totalFee . '元';
- }
- }
- //宝贝售出通知 shish 2019.12.24
- public static function inform($params, $type, $informWay = 0, $TMList = [])
- {
- switch ($type) {
- case 'goodsSoldInformAdmin':
- $respond = self::goodsSoldInformAdmin($params, $informWay, $TMList);
- break;
- default:
- }
- return $respond;
- }
-
- //门店收入提醒 shish 2019.12.24
- public static function shopIncomeInformAdmin2($data, $merchantId = 0)
- {
- $TMList = xhTMessageService::getList($merchantId);
- $adminList = AdminClass::getAllNoticeAdmin($merchantId);
- $merchant = MerchantService::getById($merchantId);
- $shortTempId = 'OPENTM207422813';//收入提醒
- if (isset($TMList[$shortTempId]) == false) {
- util::fail('没有找到公众号的消息模样:' . $shortTempId);
- }
- $tempId = $TMList[$shortTempId];
- foreach ($adminList as $adminKey => $admin) {
- $openId = $admin['openId'];
- if (!empty($openId) && $admin['subscribe'] == 1) {
- $data = ["touser" => $openId, "template_id" => $tempId,
- "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
- "first" => ["value" => $userName . $payWay . '付款', "color" => "#173177"],
- "keyword1" => ["value" => $totalFee . '元', "color" => "#173177"],
- "keyword2" => ["value" => '客户付款', "color" => "#173177"],
- "keyword3" => ["value" => date("Y-m-d H:i"), "color" => "#173177"],
- "remark" => ["value" => "点击查看明细", "color" => "#173177"]]];
- $respond = weixinUtil::sendTaskInform($data, $merchant);
- Yii::info('tm:' . json_encode($respond));
- } else {
- $mobile = $admin['mobile'];
- $msg = "客户" . $userName . "付款" . $totalFee . '元';
- sms::merchantSend($mobile, $msg, $merchant);
- }
- }
- }
-
- //宝贝售出通知 shish 2019.12.24
- public static function goodsSoldInformAdmin2($merchantId)
- {
-
- $TMList = xhTMessageService::getList($merchantId);
- $merchant = MerchantService::getById($merchantId);
- $shortTempId = 'OPENTM207422813';//收入提醒
- $tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
- foreach ($adminList as $adminKey => $admin) {
- $openId = $admin['openId'];
- if (!empty($openId) && $admin['subscribe'] == 1) {
- $sendData = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
- "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
- "keyword1" => ["value" => (string)$orderId, "color" => "#173177"],
- "keyword2" => ["value" => $orderName, "color" => "#173177"],
- "keyword3" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
- "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
- "keyword5" => ["value" => $userName, "color" => "#173177"],
- "remark" => ["value" => '点此查看详细、编辑收花人信息。', "color" => "#173177"]]];
- $respond = weixinUtil::sendTaskInform($sendData, $merchant);
- Yii::info('tm:' . json_encode($respond));
- } else {
- $mobile = $admin['mobile'];
- $msg = "客户" . $userName . "付款" . $totalFee . '元';
- sms::merchantSend($mobile, $msg, $merchant);
- }
- }
- }
-
-
- }
|