| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace bizMall\message\classes;
- use common\components\wxUtil;
- use Yii;
- use bizMall\base\classes\BaseClass;
- class TMessageClass extends BaseClass
- {
-
- public static $baseFile = '\bizMall\message\models\TMessage';
-
- //微信的模板消息
- public static $tMessage = [
- 'OPENTM207430125' => '操作成功通知',
- 'OPENTM401915538' => '审核通知',
- 'TM00006' => '充值通知',
- 'OPENTM201205968' => '订单送达通知',
- 'OPENTM207777535' => '付款提醒',
- 'OPENTM401761342' => '订单价格修改通知',
- 'OPENTM205211943' => '会员升级通知',
- 'TM00230' => '积分变动通知',
- 'OPENTM200605630' => '任务处理通知',
- 'OPENTM401027382' => '课程报名成功',
- 'OPENTM207422813' => '收入提醒',
- 'OPENTM202297555' => '下单成功通知',
- 'OPENTM207327227' => '宝贝售出提醒',
- 'OPENTM207188526' => '付款成功',
- 'TM00575' => '报名成功通知',
- 'OPENTM201319876' => '结算通知',
- ];
-
- public static function formatData($data)
- {
- $allTM = xhTMessageService::getList($coupon['sjId']);
- $shortTempId = 'OPENTM207422813';//收入提醒
- if (isset($allTM[$shortTempId])) {
- $tempId = $allTM[$shortTempId];
- $openId = $userInfo['openId'];
- $merchant = MerchantService::getById($coupon['sjId']);
- $data = ["touser" => $openId, "template_id" => $tempId,
- "url" => Yii::$app->params['mobile'] . '/center/myReward?account=' . $coupon['sjId'], "data" => [
- "first" => ["value" => $inviteUserInfo['userName'] . '使用了您的优惠卷,您获得:' . $rewardData['reward'], "color" => "#173177"],
- "keyword1" => ["value" => '点击查看', "color" => "#173177"],
- "keyword2" => ["value" => '老带新活动', "color" => "#173177"],
- "keyword3" => ["value" => date("Y-m-d H:i"), "color" => "#173177"],
- "remark" => ["value" => "点击查看明细", "color" => "#173177"]]];
- //$return = wxUtil::sendTaskInform($data, $merchant);
- }
- //推送到MQ
- }
-
- //删除商家的全部模板消息 ssh 2020.2.7
- public static function delMerchantTMessage($merchant)
- {
- $sjId = $merchant['id'];
- $list = self::getAllByCondition(['sjId' => $sjId], null, '*');
- if (!empty($list)) {
- foreach ($list as $key => $val) {
- $templateId = $val['templateId'];
- wxUtil::delTMessage($merchant, $templateId);
- }
- self::deleteByCondition(['sjId' => $sjId]);
- }
- }
-
- }
|