<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Exception; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Route; use Illuminate\Support\Str; use Illuminate\View\View; use ModStart\Core\Input\Response; use ModStart\Core\Monitor\StatisticMonitor; use ModStart\Core\Util\CurlUtil; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; trait ExceptionReportHandleTrait { private function errorReportCheck($PADSN) { try { goto Q4vmc; LUEFW: if ($S0EVh && $this->isExceptionIgnore($PADSN)) { $S0EVh = false; } goto Qyrf1; CndpT: $S0EVh = true; goto jiBxz; jiBxz: if ($S0EVh && $PADSN instanceof BizException) { $S0EVh = false; } goto HMaqA; wukr_: $MWGrW['file'] = $PADSN->getFile() . ':' . $PADSN->getLine(); goto O8BWd; NnvgK: CurlUtil::get($S8LHp, array('data' => json_encode($MWGrW))); goto zaefs; HMaqA: if ($S0EVh && $PADSN instanceof NotFoundHttpException) { $S0EVh = false; } goto S0QTH; Qyrf1: if (!$S0EVh) { return; } goto OTgTC; HWjNh: if ($S0EVh && $PADSN instanceof HttpException) { switch ($PADSN->getStatusCode()) { case 200: $S0EVh = false; break; } } goto LUEFW; O25qd: foreach ($MWGrW as &$JiRHR) { $JiRHR = str_replace(base_path(), '', $JiRHR); } goto NnvgK; Ra30r: $MWGrW['url'] = Request::url(); goto wukr_; mVpTe: if (empty($S8LHp)) { return; } goto CndpT; Q4vmc: $S8LHp = config('env.ERROR_REPORT_URL', null); goto mVpTe; O8BWd: $MWGrW['message'] = $PADSN->getMessage(); goto O25qd; OTgTC: $MWGrW = array(); goto Ra30r; S0QTH: if ($S0EVh && $PADSN instanceof MethodNotAllowedHttpException) { $S0EVh = false; } goto HWjNh; zaefs: } catch (\Exception $GrUf4) { } } private function isExceptionIgnore($PADSN) { if ($PADSN instanceof \UnexpectedValueException) { if (Str::contains($PADSN->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($PADSN) { goto I7UEq; QKllE: return null; goto rDgS8; I7UEq: if ($PADSN instanceof BizException) { goto v_33u; SEh2x: $gbVzz = Response::sendError($PADSN->getMessage()); goto CtkrB; y98NA: if ($gbVzz instanceof View) { return response()->make($gbVzz); } goto HlwnF; v_33u: $aCo7U = $PADSN->param; goto SEh2x; HlwnF: return $gbVzz; goto W_vL2; CtkrB: if (!\ModStart\Core\Input\Request::isAjax()) { if (!empty($aCo7U['view'])) { $gbVzz = view($aCo7U['view'], array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $PADSN->getMessage())); } } goto y98NA; W_vL2: } else { if ($PADSN instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($PADSN instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($PADSN instanceof ModelNotFoundException) { return null; } else { if ($PADSN instanceof HttpException) { switch ($PADSN->getStatusCode()) { case 200: goto nGgq4; OL0kW: return $gbVzz; goto fMdwk; nGgq4: if (\ModStart\Core\Input\Request::isJsonp()) { $gbVzz = Response::generateError($PADSN->getMessage()); return Response::jsonp($gbVzz); } goto IyRJL; ElMMi: if ($gbVzz instanceof View) { return response()->make($gbVzz); } goto OL0kW; IyRJL: $gbVzz = Response::sendError($PADSN->getMessage()); goto ElMMi; fMdwk: } } else { if ($PADSN instanceof \UnexpectedValueException) { if (Str::contains($PADSN->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto Fo2in; Fo2in: try { if (StatisticMonitor::isEnable()) { goto gwGar; hOaw4: $ft_KC = \ModStart\Core\Input\Request::domain(); goto OX7jJ; gwGar: $RDnT0 = \ModStart\Core\Input\Request::instance(); goto YNZUK; i2DiG: $XVqXz = $RDnT0->url(); goto npmdO; brOhZ: $UvPUF = Route::currentRouteAction(); goto hOaw4; YNZUK: $Zco5P = round((microtime(true) - LARAVEL_START) * 1000, 2); goto i2DiG; OX7jJ: StatisticMonitor::tick($ft_KC, "{$eNE35}." . $UvPUF, $Zco5P, false, 500); goto VaXxF; npmdO: $eNE35 = $RDnT0->method(); goto brOhZ; VaXxF: } } catch (\Exception $GrUf4) { } goto QKllE; rDgS8: } }