This commit is contained in:
2026-04-13 20:00:32 +08:00
parent 9393185f25
commit 24273db8dd
15 changed files with 992 additions and 237 deletions
+10 -9
View File
@@ -80,23 +80,24 @@ class Utils
* 发送API请求
* @param string $path API路径
* @param array $data 请求数据
* @param string $errMsg 错误信息
* @param string $token 认证令牌
* @return array 响应数据
*/
public static function send(string $path, array $data, string $errMsg='', string $token = ''): array|bool
public static function send(string $path, array $data): array|bool
{
if($path != Url::$getAdminToken){
$token = $token ? $token : Utils::getAdminToken();
$token = Utils::getAdminToken();
}
$url = Url::buildUrl($path);
//cp($url);
//cp($data);
$res = self::request($url, $data, $token);
//cp($res);
$res = json_decode($res, true);
if($res['errCode'] !==0 ){
cp('=============================调试信息=====================================');
cp($url);
cp(json_encode($data));
cp($res);
cp('=============================end=====================================');
throw new \Exception($res['errMsg'],$res['errCode']);
//throw new \Exception($res['errDlt'],$res['errCode']);
}
@@ -132,7 +133,7 @@ class Utils
$result = self::send(Url::$getAdminToken, [
'userID' => $userID,
'secret' => Config::getSecret()
], '获取管理员Token失败');
]);
$token = $result['token'];
// 使用API返回的过期时间
$expireTimeSeconds = $result['expireTimeSeconds'] ?? null;
@@ -167,7 +168,7 @@ class Utils
$result = self::send(Url::$getUserToken, [
'userID' => $userID,
'platformID' => self::getPlatformId($platformID)
], '获取用户Token失败', $adminToken);
]);
$token = $result['token'];