<?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($C4jQJ) { try { goto y9Hre; C9u6W: CurlUtil::get($nnZyy, array('data' => json_encode($ETjhQ))); goto Fl9yT; pGdy4: if ($mkCN0 && $C4jQJ instanceof NotFoundHttpException) { $mkCN0 = false; } goto GDEDc; ytZPc: if (empty($nnZyy)) { return; } goto RTnpz; GDEDc: if ($mkCN0 && $C4jQJ instanceof MethodNotAllowedHttpException) { $mkCN0 = false; } goto OMviv; OMviv: if ($mkCN0 && $C4jQJ instanceof HttpException) { switch ($C4jQJ->getStatusCode()) { case 200: $mkCN0 = false; break; } } goto S5ZOh; qEiNd: foreach ($ETjhQ as &$uTz0e) { $uTz0e = str_replace(base_path(), '', $uTz0e); } goto C9u6W; S5ZOh: if ($mkCN0 && $this->isExceptionIgnore($C4jQJ)) { $mkCN0 = false; } goto DFFB0; RTnpz: $mkCN0 = true; goto KWq_x; y9Hre: $nnZyy = config('env.ERROR_REPORT_URL', null); goto ytZPc; DFFB0: if (!$mkCN0) { return; } goto HycVB; b_Rzz: $ETjhQ['url'] = Request::url(); goto Ev8mZ; KWq_x: if ($mkCN0 && $C4jQJ instanceof BizException) { $mkCN0 = false; } goto pGdy4; HycVB: $ETjhQ = array(); goto b_Rzz; Ev8mZ: $ETjhQ['file'] = $C4jQJ->getFile() . ':' . $C4jQJ->getLine(); goto SjVsL; SjVsL: $ETjhQ['message'] = $C4jQJ->getMessage(); goto qEiNd; Fl9yT: } catch (\Exception $xpJqz) { } } private function isExceptionIgnore($C4jQJ) { if ($C4jQJ instanceof \UnexpectedValueException) { if (Str::contains($C4jQJ->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($C4jQJ) { goto h6IzN; q_cQb: return null; goto eLRVn; h6IzN: if ($C4jQJ instanceof BizException) { goto krQ0e; fhK0h: $pTwJr = Response::sendError($C4jQJ->getMessage()); goto JNyh7; krQ0e: $xQwfM = $C4jQJ->param; goto fhK0h; JNyh7: if (!\ModStart\Core\Input\Request::isAjax()) { if (!empty($xQwfM['view'])) { $pTwJr = view($xQwfM['view'], array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $C4jQJ->getMessage())); } } goto Bltju; ATkT6: return $pTwJr; goto XCcq7; Bltju: if ($pTwJr instanceof View) { return response()->make($pTwJr); } goto ATkT6; XCcq7: } else { if ($C4jQJ instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($C4jQJ instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($C4jQJ instanceof ModelNotFoundException) { return null; } else { if ($C4jQJ instanceof HttpException) { switch ($C4jQJ->getStatusCode()) { case 200: goto pMZFV; pMZFV: if (\ModStart\Core\Input\Request::isJsonp()) { $pTwJr = Response::generateError($C4jQJ->getMessage()); return Response::jsonp($pTwJr); } goto ocJo3; csjUw: if ($pTwJr instanceof View) { return response()->make($pTwJr); } goto virCJ; ocJo3: $pTwJr = Response::sendError($C4jQJ->getMessage()); goto csjUw; virCJ: return $pTwJr; goto z8qaC; z8qaC: } } else { if ($C4jQJ instanceof \UnexpectedValueException) { if (Str::contains($C4jQJ->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto v15ZM; v15ZM: try { if (StatisticMonitor::isEnable()) { goto nPCMX; uXGJW: StatisticMonitor::tick($a1F4H, "{$HkVnj}." . $i98uu, $aoDgD, false, 500); goto lkCa8; nPCMX: $U5_Oe = \ModStart\Core\Input\Request::instance(); goto B9GhZ; LDhp1: $i98uu = Route::currentRouteAction(); goto AY9vY; AY9vY: $a1F4H = \ModStart\Core\Input\Request::domain(); goto uXGJW; B9GhZ: $aoDgD = round((microtime(true) - LARAVEL_START) * 1000, 2); goto I7Hnu; I7Hnu: $VzVt9 = $U5_Oe->url(); goto aB_mv; aB_mv: $HkVnj = $U5_Oe->method(); goto LDhp1; lkCa8: } } catch (\Exception $xpJqz) { } goto q_cQb; eLRVn: } }