[ 'class' => LoginBehavior::className(), ], ]); } public function actionMp() { $this->wechat_app = $this->wechat_app == null ? new WechatApp() : $this->wechat_app; if(\Yii::$app->request->isPost){ $form = new WechatAppForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->model = $this->wechat_app; $data = $form->save(); return $this->responseHandler($data); } return $this->render('mp',[ 'model' => $this->wechat_app ]); } public function actionMpTplMsg() { $form = new WechatAppTplMsgForm(); if(\Yii::$app->request->isPost){ $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $data = $form->save(); return $this->responseHandler($data); } $form->cx_mch_id = $this->cx_mch_id; $list = $form->search(); return $this->render('mp-tpl-msg',[ 'list' => $list ]); } public function actionMpSlide() { $form = new SlideListForm(); $form->attributes = \Yii::$app->request->get(); $form->zone_id = Banner::ZONE_ID_WXAPP_INDEX; $form->cx_mch_id = $this->cx_mch_id; $data = $form->search(); return $this->render('mp-slide', $data); } public function actionMpSlideEdit($id = 0) { $zone_id = Banner::ZONE_ID_WXAPP_INDEX; $model = Banner::findOne([ 'id' => $id, 'cx_mch_id' => $this->cx_mch_id, 'zone_id' => $zone_id, 'is_delete' => 0 ]); if($model == null){ $model = new Banner(); } if(\Yii::$app->request->isPost){ $media = \Yii::$app->request->post('media',0); $form = new SlideEditForm(); if($media == Banner::MEDIA_IMG){ $form->scenario = 'img'; } if($media == Banner::MEDIA_VIDEO){ $form->scenario = 'video'; } $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->zone_id = $zone_id; $form->model = $model; $form->user_id = \Yii::$app->admin->identity->user_id; $data = $form->save(); return $this->responseHandler($data); } $return_url = \Yii::$app->request->referrer; return $this->render('mp-slide-edit', [ 'model' => $model, 'return_url' => $return_url, 'links' => (new PickLinkForm())->getPickLink() ]); } public function actionMpSlideShow() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new SlideActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->zone_id = Banner::ZONE_ID_WXAPP_INDEX; $data = $form->show(); return $this->responseHandler($data); } public function actionMpSlideHide() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new SlideActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->zone_id = Banner::ZONE_ID_WXAPP_INDEX; $data = $form->hide(); return $this->responseHandler($data); } public function actionMpSlideDel() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new SlideActionForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->zone_id = Banner::ZONE_ID_WXAPP_INDEX; $data = $form->delete(); return $this->responseHandler($data); } }