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

@@ -1661,13 +1661,13 @@ class ProjectController extends AbstractController
{
$userid = Session::get('task::export:userid');
if (empty($userid)) {
return Base::ajaxError("请求已过期,请重新导出!", [], 0, 502);
return Base::ajaxError("请求已过期,请重新导出!", [], 0, 403);
}
//
$array = Base::string2array(base64_decode(urldecode(Request::input('key'))));
$file = $array['file'];
if (empty($file) || !file_exists(storage_path($file))) {
return Base::ajaxError("文件不存在!", [], 0, 502);
return Base::ajaxError("文件不存在!", [], 0, 403);
}
return Response::download(storage_path($file));
}
@@ -1926,9 +1926,7 @@ class ProjectController extends AbstractController
$down = Request::input('down', 'yes');
//
$file = ProjectTaskFile::find($file_id);
if (empty($file)) {
abort(403, "This file not exist.");
}
abort_if(empty($file), 403, "This file not exist.");
//
try {
ProjectTask::userTask($file->task_id, null);