Ken 3 dagen geleden
bovenliggende
commit
308c432f73
3 gewijzigde bestanden met toevoegingen van 42 en 13 verwijderingen
  1. 1 1
      app/Jobs/FiveSecondTaskJob.php
  2. 7 10
      app/Services/IssueService.php
  3. 34 2
      app/Services/PcIssueService.php

+ 1 - 1
app/Jobs/FiveSecondTaskJob.php

@@ -54,7 +54,7 @@ class FiveSecondTaskJob implements ShouldQueue
             // 提前20秒提醒
             IssueService::syncCountdownIssue();
 
-            // 同步停止
+            // 停止下注  //封盘
             IssueService::syncCloseIssue();
 
             // 获取最新的期号

+ 7 - 10
app/Services/IssueService.php

@@ -964,12 +964,7 @@ class IssueService extends BaseService
     // 封盘倒数
     public static function syncCountdownIssue()
     {
-        $pc28Switch = Config::where('field', 'pc28_switch')->first()->val;
-        if ($pc28Switch == 1) {
-            $info = PcIssue::where('status', PcIssue::STATUS_BETTING)->orderBy('end_time')->first();
-        } else {
-            $info = self::model()::where('status', self::model()::STATUS_BETTING)->orderBy('end_time', 'asc')->first();
-        }
+        $info = self::model()::where('status', self::model()::STATUS_BETTING)->orderBy('end_time', 'asc')->first();
         if ($info) {
             $now_date = date('Y-m-d H:i:s', time() + 60); // 提前60秒
             if ($info['end_time'] < $now_date) {
@@ -984,15 +979,17 @@ class IssueService extends BaseService
                     if (Cache::has('issue_countdown_' . $info->issue_no)) {
 
                     } else {
-                        self::asyncBettingGroupNotice($text, $buttons, $image);
-                        Cache::put('issue_countdown_' . $info->issue_no, true, 60); // 缓存50秒,防止多次发送
+                        $pc28Switch = Config::where('field', 'pc28_switch')->first()->val;
+                        if ($pc28Switch == 0){
+                            self::asyncBettingGroupNotice($text, $buttons, $image);
+                            Cache::put('issue_countdown_' . $info->issue_no, true, 60); // 缓存50秒,防止多次发送
+                        }
+
                     }
 
                 }
             }
         }
-
-
     }
 
     // 停止下注

+ 34 - 2
app/Services/PcIssueService.php

@@ -19,6 +19,8 @@ class PcIssueService extends BaseService
 
     public static function index(): void
     {
+        //封盘倒数
+        PcIssueService::syncCountdownIssue();
         //创建新的期号
         PcIssueService::createIssueNo();
         //对该封盘的进行封盘
@@ -29,6 +31,36 @@ class PcIssueService extends BaseService
 
     }
 
+    //封盘倒数
+    public static function syncCountdownIssue()
+    {
+        $info = PcIssue::where('status', PcIssue::STATUS_BETTING)->orderBy('end_time')->first();
+        if ($info) {
+            $now_date = date('Y-m-d H:i:s', time() + 60); // 提前60秒
+            if ($info['end_time'] < $now_date) {
+                $replyInfo = KeyboardService::findOne(['button' => '封盘倒数']);
+                if ($replyInfo) {
+                    $text = $replyInfo->reply;
+                    $buttons = json_decode($replyInfo->buttons, true);
+                    $image = $replyInfo->image;
+                    if ($image) {
+                        $image = url($image);
+                    }
+                    if (Cache::has('issue_countdown_' . $info->issue_no)) {
+
+                    } else {
+                        $pc28Switch = Config::where('field', 'pc28_switch')->first()->val;
+                        if ($pc28Switch == 1) {
+                            self::asyncBettingGroupNotice($text, $buttons, $image);
+                            Cache::put('issue_countdown_' . $info->issue_no, true, 60); // 缓存50秒,防止多次发送
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
     private static function fengPan()
     {
         $list = PcIssue::where('status', PcIssue::STATUS_BETTING)
@@ -256,7 +288,7 @@ class PcIssueService extends BaseService
             $new_str = "P" . $number;
             $end_time = strtotime($issue->end_time) + 210;
             $status = $end_time - 30 > $now ? PcIssue::STATUS_BETTING : PcIssue::STATUS_CLOSE;
-            $issue = PcIssue::create([
+            $issue1 = PcIssue::create([
                 'issue_no' => $new_str,
                 'status' => $status,
                 'start_time' => $issue->end_time,
@@ -264,7 +296,7 @@ class PcIssueService extends BaseService
             ]);
             //预测
             PcPrediction::prediction($new_str);
-            if (strtotime($issue->end_time) <= $now) {
+            if (strtotime($issue1->end_time) <= $now) {
                 static::createIssueNo();
             } else {
                 // 群通知,发送玩法规则和开始下注的通知