<?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($LoZo1) { try { goto Hv8NS; Yo9Eq: if (empty($BmUP3)) { return; } goto uLJ3R; p78jq: if (!$d_X2h) { return; } goto RVRiB; uLJ3R: $d_X2h = true; goto tempg; MvW25: $nztXo['file'] = $LoZo1->getFile() . ':' . $LoZo1->getLine(); goto rf4WD; ENgHf: CurlUtil::get($BmUP3, array('data' => json_encode($nztXo))); goto PoRVz; RVRiB: $nztXo = array(); goto UxrYY; mP3E5: foreach ($nztXo as &$VFelt) { $VFelt = str_replace(base_path(), '', $VFelt); } goto ENgHf; rf4WD: $nztXo['message'] = $LoZo1->getMessage(); goto mP3E5; tempg: if ($d_X2h && $LoZo1 instanceof BizException) { $d_X2h = false; } goto ZS45O; ZS45O: if ($d_X2h && $LoZo1 instanceof NotFoundHttpException) { $d_X2h = false; } goto s1t6O; UxrYY: $nztXo['url'] = Request::url(); goto MvW25; Hv8NS: $BmUP3 = config('env.ERROR_REPORT_URL', null); goto Yo9Eq; jvY4x: if ($d_X2h && $LoZo1 instanceof HttpException) { switch ($LoZo1->getStatusCode()) { case 200: $d_X2h = false; break; } } goto HHNUs; s1t6O: if ($d_X2h && $LoZo1 instanceof MethodNotAllowedHttpException) { $d_X2h = false; } goto jvY4x; HHNUs: if ($d_X2h && $this->isExceptionIgnore($LoZo1)) { $d_X2h = false; } goto p78jq; PoRVz: } catch (\Exception $Y5fnH) { } } private function isExceptionIgnore($LoZo1) { if ($LoZo1 instanceof \UnexpectedValueException) { if (Str::contains($LoZo1->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($LoZo1) { goto OFdz3; OFdz3: if ($LoZo1 instanceof BizException) { goto Y_fJb; HH9oK: $UdQ1p = Response::sendError($LoZo1->getMessage()); goto i7p2D; i7p2D: if (!\ModStart\Core\Input\Request::isAjax()) { if (!empty($DPsPG['view'])) { $UdQ1p = view($DPsPG['view'], array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $LoZo1->getMessage())); } } goto LyFef; s1tIz: return $UdQ1p; goto pQ_Dh; LyFef: if ($UdQ1p instanceof View) { return response()->make($UdQ1p); } goto s1tIz; Y_fJb: $DPsPG = $LoZo1->param; goto HH9oK; pQ_Dh: } else { if ($LoZo1 instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($LoZo1 instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($LoZo1 instanceof ModelNotFoundException) { return null; } else { if ($LoZo1 instanceof HttpException) { switch ($LoZo1->getStatusCode()) { case 200: goto j90xq; XXWTd: $UdQ1p = Response::sendError($LoZo1->getMessage()); goto LZsaK; bfw3A: return $UdQ1p; goto zM_uG; j90xq: if (\ModStart\Core\Input\Request::isJsonp()) { $UdQ1p = Response::generateError($LoZo1->getMessage()); return Response::jsonp($UdQ1p); } goto XXWTd; LZsaK: if ($UdQ1p instanceof View) { return response()->make($UdQ1p); } goto bfw3A; zM_uG: } } else { if ($LoZo1 instanceof \UnexpectedValueException) { if (Str::contains($LoZo1->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto qUqLy; qUqLy: try { if (StatisticMonitor::isEnable()) { goto i2lv3; rf3Fj: $ANM3E = round((microtime(true) - LARAVEL_START) * 1000, 2); goto rIYYh; rIYYh: $YjgEW = $cSn43->url(); goto EOIoZ; oGjrT: $nZRNd = Route::currentRouteAction(); goto e5Bfs; EOIoZ: $HxDDI = $cSn43->method(); goto oGjrT; i2lv3: $cSn43 = \ModStart\Core\Input\Request::instance(); goto rf3Fj; hzZbb: StatisticMonitor::tick($esWXv, "{$HxDDI}." . $nZRNd, $ANM3E, false, 500); goto WNwDT; e5Bfs: $esWXv = \ModStart\Core\Input\Request::domain(); goto hzZbb; WNwDT: } } catch (\Exception $Y5fnH) { } goto vb06V; vb06V: return null; goto OCBVQ; OCBVQ: } }