perf: 优化下载工具

This commit is contained in:
kuaifan
2025-08-15 01:02:40 +08:00
parent d4e754d601
commit eecc6c9e53
5 changed files with 58 additions and 7 deletions

View File

@@ -1404,7 +1404,12 @@ class Base
*/
public static function ajaxError($msg, $data = [], $ret = 0, $abortCode = 404)
{
abort_if(Request::header('Content-Type') !== 'application/json', $abortCode, Doo::translate($msg));
if (Request::header('Content-Type') !== 'application/json') {
$translateMsg = Doo::translate($msg);
abort($abortCode, $translateMsg, [
'X-Error-Message-Base64' => base64_encode($translateMsg),
]);
}
return Base::retError($msg, $data, $ret);
}