shish 2 лет назад
Родитель
Сommit
9cf9f2102b
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      app-hd/controllers/PurchaseController.php

+ 9 - 1
app-hd/controllers/PurchaseController.php

@@ -470,6 +470,14 @@ class PurchaseController extends BaseController
         $info = PurchaseClass::getByCondition(['orderSn' => $orderSn], true);
         PurchaseService::valid($info, $this->shopId);
 
+        //解决重复和并发提交
+        $cacheKey = 'hd_debt_pay_' . $orderSn;
+        $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+        if (!empty($has)) {
+            util::fail('请稍等片刻再操作');
+        }
+        Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 5, 'has']);
+
         if ($info->status == 5) {
             util::fail('订单已取消');
         }
@@ -519,7 +527,7 @@ class PurchaseController extends BaseController
                 if (isset($cg->book) && $cg->book == 0) {
                     $ghsShopId = $ghs['shopId'] ?? 0;
                     if (getenv('YII_ENV') == 'production') {
-                        $specialList = [10649, 8042,16454];
+                        $specialList = [10649, 8042, 16454];
                     } else {
                         $specialList = [];
                     }