|
|
@@ -191,4 +191,49 @@ class WxMessageClass extends BaseClass
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //采购单下单成功 shish 20210531
|
|
|
+ public static function generateCgOrder($shop, $order)
|
|
|
+ {
|
|
|
+ $shopId = $shop->id;
|
|
|
+ $ptStyle = $shop->ptStyle;
|
|
|
+ $wxBase = WxOpenClass::getWxBase();
|
|
|
+ $wx = $wxBase[$ptStyle] ?? [];
|
|
|
+ $message = self::getAllByCondition(['ptStyle' => $ptStyle], null, '*', 'shortTemplateId');
|
|
|
+ $shortTempId = 'OPENTM202297555';//下单成功通知
|
|
|
+ $tempId = isset($message[$shortTempId]['templateId']) ? $message[$shortTempId]['templateId'] : '';
|
|
|
+ if (empty($tempId)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $orderId = $order->id;
|
|
|
+ $orderSn = $order->orderSn;
|
|
|
+ $totalFee = $order->actPrice;
|
|
|
+ $adminList = ShopAdminClass::getRemainAdmin($shopId);
|
|
|
+ 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" => (string)$orderSn, "color" => "#173177"],
|
|
|
+ "keyword2" => ["value" => '-', "color" => "#173177"],
|
|
|
+ "keyword3" => ["value" => $order->bigNum . '/' . $order->smallNum, "color" => "#173177"],
|
|
|
+ "keyword4" => ["value" => number_format($totalFee, 2) . '元', "color" => "#173177"],
|
|
|
+ "keyword5" => ["value" => '微信支付', "color" => "#173177"],
|
|
|
+ "remark" => ["value" => "", "color" => "#173177"]
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+
|
|
|
+ $data['miniprogram']['appid'] = $wx['miniAppId'];
|
|
|
+ $data['miniprogram']['pagepath'] = 'pagesPurchase/shopping?id=' . $orderId;
|
|
|
+
|
|
|
+ wxUtil::sendTaskInform($data, $wx, $ptStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|