InformUserService.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace bizMall\message\services;
  3. use bizMall\base\services\BaseService;
  4. use bizMall\user\services\UserService;
  5. use common\components\sms;
  6. use common\components\wxUtil;
  7. use common\services\xhTMessageService;
  8. use Yii;
  9. use linslin\yii2\curl;
  10. class InformUserService extends BaseService
  11. {
  12. public static $baseFile = '\bizMall\message\classes\InformUserClass';
  13. //送到通知客户
  14. public static function reachInformUser($userId)
  15. {
  16. $userId = UserService::getById($userId);
  17. $TMList = xhTMessageService::getList($sjId);
  18. $tempId = $TMList[$shortTempId];
  19. //送达通知
  20. $shortTempId = 'OPENTM201205968';
  21. $openId = $user['openId'];
  22. if (!empty($openId) && $user['subscribe'] == 1) {
  23. $data = ["touser" => $openId, "template_id" => $tempId,
  24. "url" => Yii::$app->params['adminUrl'] . '/order/detail?id=' . $orderId, "data" => [
  25. "first" => ["value" => $userName . $payWay . '付款', "color" => "#173177"],
  26. "keyword1" => ["value" => $totalFee . '元', "color" => "#173177"],
  27. "keyword2" => ["value" => '客户付款', "color" => "#173177"],
  28. "keyword3" => ["value" => date("Y-m-d H:i"), "color" => "#173177"],
  29. "remark" => ["value" => "点击查看明细", "color" => "#173177"]]];
  30. $respond = wxUtil::sendTaskInform($data, $merchant);
  31. Yii::info('tm:' . json_encode($respond));
  32. } else {
  33. $mobile = $user['mobile'];
  34. $msg = "您订购的【】已经送到,祝您购物愉快";
  35. sms::merchantSend($mobile, $msg, $merchant);
  36. }
  37. }
  38. //充值成功通知 ssh
  39. //升级通知
  40. }