seven vor 12 Stunden
Ursprung
Commit
01cca08c52
2 geänderte Dateien mit 15 neuen und 4 gelöschten Zeilen
  1. 14 3
      app/Services/BaseService.php
  2. 1 1
      app/Services/IssueService.php

+ 14 - 3
app/Services/BaseService.php

@@ -134,7 +134,7 @@ class BaseService
      * @param {*string} $image  图片
      * @return {*}
      */    
-    public static function bettingGroupNotice($text ,$keyboard = [], $image = '')
+    public static function bettingGroupNotice($text ,$keyboard = [], $image = '' ,$isTop = false)
     {
         $bettingGroup = Config::where('field', 'betting_group')->first()->val;
 
@@ -149,10 +149,21 @@ class BaseService
             $botMsg['photo'] = InputFile::create($image);
             $botMsg['caption'] = $text;
             $botMsg['protect_content'] = true;  // 防止转发
-            self::telegram()->sendPhoto($botMsg);
+            $response = self::telegram()->sendPhoto($botMsg);
         }else{
-            self::telegram()->sendMessage($botMsg);
+            $response = self::telegram()->sendMessage($botMsg);
         }
+
+        if($isTop == true){
+            // 获取消息ID
+            $messageId = $response->get('message_id');
+            // 置顶消息
+            self::telegram()->pinChatMessage([
+                'chat_id' => "@{$bettingGroup}",
+                'message_id' => $messageId
+            ]);
+        }
+        
     }
 
     /**

+ 1 - 1
app/Services/IssueService.php

@@ -266,7 +266,7 @@ class IssueService extends BaseService
                     $buttons[] = [['text' => '✅ 唯一客服', 'callback_data' => "", 'url' => "https://t.me/{$serviceAccount}"]];
 
                 }
-                self::bettingGroupNotice($text, $buttons, $image);
+                self::bettingGroupNotice($text, $buttons, $image ,true);
             }
             $recordImage = self::lotteryImage($info->issue_no);
             if($recordImage){