isPost()) { $member_array = array(); $member_array['member_nickname'] = input('post.member_nickname'); $member_array['member_sex'] = input('post.member_sex'); $member_array['member_qq'] = input('post.member_qq'); $member_array['member_ww'] = input('post.member_ww'); $member_array['member_areaid'] = input('post.area_id'); $member_array['member_cityid'] = input('post.city_id'); $member_array['member_provinceid'] = input('post.province_id'); $member_array['member_areainfo'] = input('post.area_info'); if (strlen(input('post.birthday')) == 10) { $member_array['member_birthday'] = strtotime(input('post.birthday')); } $member_array['member_privacy'] = serialize(input('post.privacy/a')); $update = $member_model->editMember(array('member_id' => session('member_id')), $member_array,session('member_id')); if ($update){ ds_json_encode(10000,lang('ds_common_save_succ')); }else{ ds_json_encode(10001,lang('ds_common_save_fail')); } } if ($this->member_info['member_privacy'] != '') { $this->member_info['member_privacy'] = unserialize($this->member_info['member_privacy']); } else { $this->member_info['member_privacy'] = array(); }*/ /* View::assign('member_info', $this->member_info); $this->setMemberCurMenu('member_information'); $this->setMemberCurItem('member'); View::assign('menu_sign', 'profile'); View::assign('menu_sign_url', url('Memberinformation/index')); View::assign('menu_sign1', 'baseinfo');*/ if (request()->isPost()) { $member_id = session('member_id'); $data['first_name'] = input('post.first_name'); $data['middle_name'] = input('post.middle_name'); $data['last_name'] = input('post.last_name'); $data['year'] = input('post.year'); $data['month'] = input('post.month'); $data['day'] = input('post.day'); $data['gender'] = input('post.gender'); $data['email'] = input('post.email'); $data['citizenship'] = input('post.citizenship'); $data['birth_city'] = input('post.birth_city') ?? ''; $data['birth_country'] = input('post.birth_country') ?? ''; $data['is_visa'] = input('post.is_visa') ?? 'YES'; $data['permanent_state'] = input('post.permanent_state'); $data['permanent_city'] = input('post.permanent_city'); $data['permanent_street'] = input('post.permanent_street'); $data['permanent_code'] = input('post.permanent_code'); $data['is_current'] = input('post.is_current'); $data['current_state'] = input('post.current_state'); $data['current_city'] = input('post.current_city'); $data['current_street'] = input('post.current_street'); $data['current_code'] = input('post.current_code'); $data['emergency_last_name'] = input('post.emergency_last_name'); $data['emergency_first_name'] = input('post.emergency_first_name'); $data['emergency_relation'] = input('post.emergency_relation'); $data['emergency_telephone'] = input('post.emergency_telephone'); $data['university_name'] = input('post.university_name'); $data['university_degree'] = input('post.university_degree'); $data['university_major'] = input('post.university_major'); $data['university_date'] = input('post.university_date'); $data['employment_status'] = input('post.employment_status'); $data['industry'] = input('post.industry'); $data['employer'] = input('post.employer'); $data['occupation'] = input('post.occupation'); $data['experience_level'] = input('post.experience_level'); $data['current_employer'] = input('post.current_employer'); $data['highest_degree'] = input('post.highest_degree'); $data['university'] = input('post.university'); $data['field'] = input('post.field'); $data['a_student'] = input('post.a_student'); $data['experience_privacy'] = input('post.experience_privacy'); $data['is_submit'] = 0; $model = model('memberinfo'); $info = $model->getInfo(['member_id' => $member_id]); if (empty($info)) { $data['member_id'] = $member_id; $data['create_time'] = time(); $model->addInfo($data); header('location:/Memberinformation/index'); } else { $data['update_time'] = time(); $model->updateInfo($data, ['member_id' => $member_id]); header('location:/Memberinformation/index'); } } //查询学生信息 $member_id = session('member_id'); $model = model('memberinfo'); $info = $model->getInfo(['member_id' => $member_id]); //查询城市 $country = Db::name('country')->select()->toArray(); $c = array_column($country, 'country'); View::assign('info', $info); View::assign('country', $c); return View::fetch($this->template_dir . 'index'); } public function api() { if (request()->isPost()) { $member_id = session('member_id'); $data['first_name'] = input('post.first_name'); $data['middle_name'] = input('post.middle_name'); $data['last_name'] = input('post.last_name'); $data['year'] = input('post.year'); $data['month'] = input('post.month'); $data['day'] = input('post.day'); $data['gender'] = input('post.gender'); $data['email'] = input('post.email'); $data['citizenship'] = input('post.citizenship'); $data['permanent_state'] = input('post.permanent_state'); $data['permanent_city'] = input('post.permanent_city'); $data['permanent_street'] = input('post.permanent_street'); $data['permanent_code'] = input('post.permanent_code'); $data['is_current'] = input('post.is_current'); $data['current_state'] = input('post.current_state'); $data['current_city'] = input('post.current_city'); $data['current_street'] = input('post.current_street'); $data['current_code'] = input('post.current_code'); $data['emergency_last_name'] = input('post.emergency_last_name'); $data['emergency_first_name'] = input('post.emergency_first_name'); $data['emergency_relation'] = input('post.emergency_relation'); $data['emergency_telephone'] = input('post.emergency_telephone'); $data['university_name'] = input('post.university_name'); $data['university_degree'] = input('post.university_degree'); $data['university_major'] = input('post.university_major'); $data['university_date'] = input('post.university_date'); if (empty($data['first_name'])) { ds_json_encode(10001,'First Name cannot be empty'); } if (empty($data['middle_name'])) { // ds_json_encode(10001,'Middle Name cannot be empty'); } if (empty($data['last_name'])) { ds_json_encode(10001,'Last Name cannot be empty'); } if (empty($data['year'])) { ds_json_encode(10001,'Year cannot be empty'); } if (empty($data['month'])) { ds_json_encode(10001,'Month cannot be empty'); } if (empty($data['day'])) { ds_json_encode(10001,'Day cannot be empty'); } if (empty($data['gender'])) { ds_json_encode(10001,'Gender cannot be empty'); } if (empty($data['email'])) { ds_json_encode(10001,'Email Address cannot be empty'); } if (empty($data['citizenship'])) { ds_json_encode(10001,'Country of Citizenship cannot be empty'); } if (empty($data['permanent_state'])) { ds_json_encode(10001,'Permanent Home Country Address cannot be empty'); } if (empty($data['permanent_city'])) { ds_json_encode(10001,'Permanent Home Country Address cannot be empty'); } if (empty($data['permanent_street'])) { ds_json_encode(10001,'Permanent Home Country Address cannot be empty'); } if (empty($data['permanent_code'])) { ds_json_encode(10001,'Permanent Home Country Address cannot be empty'); } if (empty($data['emergency_last_name'])) { ds_json_encode(10001,'Emergency Contact Information cannot be empty'); } if (empty($data['emergency_first_name'])) { ds_json_encode(10001,'Emergency Contact Information cannot be empty'); } if (empty($data['emergency_relation'])) { ds_json_encode(10001,'Emergency Contact Information cannot be empty'); } if (empty($data['emergency_telephone'])) { ds_json_encode(10001,'Emergency Contact Information cannot be empty'); } if (empty($data['university_name'])) { ds_json_encode(10001,'University You Currently Attend cannot be empty'); } if (empty($data['university_degree'])) { ds_json_encode(10001,'University You Currently Attend cannot be empty'); } if (empty($data['university_major'])) { ds_json_encode(10001,'University You Currently Attend cannot be empty'); } if (empty($data['university_date'])) { ds_json_encode(10001,'University You Currently Attend cannot be empty'); } if ($data['is_current'] == "NO") { if (empty($data['current_state'])) { ds_json_encode(10001,'Current Adress cannot be empty'); } if (empty($data['current_city'])) { ds_json_encode(10001,'Current Adress cannot be empty'); } if (empty($data['current_street'])) { ds_json_encode(10001,'Current Adress cannot be empty'); } if (empty($data['current_code'])) { ds_json_encode(10001,'Current Adress cannot be empty'); } } $data['is_submit'] = 1; $model = model('memberinfo'); $info = $model->getInfo(['member_id' => $member_id]); if (empty($info)) { $data['member_id'] = $member_id; $data['create_time'] = time(); $model->addInfo($data); } else { $data['update_time'] = time(); $model->updateInfo($data, ['member_id' => $member_id]); } //发送邮件 $user = Db::name('member')->where(['member_id' => $member_id])->find(); $name = $user['member_name']; $mail = $user['member_email']; $message = " Dear $name Student,
Welcome again to $name! We have received your submitted information through the $name Registration Form.
$name is in contact with our partner host institution regarding your registration, and we will be in touch again soon with additional updates. Please note: this message is NOT a final confirmation of your registration; that will come later after we have completed your enrollment process with your potential host institution.
In the meantime, please double check your submitted information on the $name Registration Form. If you need to change anything or have any additional questions, please contact us at studentservice@lightglobal.org right away.
Thank you for including $name in your personal and professional development. We will be privileged to serve you throughout your learning journey!
Best regards,
$name
"; //发送邮件 $email = new \sendmsg\Email(); $rst = $email->send_sys_email($user['member_email'], 'LightCourse Email', $message); ds_json_encode(10000,'Success'); } } public function upload() { if (!request()->isPost()) { $this->redirect('memberinformation/avatar'); } $member_id = session('member_id'); //上传图片 if (!empty($_FILES['pic']['tmp_name'])) { $file_name = "avatar_" . session('member_id') . ".jpg"; $res = ds_upload_pic(ATTACH_AVATAR, 'pic', $file_name); if ($res['code']) { $file_name = $res['data']['file_name']; model('member')->editMember(array('member_id' => session('member_id')), array('member_avatar' => $file_name), session('member_id')); session('avatar', $file_name); /* 设置买家当前菜单 */ $this->setMemberCurMenu('member_information'); /* 设置买家当前栏目 */ $this->setMemberCurItem('avatar'); View::assign('menu_sign', 'profile'); View::assign('menu_sign_url', "{:(string)url('Memberinformation/index')}"); View::assign('menu_sign1', 'avatar'); return View::fetch($this->template_dir . 'avatar'); } else { $this->error($res['msg']); } } else { $this->error(lang('upload_failed_replace_pictures')); } } /** * 更换头像 * * @param * @return */ public function avatar() { $member_info = model('member')->getMemberInfoByID(session('member_id')); View::assign('member_avatar', $member_info['member_avatar']); /* 设置买家当前菜单 */ $this->setMemberCurMenu('member_information'); /* 设置买家当前栏目 */ $this->setMemberCurItem('avatar'); View::assign('menu_sign', 'profile'); View::assign('menu_sign_url', url('Memberinformation/index')); View::assign('menu_sign1', 'avatar'); View::assign('newfile', ''); return View::fetch($this->template_dir . 'avatar'); } /** * 用户中心右边,小导航 * * @param string $menu_type 导航类型 * @param string $menu_key 当前导航的menu_key * @return */ public function getMemberItemList() { $menu_array = array( array( 'name' => 'member', 'text' => lang('home_member_base_infomation'), 'url' => url('Memberinformation/index') ), array( 'name' => 'avatar', 'text' => lang('home_member_modify_avatar'), 'url' => url('Memberinformation/avatar') ) ); return $menu_array; } }