diff --git a/app/api/controller/v1/Playx.php b/app/api/controller/v1/Playx.php index 53440de..779f7e8 100644 --- a/app/api/controller/v1/Playx.php +++ b/app/api/controller/v1/Playx.php @@ -466,8 +466,20 @@ class Playx extends Api $code = $res->getStatusCode(); $data = json_decode(strval($res->getBody()), true); if ($code !== 200 || empty($data['user_id'])) { - $remoteMsg = $data['message'] ?? ''; - $msg = is_string($remoteMsg) && $remoteMsg !== '' ? $remoteMsg : __('Token expiration'); + $remoteMsg = ''; + if (is_array($data)) { + $candidateMsg = $data['message'] ?? ($data['msg'] ?? ($data['error'] ?? '')); + if (is_string($candidateMsg) && $candidateMsg !== '') { + $remoteMsg = $candidateMsg; + } + } + if ($remoteMsg === '') { + $bodyText = strval($res->getBody()); + if ($bodyText !== '') { + $remoteMsg = mb_substr($bodyText, 0, 300); + } + } + $msg = $remoteMsg !== '' ? $remoteMsg : __('Token expiration'); return $this->error($msg, null, 0, ['statusCode' => 401]); }