isBackend)) { if (config('app.framework') == 'platform') { $this->isBackend = strpos(request()->getRequestUri(), config('app.isWeb')) !== false ? true : false; } else { $this->isBackend = strpos($_SERVER['PHP_SELF'], '/web/index.php') !== false ? true : false; } } return $this->isBackend; } public function isShop() { return !$this->isPlugins(); } public function isFrontend() { if (strpos(request()->getRequestUri(), '/addons/') !== false && strpos(request()->getRequestUri(), '/api.php') !== false ) { return true; } return false; } public function isPayment() { return strpos($_SERVER['PHP_SELF'], '/payment/') > 0 ? true : false; } public function isPlugins() { return Str::startsWith(request('route'), 'plugin.'); } public function isCron() { return strpos(request()->getRequestUri(), '/addons/') !== false && strpos(request()->getRequestUri(), '/cron.php') !== false; } /** * 前后端强制https跳转app * * @return string */ public function getScheme() { try { if ((config('app.framework') == 'platform' && file_exists(base_path().'/bootstrap/install.lock')) || config('app.framework') != 'platform') { if (SiteSetting::get('base.https')) { return 'https'; } } } catch (QueryException $exception) { \Log::error('getScheme error', $exception->getMessage()); } return parent::getScheme(); } public function getHost() { try { if ((config('app.framework') == 'platform' && file_exists(base_path().'/bootstrap/install.lock')) || config('app.framework') != 'platform') { if (parent::getHost() == 'localhost' && SiteSetting::get('base.host')) { return SiteSetting::get('base.host'); } } } catch (QueryException $exception) { \Log::error('getHost error', $exception->getMessage()); } return parent::getHost(); // TODO: Change the autogenerated stub } public function setRoute($route) { $this->route = $route; } public function getRoute() { return $this->route; } }