request->isAjax) { \Yii::$app->response->headers ->set('Cache-Control', 'no-store, no-cache, must-revalidate') ->set('Expires', 'Thu, 19 Nov 1981 08:00:00 GMT') ->set('Pragma', 'no-cache'); } $this->loadMall(); } /** * @return $this */ private function loadMall() { $id = \Yii::$app->getSessionMallId(); $url = \Yii::$app->urlManager->createUrl('admin/index/index'); if (!$id) { return $this->redirect($url)->send(); } $mall = Mall::find()->where(['id' => $id, 'is_delete' => 0])->with('option')->one(); if (!$mall) { return $this->redirect($url)->send(); } if ($mall->is_delete !== 0 || $mall->is_recycle !== 0) { return $this->redirect($url)->send(); } $newOptions = []; foreach ($mall['option'] as $item) { $newOptions[$item['key']] = $item['value']; } $mall->options = (object)$newOptions; \Yii::$app->mall = $mall; return $this; } public function render($view, $params = []) { if (mb_stripos($view, '@') !== 0 && mb_stripos($view, '/') !== 0) { $view = '@app/plugins/' . $this->module->id . '/views/' . mb_strtolower($this->id) . '/' . $view; } return parent::render($view, $params); } }