<?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 ModStart\Core\Util\SerializeUtil; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; trait ExceptionReportHandleTrait { private function errorReportCheck($dccT4) { try { goto zrRVN; nXfhe: $Pvh1r['message'] = $dccT4->getMessage(); goto VjfxV; S_t0Q: if (empty($SJqDm)) { return; } goto Fga8J; oXFkC: if ($yVgxs && $dccT4 instanceof BizException) { $yVgxs = false; } goto GOggd; bmuHd: $Pvh1r['url'] = Request::url(); goto dxZUa; dxZUa: $Pvh1r['file'] = $dccT4->getFile() . ':' . $dccT4->getLine(); goto nXfhe; At8Hd: CurlUtil::get($SJqDm, array('data' => SerializeUtil::jsonEncode($Pvh1r))); goto DcXuT; Fga8J: $yVgxs = true; goto oXFkC; VjfxV: foreach ($Pvh1r as &$knQyJ) { $knQyJ = str_replace(base_path(), '', $knQyJ); } goto At8Hd; F8iLj: if ($yVgxs && $this->isExceptionIgnore($dccT4)) { $yVgxs = false; } goto ennf9; ennf9: if (!$yVgxs) { return; } goto hTYh1; GOggd: if ($yVgxs && $dccT4 instanceof NotFoundHttpException) { $yVgxs = false; } goto BKFl0; BKFl0: if ($yVgxs && $dccT4 instanceof MethodNotAllowedHttpException) { $yVgxs = false; } goto TeIS_; zrRVN: $SJqDm = config('env.ERROR_REPORT_URL', null); goto S_t0Q; hTYh1: $Pvh1r = array(); goto bmuHd; TeIS_: if ($yVgxs && $dccT4 instanceof HttpException) { switch ($dccT4->getStatusCode()) { case 200: $yVgxs = false; break; } } goto F8iLj; DcXuT: } catch (\Exception $Sgh1N) { } } private function isExceptionIgnore($dccT4) { if ($dccT4 instanceof \UnexpectedValueException) { if (Str::contains($dccT4->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($dccT4) { goto jLZtO; jLZtO: if ($dccT4 instanceof BizException) { goto zW3EJ; frS20: $bCCWW = Response::sendError($dccT4->getMessage()); goto GCAG4; fwDCP: if (!\ModStart\Core\Input\Request::isAjax()) { if (empty($d80wO['view']) && !empty($d80wO['statusCode']) && in_array($d80wO['statusCode'], array(403, 404, 500))) { $d80wO['view'] = 'modstart::core.msg.' . $d80wO['statusCode']; $e_oRI = $d80wO['statusCode']; } if (!empty($d80wO['view'])) { if (!isset($d80wO['viewData'])) { $d80wO['viewData'] = array(); } $bCCWW = view($d80wO['view'], array_merge(array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $dccT4->getMessage()), $d80wO['viewData'])); } } goto mguqW; GCAG4: $e_oRI = 200; goto fwDCP; NSN9_: return $bCCWW; goto m0Ffa; zW3EJ: $d80wO = $dccT4->param; goto frS20; mguqW: if ($bCCWW instanceof View) { return response()->make($bCCWW, $e_oRI); } goto NSN9_; m0Ffa: } else { if ($dccT4 instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($dccT4 instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($dccT4 instanceof ModelNotFoundException) { return null; } else { if ($dccT4 instanceof HttpException) { switch ($dccT4->getStatusCode()) { case 200: goto xGwoC; SSzg7: if ($bCCWW instanceof View) { return response()->make($bCCWW); } goto N46ZS; NPvxs: $bCCWW = Response::sendError($dccT4->getMessage()); goto SSzg7; N46ZS: return $bCCWW; goto q60N9; xGwoC: if (\ModStart\Core\Input\Request::isJsonp()) { $bCCWW = Response::generateError($dccT4->getMessage()); return Response::jsonp($bCCWW); } goto NPvxs; q60N9: } } else { if ($dccT4 instanceof \UnexpectedValueException) { if (Str::contains($dccT4->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto JudwW; JudwW: try { if (StatisticMonitor::isEnable()) { goto mIQDf; TXY1C: $keY2T = \ModStart\Core\Input\Request::domain(); goto goOrU; goOrU: StatisticMonitor::tick($keY2T, "{$UVOMF}." . $JfLuA, $EjkFa, false, 500); goto KAo6Q; V4JbV: $MiLaY = $Kv_Mp->url(); goto CXyF2; tnHcf: $EjkFa = round((microtime(true) - LARAVEL_START) * 1000, 2); goto V4JbV; mIQDf: $Kv_Mp = \ModStart\Core\Input\Request::instance(); goto tnHcf; CXyF2: $UVOMF = $Kv_Mp->method(); goto ApJwm; ApJwm: $JfLuA = Route::currentRouteAction(); goto TXY1C; KAo6Q: } } catch (\Exception $Sgh1N) { } goto BmJO6; BmJO6: return null; goto ZoRk6; ZoRk6: } }