/**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  *************************************************************
  * 创建USEINFO个人信息,而不再创建新用户
  *************************************************************
  * @return mixed
  */
 public function actionCreate($id)
 {
     $modelUser = $this->findModel($id);
     //var_export($modelUser->toArray());
     if (count($userinfo = UserInfo::find()->where(['username' => $modelUser->username])->all()) > 0) {
         exit('gaiyonhu esit');
     } else {
         $modelUserInfo = new UserInfo();
         $modelUserInfo->username = $modelUser->username;
         if ($modelUserInfo->save()) {
             return $this->render('create', ['model' => $modelUserInfo]);
         } else {
             return $modelUserInfo->save();
             // exit($modelUserInfo->username);
             //  return $this->render('create',['model'=>$modelUserInfo]);
         }
     }
     // if ($model->load(Yii::$app->request->post()) && $model->save()) {
     //     return $this->redirect(['view', 'id' => $model->id]);
     // } else {
     //     return $this->render('create', [
     //         'model' => $model,
     //     ]);
     // }
 }
 static function getUserInfoList()
 {
     $data = UserInfo::find()->all();
     $userInfoList = array();
     foreach ($data as $key => $value) {
         $userInfoList[$value['username']] = $value['name'];
     }
     return $userInfoList;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserInfo::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'idcard', $this->idcard])->andFilterWhere(['like', 'level', $this->level])->andFilterWhere(['like', 'graduation', $this->graduation])->andFilterWhere(['like', 'degree', $this->degree])->andFilterWhere(['like', 'intro', $this->intro]);
     return $dataProvider;
 }