layout && in_array(Yii::$app->id, [AppEnum::BACKEND, AppEnum::MERCHANT])) { $this->layout = '@addons/Mch/' . $this->module->id . '/views/layouts/client'; } $redirect_url = '/mch/client/auth/login'; $this->admin = Yii::$app->mch_user->identity; if(empty($this->admin)) return $this->redirect([$redirect_url]); $mch_id = $this->admin['mch_id']; $mch = Mch::findOne(['id'=>$mch_id]); if(empty($mch)){ return $this->redirect([$redirect_url]); } $mall = Mall::findOne(['id'=>$mch['mall_id']]); $this->mall = $mall; $this->mall_id = $mall['id']; $this->mch_id = Yii::$app->mch_user->identity->mch_id; } /** * @return array */ public function behaviors() { return [ 'actionLog' => [ 'class' => ActionLogBehavior::class ] ]; } /** * @param $action * @return bool * @throws UnauthorizedHttpException * @throws \yii\web\BadRequestHttpException */ public function beforeAction($action) { if (!parent::beforeAction($action)) { return false; } // 每页数量 $this->pageSize = Yii::$app->request->get('per-page', 10); $this->pageSize > 50 && $this->pageSize = 50; return true; } }