seven hai 3 días
pai
achega
8fa2d2cf1e
Modificáronse 1 ficheiros con 16 adicións e 10 borrados
  1. 16 10
      app/Http/Controllers/api/TelegramWebHook.php

+ 16 - 10
app/Http/Controllers/api/TelegramWebHook.php

@@ -76,7 +76,10 @@ class TelegramWebHook extends Controller
                     $m->json = json_encode($update);
                     $m->save();
 
-                    $this->processChatMessage($chatId, $messageId, $message, $message['from']);
+                    $returnMsg = $this->processChatMessage($chatId, $messageId, $message, $message['from']);
+                    if($returnMsg){
+                        $this->telegram->sendMessage($returnMsg);
+                    }
 
                 } 
                  catch (MessageException $e) {
@@ -125,6 +128,7 @@ class TelegramWebHook extends Controller
      */    
     public function processChatMessage($chatId, $messageId, $message, $from)
     {
+        $returnMsg = [];
         //用户发送图片,结算截图
         if (isset($message['photo'])) {
             $stepStatus = Cache::get(get_step_key($chatId), -1);
@@ -172,8 +176,8 @@ class TelegramWebHook extends Controller
                         break;
                     case "今日流水":
                         Util::delCache($chatId);
-                        $result = BalanceLogService::getTodayFlowing($chatId);
-                        $this->telegram->sendMessage($result);
+                        $resultMsg = BalanceLogService::getTodayFlowing($chatId);
+                        // $this->telegram->sendMessage($result);
                         break;
                     case "联系客服":
                         Util::delCache($chatId);
@@ -191,11 +195,11 @@ class TelegramWebHook extends Controller
                         $text .= "‼️本群不接待以任何形式刷水的水军,一经发现玩家存在刷水行为将扣除历史所有返水、彩金。并冻结分数一个月,每天仅可下分账户余额10%。不纠结,不解释,请各大水军自行绕道。\n";
                         $keyboard = [];
                         $keyboard[] = [['text' => '✅ 唯一客服', 'callback_data' => "", 'url' => "https://t.me/{$serviceAccount}"]];
-                        $this->telegram->sendMessage([
+                        $resultMsg = [
                             'chat_id' => $chatId,
                             'text' => $text,
                             'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
-                        ]);
+                        ];
                         break;
                     case "开奖历史":
                         Util::delCache($chatId);
@@ -213,9 +217,9 @@ class TelegramWebHook extends Controller
                         break;
                     case "查看余额":
                         Util::delCache($chatId);
-                        $result = WalletService::getBalance($chatId);
+                        $resultMsg = WalletService::getBalance($chatId);
 
-                        $this->telegram->sendMessage($result);
+                        // $this->telegram->sendMessage($result);
                         break;
                     case "投注大群":
                         Util::delCache($chatId);
@@ -225,17 +229,19 @@ class TelegramWebHook extends Controller
                         $text = "👇👇👇点击下方按钮进群投注👇👇👇\n";
                         $keyboard = [];
                         $keyboard[] = [['text' => '✅ 投注群', 'callback_data' => "", 'url' => "https://t.me/{$bettingGroup}"]];
-                        $this->telegram->sendMessage([
+                        $resultMsg = [
                             'chat_id' => $chatId,
                             'text' => $text,
                             'reply_markup' => json_encode(['inline_keyboard' => $keyboard])
-                        ]);
+                        ];
                         break;
                     default:
 
                         $returnMsg = BetService::bet($chatId,$text,$messageId);
-                        $this->telegram->sendMessage($returnMsg);
+                        // $this->telegram->sendMessage($returnMsg);
                 }
+
+                return $returnMsg;
             }
         }
     }