|
|
@@ -53,27 +53,35 @@ class NoticeController extends PublicController
|
|
|
//支付成功后续流程
|
|
|
payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
|
|
|
$transaction->commit();
|
|
|
- $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
|
|
|
- if (!empty($cg)) {
|
|
|
- //微信通知
|
|
|
- $saleId = $cg->saleId ?? 0;
|
|
|
- $order = OrderClass::getById($saleId, true);
|
|
|
- if (!empty($order)) {
|
|
|
- $shopId = $order->shopId ?? 0;
|
|
|
- $shop = ShopClass::getById($shopId, true);
|
|
|
- if (!empty($shop)) {
|
|
|
- WxMessageClass::ghsHasNewOrderInform($shop, $order);
|
|
|
- }
|
|
|
- //订单生成时唤起在线打印
|
|
|
- if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {
|
|
|
- OrderClass::onlinePrint($order);
|
|
|
- $order->printNum += 1;
|
|
|
- $order->save();
|
|
|
+
|
|
|
+ //解决重复通知
|
|
|
+ $cacheKey = 'hd_shop_cg_pay_' . $orderSn;
|
|
|
+ $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
+ if (empty($has)) {
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 300, 'has']);
|
|
|
+ $cg = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
|
|
|
+ if (!empty($cg)) {
|
|
|
+ //微信通知
|
|
|
+ $saleId = $cg->saleId ?? 0;
|
|
|
+ $order = OrderClass::getById($saleId, true);
|
|
|
+ if (!empty($order)) {
|
|
|
+ //订单生成时唤起在线打印
|
|
|
+ if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {
|
|
|
+ OrderClass::onlinePrint($order);
|
|
|
+ $order->printNum += 1;
|
|
|
+ $order->save();
|
|
|
+ }
|
|
|
+ $shopId = $order->shopId ?? 0;
|
|
|
+ $shop = ShopClass::getById($shopId, true);
|
|
|
+ if (!empty($shop)) {
|
|
|
+ WxMessageClass::ghsHasNewOrderInform($shop, $order);
|
|
|
+ }
|
|
|
+ //花店采购供货商端收到通知
|
|
|
+ NoticeClass::ghsNewOrderNotice($order);
|
|
|
}
|
|
|
- //花店采购供货商端收到通知
|
|
|
- NoticeClass::ghsNewOrderNotice($order);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
|
|
|
} catch (\Exception $e) {
|
|
|
$transaction->rollBack();
|