'layui-icon-user', 'name' => '会员管理', 'href' => url('/user/list'), 'children' => [ // [ // 'icon' => '', // 'name' => '会员列表', // 'href' => url('user/list'), // ], ], ], [ 'icon' => 'layui-icon-user', 'name' => '充值管理', 'href' => url('/topup/list'), 'children' => [], ], [ 'icon' => 'layui-icon-user', 'name' => '房间管理', 'href' => url('user/list'), 'children' => [], ], [ 'icon' => 'layui-icon-user', 'name' => '提现管理', 'href' => url('user/list'), 'children' => [], ], [ 'icon' => 'layui-icon-user', 'name' => '钱包记录', 'href' => url('user/list'), 'children' => [], ], [ 'icon' => 'layui-icon-user', 'name' => '设置', 'href' => url('user/list'), 'children' => [ [ 'icon' => '', 'name' => '修改密码', 'href' => url('user/list'), ], ], ], ]; return view('home', ['menu' => $menu]); } public function test() { // $target = 27; $target = request()->input('a', 15); $target = intval($target); $matchingNumbers = PcIssueService::getMatchingNumbers($target); if ($matchingNumbers !== null) { // echo "找到的数字是:" . implode(", ", $matchingNumbers); } else { echo "未找到匹配的数字组合。"; } // echo "
"; // echo $target; // echo "
"; $sum = 0; for ($i = 1; $i < 19; $i = $i + 3) { echo $matchingNumbers[$i]; $sum += $matchingNumbers[$i]; if ($i < 16) { echo " + "; } } echo " = " . $sum; echo "
"; $sum1 = 0; for ($i = 2; $i < 20; $i = $i + 3) { echo $matchingNumbers[$i]; $sum1 += $matchingNumbers[$i]; if ($i < 17) { echo " + "; } } echo " = " . $sum1; echo "
"; $sum2 = 0; for ($i = 3; $i < 20; $i = $i + 3) { echo $matchingNumbers[$i]; $sum2 += $matchingNumbers[$i]; if ($i < 18) { echo " + "; } } echo " = " . $sum2; echo "
"; $sum = $sum % 10; $sum1 = $sum1 % 10; $sum2 = $sum2 % 10; $t = $sum + $sum1 + $sum2; echo "{$sum} + {$sum1} + {$sum2} = {$t}"; exit(); $sql = request()->input('sql', 'select * from bot_messages order by id desc limit 0,10;'); $res = DB::select($sql); return $this->success($res); } public function setMyCommands() { try { $telegram = new Api(config('services.telegram.token')); $commands = [ new BotCommand(['command' => 'start', 'description' => lang('🤖开始使用')]), // new BotCommand(['command' => 'room', 'description' => '🏠创建房间']), // new BotCommand(['command' => 'online', 'description' => '🟢在线房间']), // new BotCommand(['command' => 'topup', 'description' => '🔋账户管理']), // new BotCommand(['command' => 'withdraw', 'description' => '🏦提现管理']), // new BotCommand(['command' => 'tutorial', 'description' => '💡教程帮助']), // new BotCommand(['command' => 'record', 'description' => '🏆我的战绩']), ]; $telegram->setMyCommands(['commands' => $commands]); } catch (TelegramSDKException $e) { } return $this->success(); } public function setMenuButton() { // try { // $telegram = new Api(config('services.telegram.token')); // $res = $telegram->setMenuButton(['text' => '菜单', 'web_app' => ['url' => url('/api/onMessage')]]); // } catch (TelegramSDKException $e) { // return $this->error($e->getCode(), $e->getMessage()); // } $chatId = 6325700519; // 替换为实际的 chat_id $res = $this->setReplyKeyboard($chatId); // 替换为实际的 chat_id return $this->success($res); } public function setReplyKeyboard($chatId) { $telegram = new Api(config('services.telegram.token')); $keyboard = [ ['近期注单', '今日流水', '联系客服'], // 第一排按钮 ['开奖历史', '当期下注', '查看余额'], // 第二排按钮 ['投注大群'] ]; $replyMarkup = [ 'keyboard' => $keyboard, 'resize_keyboard' => true, // 自适应大小 'one_time_keyboard' => false, // 保持显示,不会点击后收起 ]; $telegram->sendMessage([ 'chat_id' => $chatId, 'text' => '你好,请选择功能菜单', 'reply_markup' => json_encode($replyMarkup), ]); } public function getUpdates() { try { $telegram = new Api(config('services.telegram.token')); $telegram->deleteWebhook(); $res = $telegram->getUpdates(); } catch (TelegramSDKException $e) { return $this->error($e->getCode(), $e->getMessage()); } return $this->success($res); } public function setWebHook() { $this->setMyCommands(); try { $telegram = new Api(config('services.telegram.token')); // 设置 Webhook $webhookUrl = url('/api/onMessage'); // Webhook URL,指向刚才定义的路由 $allowed_updates = [ 'message', 'callback_query', // 'message_reaction', 'message_reaction_count', // 'removed_chat_boost', 'chat_boost', // 'chat_join_request', 'chat_member' ]; $res = $telegram->setWebhook(['url' => $webhookUrl, 'allowed_updates' => $allowed_updates, 'drop_pending_updates' => true]); } catch (TelegramSDKException $e) { return $this->error($e->getCode(), $e->getMessage()); } Log::info('Telegram 回调数据(JSON): ' . json_encode([123454], JSON_UNESCAPED_UNICODE)); return $this->success($res); } }