kyle 2 years ago
parent
commit
f528c3771a
1 changed files with 4 additions and 6 deletions
  1. 4
    6
      app/Http/Controllers/Web/Api2021Controller.php

+ 4
- 6
app/Http/Controllers/Web/Api2021Controller.php View File

@@ -925,8 +925,6 @@ class Api2021Controller extends Controller
925 925
             $redis::incr($rlimitkey);
926 926
         }
927 927
 
928
-        \Log::debug($rlimitkey);
929
-
930 928
         if ($redis::get($rlimitkey) > $this->settingManagementSv->getSetting()['TMZ_ESI_TEST_EVENT_LIMIT']) {
931 929
             $this->sisLog['memoIn'] = json_encode(['error' => 'logical'], JSON_UNESCAPED_UNICODE);
932 930
             $this->sisLog['memoOut'] = json_encode(['msg' => '測試點數不能再打了'], JSON_UNESCAPED_UNICODE);
@@ -936,9 +934,7 @@ class Api2021Controller extends Controller
936 934
         // 業務驗證(防重)
937 935
         // 作用範圍: 以人為單位
938 936
         $rkey = $this->settingManagementSv->getSetting()['TMZ_ESI_TEST_EVENT_LIMIT'] . '_' . $lineId;
939
-        \Log::debug($rkey);
940 937
         if (!$redis::setnx($rkey, 'true')) {
941
-            \Log::debug('您操作過快,請稍後再試');
942 938
             $redis::expire($rkey, 15); // 15 秒防重(這樣就算業務在其他地方掛了,他也會自動失效)
943 939
             $this->sisLog['memoIn'] = json_encode(['error' => 'logical'], JSON_UNESCAPED_UNICODE);
944 940
             $this->sisLog['memoOut'] = json_encode(['msg' => '您操作過快,請稍後再試'], JSON_UNESCAPED_UNICODE);
@@ -946,10 +942,9 @@ class Api2021Controller extends Controller
946 942
             return response()->json(["succ" => false, "err" => '您操作過快,請稍後再試']);
947 943
         }
948 944
 
949
-        \Log::debug('ok');
950
-
951 945
         // 業務驗證(是否加入LINE帳號的好友)
952 946
         if (!$this->aSv->lineFriendCheck($lineId, 'tmz')) {
947
+            $redis::expire($rkey, 15);
953 948
             $this->sisLog['memoIn'] = json_encode(['error' => 'logical'], JSON_UNESCAPED_UNICODE);
954 949
             $this->sisLog['memoOut'] = json_encode(['msg' => '請先加入 LINE 好友'], JSON_UNESCAPED_UNICODE);
955 950
             
@@ -957,6 +952,7 @@ class Api2021Controller extends Controller
957 952
         }
958 953
         // 業務驗證(是否在本地有資料)
959 954
         if (!$this->aSv->isTPlayer($lineId)) {
955
+            $redis::expire($rkey, 15);
960 956
             $this->sisLog['memoIn'] = json_encode(['error' => 'logical'], JSON_UNESCAPED_UNICODE);
961 957
             $this->sisLog['memoOut'] = json_encode(['msg' => '請從首頁進入'], JSON_UNESCAPED_UNICODE);
962 958
             
@@ -986,6 +982,7 @@ class Api2021Controller extends Controller
986 982
         }
987 983
         // 業務邏輯(可否轉蛋再次確認)
988 984
         if (!$this->aSv->tredeeminfo($lineId)) {
985
+            $redis::expire($rkey, 15);
989 986
             $this->sisLog['memoIn'] = json_encode(['error' => 'logical'], JSON_UNESCAPED_UNICODE);
990 987
             $this->sisLog['memoOut'] = json_encode(['msg' => '吉點不夠不能轉蛋'], JSON_UNESCAPED_UNICODE);
991 988
             
@@ -994,6 +991,7 @@ class Api2021Controller extends Controller
994 991
         // 業務邏輯(轉蛋兌點)
995 992
         $redeeminfo = $this->aSv->redeemTGood($lineId, $name);
996 993
         if (!$redeeminfo) {
994
+            $redis::expire($rkey, 15);
997 995
             $this->sisLog['memoIn'] = json_encode(['error' => 'logical'], JSON_UNESCAPED_UNICODE);
998 996
             $this->sisLog['memoOut'] = json_encode(['msg' => '銘謝惠顧'], JSON_UNESCAPED_UNICODE);
999 997