[ 'class' => LoginBehavior::className(), ], ]); } public function actionIndex() { if(\Yii::$app->request->isAjax){ $form = new CommonPageListForm(); $form->attributes = \Yii::$app->request->get(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->search(); return $this->responseHandler($data); } return $this->render('index'); } public function actionEdit($id = 0) { $model = Page::findOne([ 'cx_mch_id' => $this->cx_mch_id, 'is_delete' => 0, 'id' => $id, ]); if($model == null) $model = new Page(); if(\Yii::$app->request->isPost){ $form = new CommonPageEditForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->model = $model; $data = $form->save(); return $this->responseHandler($data); } $return_url = \Yii::$app->request->referrer; return $this->render('edit', [ 'model' => $model, 'return_url' => $return_url, ]); } public function actionDelete() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonPageActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->delete(); return $this->responseHandler($data); } public function actionPublish() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonPageActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->publish(); return $this->responseHandler($data); } public function actionTrash() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonPageActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->trash(); return $this->responseHandler($data); } public function actionCancelTrash() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonPageActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->cancel_trash(); return $this->responseHandler($data); } public function actionCancelTop() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonPageActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->cancel_top(); return $this->responseHandler($data); } public function actionTop() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonPageActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->top(); return $this->responseHandler($data); } }