|
|
@@ -2,10 +2,46 @@
|
|
|
|
|
|
namespace biz\message\classes;
|
|
|
|
|
|
+use biz\merchant\classes\MerchantClass;
|
|
|
+use common\components\sms;
|
|
|
+use common\components\wxUtil;
|
|
|
+use common\services\xhTMessageService;
|
|
|
use Yii;
|
|
|
use biz\base\classes\BaseClass;
|
|
|
|
|
|
class InformUserClass extends BaseClass
|
|
|
{
|
|
|
+
|
|
|
public static $baseFile = '\biz\message\models\InformUser';
|
|
|
+
|
|
|
+ //花送到了通知客户 shish
|
|
|
+ public static function sendComplete($user, $order)
|
|
|
+ {
|
|
|
+ //通知客户
|
|
|
+ $openId = $user['openId'];
|
|
|
+ $merchantId = $user['merchantId'];
|
|
|
+ $merchant = MerchantClass::getById($merchantId);
|
|
|
+ if (isset($user['subscribe']) && $user['subscribe'] == 1) {
|
|
|
+ $allTM = xhTMessageService::getList($merchantId);
|
|
|
+ $shortTempId = 'OPENTM201205968';//订单送达通知
|
|
|
+ $tempId = $allTM[$shortTempId];
|
|
|
+ $data = ["touser" => $openId, "template_id" => $tempId,
|
|
|
+ "url" => Yii::$app->params['mHost'] . "/#/pages/order/detail?id=" . $order['id'],
|
|
|
+ "data" => [
|
|
|
+ "first" => ["value" => '您的订单已送达', "color" => "#173177"],
|
|
|
+ "keyword1" => ["value" => (string)$order['orderSn'], "color" => "#173177"],
|
|
|
+ "keyword2" => ["value" => $order['receiveUserName'], "color" => "#173177"],
|
|
|
+ "keyword3" => ["value" => '已送达', "color" => "#173177"],
|
|
|
+ "remark" => ["value" => '感谢您惠顾,祝你生活愉快!', "color" => "#173177"]]];
|
|
|
+ wxUtil::sendTaskInform($data, $merchant);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isset($user['mobile']) && !empty($user['mobile'])) {
|
|
|
+ $mobile = $user['mobile'];
|
|
|
+ $msg = '您的鲜花已送达,感谢惠顾,祝您生活愉快。';
|
|
|
+ sms::send($mobile, $msg, $merchant);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|