Ejemplo n.º 1
0
 public function actionCreate()
 {
     $model = new YiiUser();
     $model->scenario = 'create';
     $model->created_time = time();
     $model->cnum = $model->createCompanyNum();
     $model->load(Yii::$app->request->post());
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         //            Yii::$app->session->setFlash('success', '发送成功!');
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 /**
  * @return string|\yii\web\Response 用户登录
  */
 public function actionLogin()
 {
     $model = new YiiUser();
     $model->scenario = 'login';
     if ($model->load(Yii::$app->request->post())) {
         if ($model->login()) {
             //查询未读消息
             // $count=Msg::find()->andwhere(['tid'=>Yii::$app->user->getId(),'status'=>0])->count();
             // $session=Yii::$app->session;
             // $session->set('msg',$count);
             return $this->redirect(['index/index']);
         } else {
             return $this->render('login', ['model' => $model]);
         }
     }
     return $this->render('login', ['model' => $model]);
 }