seven 3 days ago
parent
commit
1ab8da323f
2 changed files with 19 additions and 16 deletions
  1. 1 1
      app/Http/Controllers/admin/Sync.php
  2. 18 15
      app/Services/IssueService.php

+ 1 - 1
app/Http/Controllers/admin/Sync.php

@@ -33,7 +33,7 @@ class Sync extends Controller
 
     public function five()
     {
-        // IssueService::syncCountdownIssue(); // 提前20秒提醒
+        IssueService::syncCountdownIssue(); // 提前20秒提醒
 
         IssueService::syncCloseIssue(); // 同步停止
         // Log::error('✅ 获取到最新期号: ' . ($latestIssue ?? '无'));

+ 18 - 15
app/Services/IssueService.php

@@ -735,26 +735,29 @@ class IssueService extends BaseService
     {
         $now_date = date('Y-m-d H:i:s',time() + 50); // 提前50秒
         $info = self::model()::where('status', self::model()::STATUS_BETTING)->orderBy('end_time','asc')->first();
-        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->id)){
+        if($info){
+            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->id)){
+                        
+                    }else{
+                        self::bettingGroupNotice($text, $buttons, $image);
+                        Cache::put('issue_countdown_'.$info->id, true, 60); // 缓存50秒,防止多次发送
+                    }
                     
-                }else{
-                    self::bettingGroupNotice($text, $buttons, $image);
-                    Cache::put('issue_countdown_'.$info->id, true, 60); // 缓存50秒,防止多次发送
                 }
-                
             }
         }
         
+        
     }
 
     // 停止下注