perf: 优化错误提示

This commit is contained in:
kuaifan
2025-07-30 20:33:27 +08:00
parent a1a51914a2
commit 1b242dc04e
8 changed files with 20 additions and 40 deletions

View File

@@ -1404,11 +1404,8 @@ class Base
*/
public static function ajaxError($msg, $data = [], $ret = 0, $abortCode = 404)
{
if (Request::header('Content-Type') === 'application/json') {
return Base::retError($msg, $data, $ret);
} else {
abort($abortCode, $msg);
}
abort_if(Request::header('Content-Type') !== 'application/json', $abortCode, Doo::translate($msg));
return Base::retError($msg, $data, $ret);
}
/**