seven 4 mesiacov pred
rodič
commit
4ecd84ef84

+ 6 - 0
app/Http/Controllers/admin/Issue.php

@@ -11,6 +11,12 @@ use Exception;
 
 class Issue extends Controller
 {
+    public function fakeLotteryDraw()
+    {
+        IssueService::fakeLotteryDraw();
+        return $this->success();
+    }
+
     /**
      * @description: 分页数据
      * @return {*}

+ 44 - 0
app/Services/IssueService.php

@@ -287,6 +287,50 @@ class IssueService extends BaseService
     }
 
 
+    // 虚拟开奖
+    public static function fakeLotteryDraw()
+    {
+         // 期数验证
+        $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,[]);
+            $winning_numbers = '5,6,2';
+            // 计算中奖
+            $awards = self::award(explode(',',$winning_numbers));
+            $text = "虚拟开奖\n";
+
+            foreach($fake_bet_list as $k => $v){
+                $lastStr = self::getLastChar($v['rst_name'],1);
+
+                if(in_array($v['keywords'],$awards)){
+                    $profit = $v['amount'] * $v['odds'];
+                    if($profit > 880000){
+                        $profit = 880000; // 单注最高奖金880000
+                    }
+                    $item['profit'] = $profit;
+
+                    $yl = $profit - $v['amount'];
+                    if($k+1 <= 30){
+
+                        $text .= "私聊下注 【******".$lastStr."】 {$yl}\n";
+                       
+                    }
+                  
+                }else{
+                    if($k+1 <= 30){
+                        $text .= "私聊下注 【******".$lastStr."】 -{$v['amount']}\n";
+                    }
+                }
+                
+            }
+
+            $inlineButton = self::getOperateButton();
+             // 群通知
+            self::bettingGroupNotice($text, $inlineButton, '');
+        }
+    }
+
+
     /**
      * @description: 获取中奖的奖项
      * @param {*} $winning_numbers

+ 1 - 0
routes/admin.php

@@ -34,6 +34,7 @@ Route::prefix('/sync')->group(function () {
 });
 
 Route::get('/fake', [Bet::class, 'fake']);
+Route::get('/fakel', [Issue::class, 'fakeLotteryDraw']);