| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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, $admin, $TMList)
- {
- $informWay = isset($admin['openId']) && !empty($admin['openId']) && isset($admin['subscribe']) && $admin['subscribe'] == 1 ? 'wx' : 'sms';
- $totalFee = 199;
- $orderSn = '2051229823132466';
- $orderName = '商品';
- $userName = '石头';
- $data = ['tMessage' => '', 'content' => '', 'briefContent' => ''];
- $data['briefContent'] = "客户" . $userName . "付款" . $totalFee . '元';
- if ($informWay == 'wx') {
- //收入提醒
- $openId = $admin['openId'];
- $shortTempId = 'OPENTM207422813';
- $tempId = isset($TMList[$shortTempId]) ? $TMList[$shortTempId] : '';
- $tMessage = ["touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderSn, "data" => [
- "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
- "keyword1" => ["value" => (string)$orderSn, "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"]]];
- $data['tMessage'] = json_encode($tMessage);
- }
- if ($informWay == 'sms') {
- $msg = "客户" . $userName . "付款" . $totalFee . '元';
- $data['content'] = $msg;
- }
- return $data;
- }
-
- //通知员工 shish
- public static function addInform($params, $admin, $type, $TMList)
- {
- switch ($type) {
- case 'goodsSold':
- $respond = self::goodsSoldInformAdmin($params, $admin, $TMList);
- break;
- default:
- }
- $data = ['messageType' => 'inform', 'informWay' => 'wx', 'userType' => 'admin', 'id' => 1, 'mobile' => '15280215347'];
- $data = array_merge($data, $respond);
- $producer = Yii::$app->rabbitmq->getProducer('producerInform');
- $msg = serialize($data);
- $producer->publish($msg, 'exInform', 'routeInform');die;
- }
-
- //门店收入提醒 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=' . $orderSn, "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=' . $orderSn, "data" => [
- "first" => ["value" => '您有宝贝售出哦!', "color" => "#173177"],
- "keyword1" => ["value" => (string)$orderSn, "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);
- }
- }
- }
-
-
- }
|