//执行方法 $controller->preAction(); if (method_exists($controller, 'needTransaction') && $controller->needTransaction($action)) { // action设置了需要回滚 $content = IlluminateSupportFacadesDB::transaction(function () use ($action, $controller) { return $controller->$action( IlluminateHttpRequest::capture() ); }); } else { $content = $controller->$action( IlluminateHttpRequest::capture() ); } exit($content);
/** * 前置action */ public function preAction() { //strpos(request()->get('route'),'setting.key')!== 0 && Check::app(); //是否为商城后台管理路径 if (env('APP_Framework') == 'platform') { strpos(request()->getRequestUri(), config('app.isWeb')) === 0 && Check::setKey(); } else { strpos(request()->getBaseUrl(), '/web/index.php') === 0 && Check::setKey(); } }