|
|
@@ -236,4 +236,47 @@ class WxMessageClass extends BaseClass
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //采购单已发货 shish 20210531
|
|
|
+ public static function cgOrderHasSend($shop, $order)
|
|
|
+ {
|
|
|
+ $shopId = $shop->id;
|
|
|
+ $ptStyle = $shop->ptStyle;
|
|
|
+ $wxBase = WxOpenClass::getWxBase();
|
|
|
+ $wx = $wxBase[$ptStyle] ?? [];
|
|
|
+ $message = self::getAllByCondition(['ptStyle' => $ptStyle], null, '*', 'shortTemplateId');
|
|
|
+ $shortTempId = 'OPENTM416881153';//下单成功通知
|
|
|
+ $tempId = isset($message[$shortTempId]['templateId']) ? $message[$shortTempId]['templateId'] : '';
|
|
|
+ if (empty($tempId)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $orderId = $order->id;
|
|
|
+ $orderSn = (string)$order->orderSn;
|
|
|
+ $adminList = ShopAdminClass::getRemainAdmin($shopId);
|
|
|
+ $ghsShopAdminName = $order->ghsShopAdminName ?? '';
|
|
|
+ foreach ($adminList as $admin) {
|
|
|
+ if (isset($admin['subscribe']) == false || $admin['subscribe'] == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $openId = isset($admin['openId']) ? $admin['openId'] : '';
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ "touser" => $openId,
|
|
|
+ "template_id" => $tempId,
|
|
|
+ "url" => Yii::$app->params['ghsDomain'],
|
|
|
+ "data" => [
|
|
|
+ "first" => ["value" => '亲,您的采购单已发货,请注意签收', "color" => "#173177"],
|
|
|
+ "keyword1" => ["value" => $orderSn, "color" => "#173177"],
|
|
|
+ "keyword2" => ["value" => date("Y-m-d H:i:s"), "color" => "#173177"],
|
|
|
+ "keyword3" => ["value" => $ghsShopAdminName, "color" => "#173177"],
|
|
|
+ "remark" => ["value" => "点击查看详情", "color" => "#173177"]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+
|
|
|
+ $data['miniprogram']['appid'] = $wx['miniAppId'];
|
|
|
+ $data['miniprogram']['pagepath'] = 'pagesPurchase / purDetails ? id = ' . $orderId;
|
|
|
+
|
|
|
+ wxUtil::sendTaskInform($data, $wx, $ptStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|