seven 4 ngày trước cách đây
mục cha
commit
5e2a5f670b
2 tập tin đã thay đổi với 23 bổ sung7 xóa
  1. 11 2
      app/Services/BaseService.php
  2. 12 5
      app/Services/IssueService.php

+ 11 - 2
app/Services/BaseService.php

@@ -6,6 +6,7 @@ use Endroid\QrCode\Builder\Builder;
 use Endroid\QrCode\Writer\PngWriter;
 use Telegram\Bot\Api;
 use App\Models\Config;
+use Telegram\Bot\FileUpload\InputFile;
 
 class BaseService 
 {
@@ -127,10 +128,12 @@ class BaseService
 
     /**
      * @description: 群组通知
-     * @param {*} $key
+     * @param {string} $text 通知内容
+     * @param {array} $keyboard 操作按钮
+     * @param {*string} $image  图片
      * @return {*}
      */    
-    public static function bettingGroupNotice($text ,$keyboard = [])
+    public static function bettingGroupNotice($text ,$keyboard = [], $image = '')
     {
         $bettingGroup = Config::where('field', 'betting_group')->first()->val;
 
@@ -141,6 +144,12 @@ class BaseService
         if(count($keyboard)>0){
             $botMsg['reply_markup'] = json_encode(['inline_keyboard' => $keyboard]);
         }
+        if(!empty($image)){
+            $botMsg['photo'] = InputFile::create($image);
+            // $botMsg['caption'] = $text;
+            unset($botMsg['text']);
+
+        }
         self::telegram()->sendMessage($botMsg);
     }
 

+ 12 - 5
app/Services/IssueService.php

@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Log;
 
 use App\Services\GameplayRuleService;
 use App\Constants\GameplayRuleEnum;
-use App\Http\Controllers\admin\Game;
+use App\Services\KeyboardService;
 
 /**
  * 投注
@@ -146,10 +146,17 @@ class IssueService extends BaseService
         $info->status = self::model()::STATUS_BETTING;
         $info->save();
 
-        $text = "";
-        $text .= "第".$info->issue_no."期\n";
-        $text .= "🔥🔥🔥🔥🔥开始下注🔥🔥🔥🔥🔥\n";
-        self::bettingGroupNotice($text);
+        // $text = "";
+        // $text .= "第".$info->issue_no."期\n";
+        // $text .= "🔥🔥🔥🔥🔥开始下注🔥🔥🔥🔥🔥\n";
+        $replyInfo = KeyboardService::findOne(['button' => '开始下注']);
+        if($replyInfo){
+            $text = $replyInfo->reply;
+            $buttons = json_decode($replyInfo->reply,true);
+            $image = $replyInfo->image;
+            self::bettingGroupNotice($text, $buttons, $image);
+        }
+        
         
         return ['code'=>self::YES, 'msg'=>'开始下注'];
     }