/**
  * Creates a new Applicants model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Applicants();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->applicant_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemplo n.º 2
0
 public function userReg($mobile, $devisetoken, $access_token)
 {
     $params = Yii::$app->request->getBodyParams();
     $acc_type = $params['type'];
     if ($acc_type == 0) {
         //求职人员
         $model = new Applicants();
         $model->applicant_nickname = $mobile;
         if ($model->validate() && $model->save()) {
             if ($this->saveAccount($model)) {
                 return $model;
             } else {
                 $model->delete();
             }
         }
     } else {
         if ($acc_type == 1) {
             //商家
             $model = new Business();
             $model->business_name = $mobile;
             $model->business_contactor_mobile = $mobile;
             $model->province_id = $params['province_id'];
             $model->province_name = $params['province_name'];
             $model->city_id = $params['city_id'];
             $model->city_name = $params['city_name'];
             $model->district_id = $params['district_id'];
             $model->district_name = $params['district_name'];
             $model->district_detail = $params['district_detail'];
             if ($model->validate() && $model->save()) {
                 if ($this->saveAccount($model)) {
                     return $model;
                 } else {
                     $model->delete();
                 }
             } else {
                 return Message::say(Message::E_ERROR, null, "字段错误");
             }
         }
     }
     return null;
 }