コード例 #1
0
 public function postContact()
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', '');
     // shcool id
     $school = Input::get('school');
     // shcool entry year
     $entryYear = Input::get('entry_year');
     // profession area
     $profession = Input::get('profession');
     // graduate degree
     $degree = Input::get('degree');
     // studen card number
     $studentNum = Input::get('stu_num');
     // teacher name
     $thName = Input::get('th_name');
     // teacher phone
     $thPhone = Input::get('th_phone');
     // friend name 1
     $frName1 = Input::get('fr_name_1');
     // friend phone 1
     $frPhone1 = Input::get('fr_phone_1');
     // friend name 2
     $frName2 = Input::get('fr_name_2');
     // friend phone 2
     $frPhone2 = Input::get('fr_phone_2');
     $imgToken = Input::get('img_token', '');
     try {
         $user = User::chkUserByToken($token, $u_id);
         $user_contact_people = TmpUserProfileBase::find($u_id);
         if (!isset($user_contact_people->u_id)) {
             $user_contact_people = new TmpUserProfileBase();
         }
         if ($user_contact_people->u_status == 1) {
             throw new Exception("您的审核已经通过", 3002);
         }
         $user_contact_people->u_id = $u_id;
         $user_contact_people->u_teacher_name = $thName;
         $user_contact_people->u_teacher_telephone = $thPhone;
         $user_contact_people->u_frend_name1 = $frName1;
         $user_contact_people->u_frend_telephone1 = $frPhone1;
         $user_contact_people->u_frend_name2 = $frName2;
         $user_contact_people->u_frend_telephone2 = $frPhone2;
         $user_contact_people->u_student_number = $studentNum;
         $user_contact_people->u_school_id = $school;
         $user_contact_people->u_prof = $profession;
         $user_contact_people->u_degree = $degree;
         $user_contact_people->u_entry_year = $entryYear;
         $user_contact_people->register();
         if ($imgToken) {
             $imgObj = new Img('user', $imgToken);
             $imgs = $imgObj->getSavedImg($u_id, '', true);
             $student_img = [];
             foreach ($imgs as $k => $img) {
                 if ($k == 'student_img_front' || $k == 'student_img_back') {
                     $student_img[] = $img;
                 }
             }
             $user_contact_people->u_student_img = implode(',', $student_img);
             $user_contact_people->save();
         }
         $re = Tools::reTrue('提交学校信息成功');
     } catch (Exception $e) {
         TmpUserProfileBase::clearByUser($u_id);
         $re = Tools::reFalse($e->getCode(), '提交学校信息失败:' . $e->getMessage());
     }
     return Response::json($re);
 }
コード例 #2
0
 public function postUserBase()
 {
     $token = Input::get('token', '');
     $u_id = Input::get('u_id', 0);
     $name = Input::get('name', '');
     $id_num = Input::get('id_number', '');
     $id_school = Input::get('id_school', 0);
     $entry_year = Input::get('entry_year', '');
     $major = Input::get('major', '');
     $stu_num = Input::get('stu_num', '');
     $em_name = Input::get('emergency_name', '');
     $em_phoen = Input::get('emergency_phone', '');
     $father_name = Input::get('father_name', '');
     $age = Input::get('age', '');
     $father_phone = Input::get('father_phone', '');
     $mother_name = Input::get('mother_name', '');
     $mother_phone = Input::get('mother_phone', '');
     $apartment_no = Input::get('apartment_no', '');
     $birth = Input::get('birth', '');
     $mobile = Input::get('mobile', '');
     // club info
     $club_title = Input::get('club_title', '');
     $club_brief = Input::get('club_brief', '');
     $img_token = Input::get('img_token', '');
     $img_token_2 = Input::get('img_token_2', '');
     try {
         $user = User::chkUserByToken($token, $u_id);
         $profile = TmpUserProfileBase::find($u_id);
         if (empty($profile)) {
             $profile = new TmpUserProfileBase();
             $profile->u_id = $u_id;
         }
         if ($id_school) {
             $profile->s_id = $id_school;
             $user->u_school_id = $id_school;
         }
         if ($mobile) {
             $user->u_mobile = $mobile;
         }
         $user->u_name = $name;
         $user->u_age = $age;
         $user->u_birthday = $birth;
         $profile->u_id_number = $id_num;
         $profile->u_entry_year = $entry_year;
         $profile->u_major = $major;
         $profile->u_student_number = $stu_num;
         $profile->em_contact_phone = $em_phoen;
         $profile->em_contact_name = $em_name;
         $profile->u_father_name = $father_name;
         $profile->u_father_phone = $father_phone;
         $profile->u_mother_name = $mother_name;
         $profile->u_mother_phone = $mother_phone;
         $profile->u_apartment_no = $apartment_no;
         $profile->register();
         if ($img_token) {
             $imgObj = new Img('user', $img_token);
             $imgs = $imgObj->getSavedImg($u_id, implode(',', [$profile->u_id_imgs, $profile->u_student_imgs]), true);
             $stu_imgs = Img::filterKey('student_img_', $imgs);
             $id_imgs = Img::filterKey('identity_img_', $imgs);
             $profile->u_student_imgs = implode(',', $stu_imgs);
             $profile->u_id_imgs = implode(',', $id_imgs);
         }
         $this->saveClubInfo($user);
         $user->save();
         $profile->save();
         $re = Tools::reTrue('提交信息成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '提交信息失败:' . $e->getMessage());
     }
     return Response::json($re);
 }