From b0a504a44ca72ed07c94807344c928b4a0309f20 Mon Sep 17 00:00:00 2001 From: xboard Date: Thu, 7 Dec 2023 23:12:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20telegram=E6=9C=BA=E5=99=A8=E4=BA=BAsetwe?= =?UTF-8?q?bhook=E6=8E=A5=E5=8F=A3url=E8=AE=BE=E7=BD=AE=E4=B8=BA=E7=AB=99?= =?UTF-8?q?=E7=82=B9=E7=BD=91=E5=9D=80=EF=BC=8C=E9=98=B2=E6=AD=A2=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=BB=91=E5=AE=9A=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/V1/Admin/ConfigController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/V1/Admin/ConfigController.php b/app/Http/Controllers/V1/Admin/ConfigController.php index a85109a..b84d5fb 100755 --- a/app/Http/Controllers/V1/Admin/ConfigController.php +++ b/app/Http/Controllers/V1/Admin/ConfigController.php @@ -51,7 +51,12 @@ class ConfigController extends Controller public function setTelegramWebhook(Request $request) { - $hookUrl = url('/api/v1/guest/telegram/webhook?access_token=' . md5(admin_setting('telegram_bot_token', $request->input('telegram_bot_token')))); + // 判断站点网址 + $app_url = admin_setting('app_url'); + if(blank($app_url)) return $this->fail([422, '请先设置站点网址']); + $hookUrl = $app_url .'/api/v1/guest/telegram/webhook?' . http_build_query([ + 'access_token' => md5(admin_setting('telegram_bot_token', $request->input('telegram_bot_token'))) + ]); $telegramService = new TelegramService($request->input('telegram_bot_token')); $telegramService->getMe(); $telegramService->setWebhook($hookUrl);