kyle 2 yıl önce
ebeveyn
işleme
f528c3771a

+ 4
- 6
app/Http/Controllers/Web/Api2021Controller.php Dosyayı Görüntüle

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