mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-01 23:18:13 -05:00
fix: telegram bind
This commit is contained in:
parent
81ef1b8909
commit
9973db24d0
@ -17,8 +17,19 @@ class Bind extends Telegram {
|
|||||||
}
|
}
|
||||||
$subscribeUrl = $message->args[0];
|
$subscribeUrl = $message->args[0];
|
||||||
$subscribeUrl = parse_url($subscribeUrl);
|
$subscribeUrl = parse_url($subscribeUrl);
|
||||||
parse_str($subscribeUrl['query'], $query);
|
|
||||||
$token = $query['token'];
|
// 首先尝试从查询参数获取token
|
||||||
|
$token = null;
|
||||||
|
if (isset($subscribeUrl['query'])) {
|
||||||
|
parse_str($subscribeUrl['query'], $query);
|
||||||
|
$token = $query['token'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$token && isset($subscribeUrl['path'])) {
|
||||||
|
$pathParts = explode('/', trim($subscribeUrl['path'], '/'));
|
||||||
|
$token = end($pathParts);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$token) {
|
if (!$token) {
|
||||||
throw new ApiException('订阅地址无效');
|
throw new ApiException('订阅地址无效');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user