Ken 2 днів тому
батько
коміт
6511be3db2
1 змінених файлів з 10 додано та 5 видалено
  1. 10 5
      app/Services/IssueService.php

+ 10 - 5
app/Services/IssueService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 
 use App\Models\Cao;
 use App\Models\CaoHistory;
+use App\Models\PcIssue;
 use App\Models\Prediction;
 use App\Services\BaseService;
 use App\Models\Issue;
@@ -969,9 +970,14 @@ class IssueService extends BaseService
     // 封盘倒数
     public static function syncCountdownIssue()
     {
-        $now_date = date('Y-m-d H:i:s', time() + 60); // 提前60秒
-        $info = self::model()::where('status', self::model()::STATUS_BETTING)->orderBy('end_time', 'asc')->first();
+        $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();
+        }
         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) {
@@ -982,12 +988,11 @@ class IssueService extends BaseService
                     if ($image) {
                         $image = url($image);
                     }
-                    if (Cache::has('issue_countdown_' . $info->id)) {
+                    if (Cache::has('issue_countdown_' . $info->issue_no)) {
 
                     } else {
-                        // self::bettingGroupNotice($text, $buttons, $image);
                         self::asyncBettingGroupNotice($text, $buttons, $image);
-                        Cache::put('issue_countdown_' . $info->id, true, 60); // 缓存50秒,防止多次发送
+                        Cache::put('issue_countdown_' . $info->issue_no, true, 60); // 缓存50秒,防止多次发送
                     }
 
                 }