seven 17 hours ago
parent
commit
810cb3d228
2 changed files with 11 additions and 3 deletions
  1. 4 1
      app/Http/Controllers/admin/Bet.php
  2. 7 2
      app/Services/BetService.php

+ 4 - 1
app/Http/Controllers/admin/Bet.php

@@ -49,7 +49,10 @@ class Bet extends Controller
     // 模拟下注
     public function fake()
     {
-        BetService::fakeBet();
+        $num = rand(1,5);
+        for($i = 0;$i< $num;$i++){
+            BetService::fakeBet();
+        }
         return $this->success();
     }
 

+ 7 - 2
app/Services/BetService.php

@@ -359,6 +359,11 @@ class BetService extends BaseService
             // 期数验证
             $issueInfo = IssueService::model()::where('status', IssueService::model()::STATUS_BETTING)->orderBy('id', 'desc')->first();
             if ($issueInfo) {
+                $betFakeRandAmount = Config::where('field', 'bet_fake_rand_amount')->first()->val;
+                $betFakeRandAmount = explode(',', $betFakeRandAmount);
+                $betMini = $betFakeRandAmount[0]??10;
+                $betMax = $betFakeRandAmount[1]??10000;
+
                 $now_date = date('Y-m-d H:i:s',time() + 30); // 提前30秒
                 if($issueInfo['end_time'] > $now_date){
                     $fake_bet_list = Cache::get('fake_bet_' . $issueInfo->issue_no, []);
@@ -368,12 +373,12 @@ class BetService extends BaseService
                     $randKey = array_rand($gameplayRuleList, 1);
                     $gameplayRuleInfo = $gameplayRuleList[$randKey] ?? [];
                     if ($gameplayRuleInfo) {
-
+                        $amount = rand($betMini, $betMax);
 
                         $item = [];
                         $item['keywords'] = $gameplayRuleInfo['keywords'];
                         $item['odds'] = $gameplayRuleInfo['odds'];
-                        $item['amount'] = rand(10, 10000);
+                        $item['amount'] = $amount;
                         $item['first_name'] = self::generateRandomString(6);
                         $item['member_id'] = self::generateRandomNumber(10);
                         $item['profit'] = 0;