public function beforeAction($action) { $this->setTitle(); $this->setSubTitle(); $this->setDescription(); $this->setKeywords(); \Yii::$app->response->getHeaders()->set("Content-Security-Policy", UtilHelper::getCspHeader(YII_ENV)); //微信被封了 // $login_status = $this->checkLoginStatus(); // // if (!$login_status && !in_array($action->getUniqueId(), $this->allowAllAction)) { // if( UtilHelper::isWechat() ){ // if(\Yii::$app->request->isAjax){ // $this->renderJSON([],"未登录,请返回用户中心",-302); // }else{ // $redirect_url = UrlService::buildUrl("/weixin/oauth/login",['referer' => $this->getLoginUrl() ]); // $this->redirect( $redirect_url ); // } // return false; // } // // // } if (!$this->getUUID()) { $this->setUUID(); } return true; }
public function beforeAction($action) { $this->setTitle(); $this->setDescription(); $this->setKeywords(); Yii::$app->response->getHeaders()->set("Content-Security-Policy", UtilHelper::getCspHeader(YII_ENV)); if (!UtilHelper::isPC() && !in_array($action->getUniqueId(), $this->ignoreRedirectAction)) { $url = UrlService::buildWapUrl("/" . $action->getUniqueId(), $_GET); $this->redirect($url); return false; } if (!in_array($action->getUniqueId(), $this->allowAllAction)) { } if (!$this->getUUID()) { $this->setUUID(); } return true; }