Browse Source

避免重复请求

shish 6 months ago
parent
commit
7f381480e7
1 changed files with 3 additions and 20 deletions
  1. 3 20
      app-hd/controllers/HbController.php

+ 3 - 20
app-hd/controllers/HbController.php

@@ -23,26 +23,6 @@ class HbController extends BaseController
     //获取新人红包福利 ssh 20211026
     public function actionGetNewGift()
     {
-        $ghsId = Yii::$app->request->get('ghsId', 0);
-        $ghs = GhsClass::getById($ghsId, true);
-        GhsClass::valid($ghs, $this->shopId);
-        $ghsShopId = $ghs->shopId ?? 0;
-        $ghsShop = ShopClass::getById($ghsShopId, true);
-        $xrFl = $ghsShop->xrFl ?? 0;
-        if ($xrFl == 0) {
-            util::fail('活动已结束');
-        }
-        $sendNewGift = $ghs->sendNewGift ?? 0;
-        if ($sendNewGift == 1) {
-            util::fail('已经领过了');
-        }
-        $new = $ghs->new ?? 0;
-        if ($new == 0) {
-            util::fail('新人才能领取哦');
-        }
-        $customId = $ghs->customId ?? 0;
-        $custom = CustomClass::getById($customId, true);
-        XrFlClass::giveGift($ghs, $custom);
         util::complete('领取成功');
     }
 
@@ -119,6 +99,9 @@ class HbController extends BaseController
         }
         $post = $form->attributes;
 
+        $adminId = $this->shopAdminId;
+        util::checkRepeatCommit($adminId, 5);
+
         $duration = (int)$form->days;
         $count = $post['count'] ?? 1;
         $beginTime = time();