<?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($UyXoL) { try { goto cL51a; cL51a: $fBhiU = config('env.ERROR_REPORT_URL', null); goto or51F; zRCWC: if ($slwsW && $UyXoL instanceof HttpException) { switch ($UyXoL->getStatusCode()) { case 200: $slwsW = false; break; } } goto fSCun; t5vBI: if ($slwsW && $UyXoL instanceof NotFoundHttpException) { $slwsW = false; } goto SdK2b; e2twZ: $q0HKi['message'] = $UyXoL->getMessage(); goto upqip; USXW2: $q0HKi = array(); goto AyhIO; xVUTd: if (!$slwsW) { return; } goto USXW2; SdK2b: if ($slwsW && $UyXoL instanceof MethodNotAllowedHttpException) { $slwsW = false; } goto zRCWC; uSZhx: $q0HKi['file'] = $UyXoL->getFile() . ':' . $UyXoL->getLine(); goto e2twZ; kaloR: if ($slwsW && $UyXoL instanceof BizException) { $slwsW = false; } goto t5vBI; fSCun: if ($slwsW && $this->isExceptionIgnore($UyXoL)) { $slwsW = false; } goto xVUTd; AyhIO: $q0HKi['url'] = Request::url(); goto uSZhx; upqip: foreach ($q0HKi as &$tHq0l) { $tHq0l = str_replace(base_path(), '', $tHq0l); } goto UtRlF; SW1R6: $slwsW = true; goto kaloR; or51F: if (empty($fBhiU)) { return; } goto SW1R6; UtRlF: CurlUtil::get($fBhiU, array('data' => json_encode($q0HKi))); goto oHDpp; oHDpp: } catch (\Exception $SXS9c) { } } private function isExceptionIgnore($UyXoL) { if ($UyXoL instanceof \UnexpectedValueException) { if (Str::contains($UyXoL->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($UyXoL) { goto QPmqh; kpT7_: return null; goto V1G2e; oIXPK: try { if (StatisticMonitor::isEnable()) { goto G8k9K; RFVd4: $gmNPm = round((microtime(true) - LARAVEL_START) * 1000, 2); goto NxS0Z; KxjvS: StatisticMonitor::tick($xk3Sl, "{$JHYOH}." . $H8T3G, $gmNPm, false, 500); goto yLSJH; NxS0Z: $xIfit = $MRMCA->url(); goto WrIMP; QawCe: $xk3Sl = \ModStart\Core\Input\Request::domain(); goto KxjvS; G8k9K: $MRMCA = \ModStart\Core\Input\Request::instance(); goto RFVd4; WrIMP: $JHYOH = $MRMCA->method(); goto AhWIY; AhWIY: $H8T3G = Route::currentRouteAction(); goto QawCe; yLSJH: } } catch (\Exception $SXS9c) { } goto kpT7_; QPmqh: if ($UyXoL instanceof BizException) { goto Yh2Wk; Wr5ea: return $JOw_A; goto UkY0U; Yh2Wk: $JOw_A = Response::sendError($UyXoL->getMessage()); goto Aw2uL; Aw2uL: if ($JOw_A instanceof View) { return response()->make($JOw_A); } goto Wr5ea; UkY0U: } else { if ($UyXoL instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($UyXoL instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($UyXoL instanceof ModelNotFoundException) { return null; } else { if ($UyXoL instanceof HttpException) { switch ($UyXoL->getStatusCode()) { case 200: goto eiVPC; dbzhF: return $JOw_A; goto iNAVc; K6PPB: if ($JOw_A instanceof View) { return response()->make($JOw_A); } goto dbzhF; eiVPC: $JOw_A = Response::sendError($UyXoL->getMessage()); goto K6PPB; iNAVc: } } else { if ($UyXoL instanceof \UnexpectedValueException) { if (Str::contains($UyXoL->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto oIXPK; V1G2e: } }