Esempio n. 1
0
 public function actionCatedit()
 {
     $id = Yii::$app->request->post('id');
     $model = AgMcate::findOne($id);
     if ($model === null) {
         Yii::$app->getSession()->setFlash("info", '编辑失败');
         return $this->redirect(['index']);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('info', '编辑成功!');
         return $this->redirect(['index']);
     }
 }
Esempio n. 2
0
 public function actionMerchadd()
 {
     $mcate = AgMcate::find()->all();
     //行业类别数据填充
     //添加商家
     $model = new AgMerch();
     if ($model->load(Yii::$app->request->post())) {
         $model->setPassword($_POST['AgMerch']['password_hash']);
         $model->generateAuthKey();
         if ($model->save()) {
             Yii::$app->getSession()->setFlash('info', '添加成功!');
             return $this->redirect(['index']);
         }
     }
     return $this->render('merchadd', ['mcate' => $mcate, 'model' => $model]);
 }