fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -5,23 +5,33 @@ namespace app\common\exception;
use app\common\model\system\SystemLog;
use Psr\SimpleCache\InvalidArgumentException;
use support\exception\BusinessException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Exception\ExceptionHandler;
use Webman\Http\Request;
use Webman\Http\Response;
use Throwable;
class ExceptionHandle extends \Webman\Exception\ExceptionHandler
class ExceptionHandle extends ExceptionHandler
{
public $dontReport = [
BusinessException::class,
];
/**
*
* @param Throwable $exception
* @return void|mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function report(Throwable $exception)
{
try {
if (saenv('system_exception') && !empty($exception->getMessage())) {
if (saenv('system_exception')
&& !empty($exception->getMessage())) {
$data = [
'module' => request()->app,
'controller' => request()->controller,
@@ -32,11 +42,9 @@ class ExceptionHandle extends \Webman\Exception\ExceptionHandler
'ip' => request()->getRealIp(),
'name' => session('AdminLogin.name'),
];
if (empty($data['name'])) {
$data['name'] = 'system';
}
$data['type'] = 1;
$data['code'] = $exception->getCode();
$data['file'] = $exception->getFile();
@@ -50,6 +58,11 @@ class ExceptionHandle extends \Webman\Exception\ExceptionHandler
parent::report($exception);
}
/**
* @param Throwable $exception
* @param Request $request
* @return Response
*/
public function render(Request $request, Throwable $exception): Response
{
if (!file_exists(root_path(). '.env')) {