<?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($ZvA6A) { try { goto OqY5Y; Qx4di: if (!$ACoM5) { return; } goto KuleP; vwoQV: $rAnHl['url'] = Request::url(); goto Wt5jz; VBCZj: if ($ACoM5 && $ZvA6A instanceof NotFoundHttpException) { $ACoM5 = false; } goto IpwrB; gUclf: if ($ACoM5 && $ZvA6A instanceof BizException) { $ACoM5 = false; } goto VBCZj; aGbaB: if (empty($Htm3a)) { return; } goto PS8p2; Wt5jz: $rAnHl['file'] = $ZvA6A->getFile() . ':' . $ZvA6A->getLine(); goto bRQtZ; POxja: CurlUtil::get($Htm3a, array('data' => SerializeUtil::jsonEncode($rAnHl))); goto gXa_S; IpwrB: if ($ACoM5 && $ZvA6A instanceof MethodNotAllowedHttpException) { $ACoM5 = false; } goto LvpJD; LvpJD: if ($ACoM5 && $ZvA6A instanceof HttpException) { switch ($ZvA6A->getStatusCode()) { case 200: $ACoM5 = false; break; } } goto gwe5N; gwe5N: if ($ACoM5 && $this->isExceptionIgnore($ZvA6A)) { $ACoM5 = false; } goto Qx4di; Z3Zwc: foreach ($rAnHl as &$Xz28r) { $Xz28r = str_replace(base_path(), '', $Xz28r); } goto POxja; bRQtZ: $rAnHl['message'] = $ZvA6A->getMessage(); goto Z3Zwc; OqY5Y: $Htm3a = config('env.ERROR_REPORT_URL', null); goto aGbaB; PS8p2: $ACoM5 = true; goto gUclf; KuleP: $rAnHl = array(); goto vwoQV; gXa_S: } catch (\Exception $Xlb8r) { } } private function isExceptionIgnore($ZvA6A) { if ($ZvA6A instanceof \UnexpectedValueException) { if (Str::contains($ZvA6A->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($ZvA6A) { goto c_pWl; c_pWl: if ($ZvA6A instanceof BizException) { goto pLjLV; ov5jx: if (!\ModStart\Core\Input\Request::isAjax()) { if (empty($dSzRp['view']) && !empty($dSzRp['statusCode']) && in_array($dSzRp['statusCode'], array(403, 404, 500))) { $dSzRp['view'] = 'modstart::core.msg.' . $dSzRp['statusCode']; } if (!empty($dSzRp['view'])) { if (!isset($dSzRp['viewData'])) { $dSzRp['viewData'] = array(); } $ZIe4d = view($dSzRp['view'], array_merge(array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $ZvA6A->getMessage()), $dSzRp['viewData'])); } } goto sG8AW; sG8AW: if ($ZIe4d instanceof View) { return response()->make($ZIe4d); } goto OibQf; pLjLV: $dSzRp = $ZvA6A->param; goto gyvqe; OibQf: return $ZIe4d; goto fQFP5; gyvqe: $ZIe4d = Response::sendError($ZvA6A->getMessage()); goto ov5jx; fQFP5: } else { if ($ZvA6A instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($ZvA6A instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($ZvA6A instanceof ModelNotFoundException) { return null; } else { if ($ZvA6A instanceof HttpException) { switch ($ZvA6A->getStatusCode()) { case 200: goto m8bSE; m8bSE: if (\ModStart\Core\Input\Request::isJsonp()) { $ZIe4d = Response::generateError($ZvA6A->getMessage()); return Response::jsonp($ZIe4d); } goto GNWY3; GNWY3: $ZIe4d = Response::sendError($ZvA6A->getMessage()); goto khOSh; khOSh: if ($ZIe4d instanceof View) { return response()->make($ZIe4d); } goto xx8n8; xx8n8: return $ZIe4d; goto xSJGa; xSJGa: } } else { if ($ZvA6A instanceof \UnexpectedValueException) { if (Str::contains($ZvA6A->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto ZBZPi; ZBZPi: try { if (StatisticMonitor::isEnable()) { goto FX9em; FX9em: $hoJyG = \ModStart\Core\Input\Request::instance(); goto sYrHw; bzdMJ: $ik1Qg = $hoJyG->url(); goto LY8do; LY8do: $pK00s = $hoJyG->method(); goto uDDXT; Ass0a: $BlTXG = \ModStart\Core\Input\Request::domain(); goto nX0ER; sYrHw: $vQlXM = round((microtime(true) - LARAVEL_START) * 1000, 2); goto bzdMJ; nX0ER: StatisticMonitor::tick($BlTXG, "{$pK00s}." . $ziOie, $vQlXM, false, 500); goto Yfoff; uDDXT: $ziOie = Route::currentRouteAction(); goto Ass0a; Yfoff: } } catch (\Exception $Xlb8r) { } goto aFcmm; aFcmm: return null; goto IglRr; IglRr: } }