[ 'class' => LoginBehavior::className(), ], ]); } public function actionIndex() { if(\Yii::$app->request->isAjax){ $form = new CommonSysMsgListForm(); $form->attributes = \Yii::$app->request->get(); $form->cx_mch_id = $this->cx_mch_id; $form->to_user_id = 0; $data = $form->search(); return $this->responseHandler($data); } return $this->render('index'); } public function actionEdit($id = 0) { $model = SysMsg::findOne([ 'cx_mch_id' => $this->cx_mch_id, 'type' => SysMsg::TYPE_DEFAULT_SYS_MSG, 'is_delete' => 0, 'id' => $id, ]); if($model == null) $model = new SysMsg(); if(\Yii::$app->request->isPost){ $form = new CommonSysMsgEditForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->type = SysMsg::TYPE_DEFAULT_SYS_MSG; $form->to_user_id = 0; $form->order_id = 0; $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 CommonSysMsgActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->to_user_id = 0; $data = $form->delete(); return $this->responseHandler($data); } public function actionPublish() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonSysMsgActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->to_user_id = 0; $data = $form->publish(); return $this->responseHandler($data); } public function actionWithdraw() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new CommonSysMsgActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->to_user_id = 0; $data = $form->withdraw(); return $this->responseHandler($data); } }