seven 1 月之前
父节点
当前提交
bda2d20189
共有 2 个文件被更改,包括 31 次插入0 次删除
  1. 25 0
      app/Services/BaseService.php
  2. 6 0
      app/Services/IssueService.php

+ 25 - 0
app/Services/BaseService.php

@@ -4,6 +4,8 @@ namespace App\Services;
 use SimpleSoftwareIO\QrCode\Facades\QrCode;
 use Endroid\QrCode\Builder\Builder;
 use Endroid\QrCode\Writer\PngWriter;
+use Telegram\Bot\Api;
+use App\Models\Config;
 
 class BaseService 
 {
@@ -113,4 +115,27 @@ class BaseService
         }
         return $arr;
     }
+
+    /**
+     * @description: 实例化TG
+     * @return {*}
+     */    
+    public static function telegram()
+    {
+        return app(Api::class);
+    }
+
+    /**
+     * @description: 群组通知
+     * @param {*} $key
+     * @return {*}
+     */    
+    public static function bettingGroupNotice($text)
+    {
+        $bettingGroup = Config::where('field', 'betting_group')->first()->val;
+        self::telegram()->sendMessage([
+            'chat_id' => $bettingGroup,
+            'text' => $text
+        ]);
+    }
 }

+ 6 - 0
app/Services/IssueService.php

@@ -145,6 +145,12 @@ class IssueService extends BaseService
 
         $info->status = self::model()::STATUS_BETTING;
         $info->save();
+
+        $text = "";
+        $text .= "第".$info->issue_no."期\n";
+        $text .= "🔥🔥🔥🔥🔥开始下注🔥🔥🔥🔥🔥\n";
+        self::bettingGroupNotice($text);
+        
         return ['code'=>self::YES, 'msg'=>'开始下注'];
     }