InformUserClass.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace biz\message\classes;
  3. use biz\merchant\classes\MerchantClass;
  4. use common\components\sms;
  5. use common\components\wxUtil;
  6. use common\services\xhTMessageService;
  7. use Yii;
  8. use biz\base\classes\BaseClass;
  9. class InformUserClass extends BaseClass
  10. {
  11. public static $baseFile = '\biz\message\models\InformUser';
  12. //花送到了通知客户 shish
  13. public static function sendComplete($user, $order)
  14. {
  15. //通知客户
  16. $openId = $user['openId'];
  17. $merchantId = $user['merchantId'];
  18. $merchant = MerchantClass::getById($merchantId);
  19. if (isset($user['subscribe']) && $user['subscribe'] == 1) {
  20. $allTM = xhTMessageService::getList($merchantId);
  21. $shortTempId = 'OPENTM201205968';//订单送达通知
  22. $tempId = $allTM[$shortTempId];
  23. $data = ["touser" => $openId, "template_id" => $tempId,
  24. "url" => Yii::$app->params['mHost'] . "/#/pages/order/detail?id=" . $order['id'],
  25. "data" => [
  26. "first" => ["value" => '您的订单已送达', "color" => "#173177"],
  27. "keyword1" => ["value" => (string)$order['orderSn'], "color" => "#173177"],
  28. "keyword2" => ["value" => $order['receiveUserName'], "color" => "#173177"],
  29. "keyword3" => ["value" => '已送达', "color" => "#173177"],
  30. "remark" => ["value" => '感谢您惠顾,祝你生活愉快!', "color" => "#173177"]]];
  31. wxUtil::sendTaskInform($data, $merchant);
  32. return true;
  33. }
  34. if (isset($user['mobile']) && !empty($user['mobile'])) {
  35. $mobile = $user['mobile'];
  36. $msg = '您的鲜花已送达,感谢惠顾,祝您生活愉快。';
  37. sms::send($mobile, $msg, $merchant);
  38. }
  39. }
  40. }