getDomainConfigurations(); $redis = new RedisClient(); $domain = $_SERVER['HTTP_HOST']; $this->applyDomainTheme($configurations); if ($this->domainMatchesConfigHost($configurations, 'host_1', $domain)) { $this->cdn = $redis->get('admin_cdn', 60, function () { return Configurations::where('name', 'admin_cdn')->value('value'); }); } elseif ($this->domainMatchesConfigHost($configurations, 'host_5', $domain)) { // 如果 host_2 匹配 $this->cdn = $redis->get('backup_cdn', 60, function () { return Configurations::where('name', 'backup_cdn')->value('value'); }); } else { $this->cdn = $redis->get('cdn', 60, function () { return Configurations::where('name', 'cdn')->value('value'); }); $this->backup_cdn = $redis->get('backup_cdn', 60, function () { return Configurations::where('name', 'backup_cdn')->value('value'); }); } $this->seo = $redis->get('seo', 60, function () { return Configurations::where('name', 'seo')->value('value'); }); $this->appName = Config::get('appName'); $this->initializePublicLocale(); } public function index() { return $this->publicView()->assign('cdn', $this->cdn)->assign('backup_cdn', $this->backup_cdn)->assign('appName', $this->appName)->assign('seo', $this->seo)->display('index.tpl'); } public function page404($request, $response, $args) { $newResponse = $response->withStatus(404); $newResponse->getBody()->write($this->view()->fetch('404.tpl')); return $newResponse; } public function page405($request, $response, $args) { $newResponse = $response->withStatus(405); $newResponse->getBody()->write($this->view()->fetch('405.tpl')); return $newResponse; } public function page500($request, $response, $args) { $newResponse = $response->withStatus(500); $newResponse->getBody()->write($this->view()->fetch('500.tpl')); return $newResponse; } }