first commit

This commit is contained in:
2026-07-23 09:40:36 +08:00
commit 090abf48fa
989 changed files with 145728 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\exception;
use think\exception\Handle;
use think\exception\HttpException;
use think\exception\ValidateException;
use think\Response;
use Throwable;
class Http extends Handle
{
public function render($request, Throwable $e): Response
{
// 参数验证错误
if ($e instanceof ValidateException) {
//return json($e->getError(), 422);
to_assign(1, $e->getError(), [], '', 422);
}
// 请求异常
if ($e instanceof HttpException && $request->isAjax()) {
//return response($e->getMessage(), $e->getStatusCode());
to_assign(1, $e->getMessage(), [], '', $e->getStatusCode());
}
// 其他错误交给系统处理
return parent::render($request, $e);
}
}