<?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($tDUwy) { try { goto elE0E; y0B83: $n1XMP = array(); goto Ebs02; elE0E: $FJ5GZ = config('env.ERROR_REPORT_URL', null); goto jEwA3; Q2Q5a: if ($T5hSD && $tDUwy instanceof BizException) { $T5hSD = false; } goto Sc5YH; xLDZD: $n1XMP['file'] = $tDUwy->getFile() . ':' . $tDUwy->getLine(); goto t3Isc; i2v_t: if ($T5hSD && $tDUwy instanceof MethodNotAllowedHttpException) { $T5hSD = false; } goto n2CeV; vaZkG: foreach ($n1XMP as &$Q0rz2) { $Q0rz2 = str_replace(base_path(), '', $Q0rz2); } goto R0Rc0; jEwA3: if (empty($FJ5GZ)) { return; } goto D2z33; Ebs02: $n1XMP['url'] = Request::url(); goto xLDZD; ARvDH: if (!$T5hSD) { return; } goto y0B83; D2z33: $T5hSD = true; goto Q2Q5a; Io0eN: if ($T5hSD && $this->isExceptionIgnore($tDUwy)) { $T5hSD = false; } goto ARvDH; R0Rc0: CurlUtil::get($FJ5GZ, array('data' => SerializeUtil::jsonEncode($n1XMP))); goto L9PYj; t3Isc: $n1XMP['message'] = $tDUwy->getMessage(); goto vaZkG; Sc5YH: if ($T5hSD && $tDUwy instanceof NotFoundHttpException) { $T5hSD = false; } goto i2v_t; n2CeV: if ($T5hSD && $tDUwy instanceof HttpException) { switch ($tDUwy->getStatusCode()) { case 200: $T5hSD = false; break; } } goto Io0eN; L9PYj: } catch (\Exception $SwVsw) { } } private function isExceptionIgnore($tDUwy) { if ($tDUwy instanceof \UnexpectedValueException) { if (Str::contains($tDUwy->getMessage(), 'Invalid method override')) { return true; } } return false; } private function getExceptionResponse($tDUwy) { goto uEIOi; EeXip: try { if (StatisticMonitor::isEnable()) { goto By7dh; DvnTB: $wuAJG = Route::currentRouteAction(); goto ubDFW; By7dh: $fzeTQ = \ModStart\Core\Input\Request::instance(); goto dN6hN; dN6hN: $CoZv2 = round((microtime(true) - LARAVEL_START) * 1000, 2); goto cjkoy; eUDI7: $fVu6a = $fzeTQ->method(); goto DvnTB; cjkoy: $tpgiq = $fzeTQ->url(); goto eUDI7; ubDFW: $tYHk2 = \ModStart\Core\Input\Request::domain(); goto UQHDl; UQHDl: StatisticMonitor::tick($tYHk2, "{$fVu6a}." . $wuAJG, $CoZv2, false, 500); goto tEOYd; tEOYd: } } catch (\Exception $SwVsw) { } goto PTfjK; uEIOi: if ($tDUwy instanceof BizException) { goto L0SA8; Sve8E: if ($Z5nZL instanceof View) { return response()->make($Z5nZL); } goto COPUE; L0SA8: $DtD1z = $tDUwy->param; goto hNSeX; COPUE: return $Z5nZL; goto j_0Zv; hNSeX: $Z5nZL = Response::sendError($tDUwy->getMessage()); goto kmhqp; kmhqp: if (!\ModStart\Core\Input\Request::isAjax()) { if (empty($DtD1z['view']) && !empty($DtD1z['statusCode']) && in_array($DtD1z['statusCode'], array(403, 404, 500))) { $DtD1z['view'] = 'modstart::core.msg.' . $DtD1z['statusCode']; } if (!empty($DtD1z['view'])) { if (!isset($DtD1z['viewData'])) { $DtD1z['viewData'] = array(); } $Z5nZL = view($DtD1z['view'], array_merge(array('_viewFrame' => 'theme.default.pc.frame', 'msg' => $tDUwy->getMessage()), $DtD1z['viewData'])); } } goto Sve8E; j_0Zv: } else { if ($tDUwy instanceof MethodNotAllowedHttpException) { return Response::page404(); } elseif ($tDUwy instanceof NotFoundHttpException) { if (\ModStart\Core\Input\Request::isAjax()) { return Response::page404(); } return null; } elseif ($tDUwy instanceof ModelNotFoundException) { return null; } else { if ($tDUwy instanceof HttpException) { switch ($tDUwy->getStatusCode()) { case 200: goto Oxw2O; Oxw2O: if (\ModStart\Core\Input\Request::isJsonp()) { $Z5nZL = Response::generateError($tDUwy->getMessage()); return Response::jsonp($Z5nZL); } goto dVb12; licLE: if ($Z5nZL instanceof View) { return response()->make($Z5nZL); } goto qk1fj; dVb12: $Z5nZL = Response::sendError($tDUwy->getMessage()); goto licLE; qk1fj: return $Z5nZL; goto fiABN; fiABN: } } else { if ($tDUwy instanceof \UnexpectedValueException) { if (Str::contains($tDUwy->getMessage(), 'Invalid method override')) { return Response::page404(); } } } } } goto EeXip; PTfjK: return null; goto h7pKT; h7pKT: } }