seven hace 1 mes
padre
commit
9961bcb9c9

+ 6 - 0
app/Http/Controllers/api/TelegramWebHook.php

@@ -237,6 +237,12 @@ class TelegramWebHook extends Controller
                     $telegram->editMessageText($res);
                 }
 
+                // 今日汇率
+                if ($data === 'todayExchangeRate@@rate') {
+                    $res = BetService::todayExchangeRate($chatId);
+                    $telegram->sendMessage($res);
+                }
+
                 //选择投注记录
                 $pattern = "/^betRecordType@@\d+$/";
                 if (preg_match($pattern, $data)) {

+ 11 - 0
app/Services/BetService.php

@@ -661,5 +661,16 @@ class BetService extends BaseService
         return $text;
     }
 
+    public static function todayExchangeRate($chatId)
+    {
+        $exchangeRate = Config::where('field', 'exchange_rate_rmb')->first()->val;
+        $text = "今日汇率:1美元 = {$exchangeRate}人民币 \n";
+        $botMsg = [
+            'chat_id' => "@{$chatId}",
+            'text' => $text
+        ];
+        return $botMsg;
+    }
+
 
 }

+ 3 - 0
app/Services/WalletService.php

@@ -249,6 +249,9 @@ class WalletService extends BaseService
             [
                 ['text' => '➕ 提现', 'callback_data' => "withdraw@@apply"],
                 ['text' => '🧾 提现账单', 'callback_data' => "withdraw@@bill"]
+            ],
+            [
+                ['text' => '💵今日汇率💰', 'callback_data' => "todayExchangeRate@@rate"]
             ]
         ];