public function actionAddservice()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new ArticleForm();
     $form->categoryId = Variable::$articleCat_type_service;
     $form->status = 1;
     $articleModel = new Article();
     //添加
     $form->setScenario('service');
     if ($form->load($req->post()) && $form->validate()) {
         if ($articleModel->addAerticle($form->title, $form->keywords, $form->categoryId, $form->content, $form->status, $form->isTop, $form->description, $form->pic, $form->isIndexShow)) {
             Yii::$app->session->setFlash(Variable::$flash_success, '服务项添加成功');
             $this->redirect(Variable::$serviceIndex_url);
             return;
         } else {
             Yii::$app->session->setFlash(Variable::$flash_error, '服务项添加失败,请重试');
         }
     }
     return $this->render(Variable::$addService_view, ['model' => $form, 'articleModel' => $articleModel]);
 }
 public function actionAddarticle()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new ArticleForm();
     $articleModel = new Article();
     $articleCatModel = ArticleCategory::find()->all();
     //添加
     $form->setScenario('create');
     if ($form->load($req->post()) && $form->validate()) {
         if ($articleModel->addAerticle($form->title, $form->keywords, $form->categoryId, $form->content, $form->status, $form->isTop, $form->description, $form->pic)) {
             $this->redirect(Variable::$articleManger_url);
             return;
         }
     }
     return $this->render(Variable::$addArticle_view, ['model' => $form, 'articleModel' => $articleModel, 'articleCatModel' => $articleCatModel]);
 }