seven 3 天之前
父节点
当前提交
941aa8b245
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25 0
      app/Services/IssueService.php

+ 25 - 0
app/Services/IssueService.php

@@ -730,6 +730,31 @@ class IssueService extends BaseService
         return $result;
     }
 
+    // 封盘倒数
+    public static function syncCountdownIssue()
+    {
+        $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)){
+                    self::bettingGroupNotice($text, $buttons, $image);
+                    Cache::put('issue_countdown_'.$info->id, true, 50); // 缓存50秒,防止多次发送
+                }else{}
+                
+            }
+        }
+        
+    }
+
     // 停止下注
     public static function syncCloseIssue()
     {