public function actionIndex() { $user = Yii::$app->session->get('user'); if (Info::checkUserRecordOrPass($user['userId'])) { //判断用户是否已经填报过 return $this->redirect(['sign-up/over']); } $signUpForm = new SignUpForm(); if ($info = Info::findRefusedByUserId($user['userId'])) { CommonFunctions::createAlertMessage("工作人员帮您填写报名信息失败,请仔细检查报名信息,然后完善后再次提交。\n <br>失败原因是:" . $info->replyContent, "error"); } else { CommonFunctions::createAlertMessage("‘帮我报名’是‘云豆讲堂’为用户提供的增值服务,根据用户在线提交的信息,\n 由工作人员协助在主管部门进行报名。由于牵涉到考试信息的准确性,请您确保提供的信息准确无误。\n 由于提交需要用到个人照片(像素:102*126)与学历证书扫描件(像素:650*500),请按规定提交。", "info"); } if (Yii::$app->request->isPost) { if ($signUpForm->loadPost($signUpForm) && $signUpForm->validate()) { $signUpForm->record(); return $this->redirect(['sign-up/over']); } } return $this->render('index', ['signUpForm' => $signUpForm]); }
public function record() { $user = Yii::$app->session->get('user'); $info = Info::findRefusedByUserId($user['userId']); if (!$info) { $info = new Info(); $info->password = CommonFunctions::createRandPassword(); } $info->userId = $this->userId; $info->IDCard = $this->IDCard; $info->realName = $this->realName; $info->cellphone = $this->cellphone; $info->education = $this->education; $info->major = $this->major; $info->workTime = $this->workTime; $info->technical = $this->technical; $info->signUpMajor = $this->signUpMajor; $info->company = $this->company; $info->findPasswordQuestion = $this->findPasswordQuestion; $info->findPasswordAnswer = $this->findPasswordAnswer; $info->headImg = $this->headImg; $info->educationImg = $this->educationImg; $info->createDate = DateFunctions::getCurrentDate(); $info->state = Info::STATE_RECORD; if (!$info->save()) { throw new Exception("Sign Up Info save error"); } }