<?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($PvPxO) { try { goto tsLha; ZWvKF: $kZ_tk['url'] = Request::url(); goto Y1L1r; cUNdL: if ($wXSf6 && $PvPxO instanceof NotFoundHttpException) { $wXSf6 = false; } goto OXm03; ZGbso: if ($wXSf6 && $this->isExceptionIgnore($PvPxO)) { $wXSf6 = false; } goto PcLIp; bqDtM: if ($wXSf6 && $PvPxO instanceof BizException) { $wXSf6 = false; } goto cUNdL; OXm03: if ($wXSf6 && $PvPxO instanceof MethodNotAllowedHttpException) { $wXSf6 = false; } goto Vc6U_; n3ccn: $kZ_tk['message'] = $PvPxO->getMessage(); goto BBtYy; tsLha: $cfTH3 = config('env.ERROR_REPORT_URL', null); goto M1nT6; BBtYy: foreach ($kZ_tk as &$F6Fus) { $F6Fus = str_replace(base_path(), '', $F6Fus); } goto ed3CE; M1nT6: if (empty($cfTH3)) { return; } goto iXx0v; iXx0v: $wXSf6 = true; goto bqDtM; PcLIp: if (!$wXSf6) { return; } goto B2AlD; Vc6U_: if ($wXSf6 && $PvPxO instanceof HttpException) { switch ($PvPxO->getStatusCode()) { case 200: $wXSf6 = false; break; } } goto ZGbso; B2AlD: $kZ_tk = array(); goto ZWvKF; Y1L1r: $kZ_tk['file'] = $PvPxO->getFile() . ':' . $PvPxO->getLine(); goto n3ccn; ed3CE: CurlUtil::get($cfTH3, array('data' => json_encode($kZ_tk))); goto Cywjc; Cywjc: } catch (\Exception $WVwSN) { } } private function isExceptionIgnore($PvPxO) { if ($PvPxO instanceof \UnexpectedValueException) { if (Str::contains($PvPxO->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($PvPxO) { goto dDF21; dDF21: if ($PvPxO instanceof BizException) { goto MbK8a; fQHFy: $f3Nqc = Response::sendError($PvPxO->getMessage()); goto QrSB8; bcSSw: return $f3Nqc; goto zGHLM; MbK8a: $z1grj = $PvPxO->param; goto fQHFy; QrSB8: if (!\ModStart\Core\Input\Request::isAjax()) { if (!empty($z1grj['view'])) { $f3Nqc = view($z1grj['view'], array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $PvPxO->getMessage())); } } goto urOHN; urOHN: if ($f3Nqc instanceof View) { return response()->make($f3Nqc); } goto bcSSw; zGHLM: } else { if ($PvPxO instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($PvPxO instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($PvPxO instanceof ModelNotFoundException) { return null; } else { if ($PvPxO instanceof HttpException) { switch ($PvPxO->getStatusCode()) { case 200: goto g2DuQ; g2DuQ: if (\ModStart\Core\Input\Request::isJsonp()) { $f3Nqc = Response::generateError($PvPxO->getMessage()); return Response::jsonp($f3Nqc); } goto IUBYb; v34RS: if ($f3Nqc instanceof View) { return response()->make($f3Nqc); } goto bLVE_; bLVE_: return $f3Nqc; goto lOI5F; IUBYb: $f3Nqc = Response::sendError($PvPxO->getMessage()); goto v34RS; lOI5F: } } else { if ($PvPxO instanceof \UnexpectedValueException) { if (Str::contains($PvPxO->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto GW7ua; GW7ua: try { if (StatisticMonitor::isEnable()) { goto dWgMw; ehWMu: $sMEbu = Route::currentRouteAction(); goto H4Nuv; ewqsQ: $m2Dmo = $Mjv3h->url(); goto jRR6Z; dWgMw: $Mjv3h = \ModStart\Core\Input\Request::instance(); goto hKlMG; dqaUp: StatisticMonitor::tick($BZIUb, "{$fSCUf}." . $sMEbu, $sEFWu, false, 500); goto cgPXC; hKlMG: $sEFWu = round((microtime(true) - LARAVEL_START) * 1000, 2); goto ewqsQ; jRR6Z: $fSCUf = $Mjv3h->method(); goto ehWMu; H4Nuv: $BZIUb = \ModStart\Core\Input\Request::domain(); goto dqaUp; cgPXC: } } catch (\Exception $WVwSN) { } goto GX_9s; GX_9s: return null; goto qh8k2; qh8k2: } }