seven 2 天之前
父節點
當前提交
56883b2a30
共有 1 個文件被更改,包括 34 次插入30 次删除
  1. 34 30
      app/Services/BetService.php

+ 34 - 30
app/Services/BetService.php

@@ -314,49 +314,53 @@ class BetService extends BaseService
     public static function fakeBet()
     {
 
-        // 期数验证
-        $issueInfo = IssueService::model()::where('status', IssueService::model()::STATUS_BETTING)->orderBy('id', 'desc')->first();
-        if ($issueInfo) {
-            $fake_bet_list = Cache::get('fake_bet_' . $issueInfo->issue_no, []);
+        $betFake = Config::where('field', 'bet_fake')->first()->val;
+        if($betFake){
+            // 期数验证
+            $issueInfo = IssueService::model()::where('status', IssueService::model()::STATUS_BETTING)->orderBy('id', 'desc')->first();
+            if ($issueInfo) {
+                $fake_bet_list = Cache::get('fake_bet_' . $issueInfo->issue_no, []);
 
-            $gameplayRuleList = GameplayRuleService::model()::where('odds', '>', 0)->get();
-            $gameplayRuleList = $gameplayRuleList->toArray();
-            $randKey = array_rand($gameplayRuleList, 1);
-            $gameplayRuleInfo = $gameplayRuleList[$randKey] ?? [];
-            if ($gameplayRuleInfo) {
+                $gameplayRuleList = GameplayRuleService::model()::where('odds', '>', 0)->get();
+                $gameplayRuleList = $gameplayRuleList->toArray();
+                $randKey = array_rand($gameplayRuleList, 1);
+                $gameplayRuleInfo = $gameplayRuleList[$randKey] ?? [];
+                if ($gameplayRuleInfo) {
 
 
-                $item = [];
-                $item['keywords'] = $gameplayRuleInfo['keywords'];
-                $item['odds'] = $gameplayRuleInfo['odds'];
-                $item['amount'] = rand($gameplayRuleInfo['mininum'], $gameplayRuleInfo['maxinum']);
-                $item['first_name'] = self::generateRandomString(6);
-                $item['profit'] = 0;
-                $input = $item['keywords'] . $item['amount'];
+                    $item = [];
+                    $item['keywords'] = $gameplayRuleInfo['keywords'];
+                    $item['odds'] = $gameplayRuleInfo['odds'];
+                    $item['amount'] = rand($gameplayRuleInfo['mininum'], $gameplayRuleInfo['maxinum']);
+                    $item['first_name'] = self::generateRandomString(6);
+                    $item['profit'] = 0;
+                    $input = $item['keywords'] . $item['amount'];
 
-                $fake_bet_list[] = $item;
+                    $fake_bet_list[] = $item;
 
-                $lastStr = self::getLastChar($item['first_name'], 1);
+                    $lastStr = self::getLastChar($item['first_name'], 1);
 
-                $groupText = "";
-                $groupText .= "私聊下注 【xxxxxx" . $lastStr . "】 \n";
-                $groupText .= "下注期数:{$issueInfo->issue_no} \n";
-                $groupText .= "下注内容: \n";
-                $groupText .= "----------- \n";
-                $groupText .= "{$input} \n";
-                $groupText .= "----------- \n";
+                    $groupText = "";
+                    $groupText .= "私聊下注 【xxxxxx" . $lastStr . "】 \n";
+                    $groupText .= "下注期数:{$issueInfo->issue_no} \n";
+                    $groupText .= "下注内容: \n";
+                    $groupText .= "----------- \n";
+                    $groupText .= "{$input} \n";
+                    $groupText .= "----------- \n";
 
 
-                $inlineButton = self::getOperateButton();
+                    $inlineButton = self::getOperateButton();
 
-                // 群通知
-                self::bettingGroupNotice($groupText, $inlineButton);   // 群通知
-            }
+                    // 群通知
+                    self::bettingGroupNotice($groupText, $inlineButton);   // 群通知
+                }
 
-            Cache::put('fake_bet_' . $issueInfo->issue_no, $fake_bet_list, 500);
+                Cache::put('fake_bet_' . $issueInfo->issue_no, $fake_bet_list, 500);
 
 
+            }
         }
+        
     }
 
     /**