784 lines
41 KiB
PHP
784 lines
41 KiB
PHP
<?php
|
||
|
||
namespace app\home\controller;
|
||
|
||
use api\Httpcurl;
|
||
use think\facade\Config;
|
||
use think\facade\Db;
|
||
use think\facade\Log;
|
||
use think\facade\Request;
|
||
use think\facade\Session;
|
||
use think\facade\View;
|
||
|
||
class Visa extends Base
|
||
{
|
||
|
||
public function initialize()
|
||
{
|
||
parent::initialize();
|
||
View::assign('keytitle', 'evus登记-EVUS中文网');
|
||
View::assign('description', 'evus登记');
|
||
View::assign('keywords', 'EVUS中文网为您提供evus登记服务,方便您登记、办理evus,如登记中有任何问题可直接咨询。');
|
||
}
|
||
|
||
|
||
public function apply()
|
||
{
|
||
return View::fetch();
|
||
|
||
}
|
||
|
||
public function upvisa()
|
||
{
|
||
$order_sn = Request::param('order_sn');
|
||
$flag = Request::param('flag');
|
||
$flag = $flag == '1' ? 1 : 0;
|
||
if (empty($order_sn)) {
|
||
return $this->error('参数错误');
|
||
}
|
||
$data = Db::name('visa')->where(['order_sn' => $order_sn])->find();
|
||
$data['accom_people'] = $data['accom_people'] ? json_decode($data['accom_people'], true) : [];
|
||
$data['to_us_info'] = $data['to_us_info'] ? json_decode($data['to_us_info'], true) : [];
|
||
$data['job_info'] = $data['job_info'] ? json_decode($data['job_info'], true) : [];
|
||
$data['educational_info'] = $data['educational_info'] ? json_decode($data['educational_info'], true) : [];
|
||
$data['language'] = $data['language'] ? json_decode($data['language'], true) : [];
|
||
$data['other_countries'] = $data['other_countries'] ? json_decode($data['other_countries'], true) : [];
|
||
$data['province'] = $data['province'] ? $data['province'] : '北京市';
|
||
$data['city_birth'] = $data['city_birth'] ? $data['city_birth'] : '北京市';
|
||
$data['issue_province'] = $data['issue_province'] ? $data['issue_province'] : '北京市';
|
||
$data['issue_city'] = $data['issue_city'] ? $data['issue_city'] : '北京市';
|
||
$data['home_address_line_spr'] = $data['home_address_line_spr'] ? $data['home_address_line_spr'] : '北京市';
|
||
$data['home_address_line_city'] = $data['home_address_line_city'] ? $data['home_address_line_city'] : '北京市';
|
||
$data['mail_province'] = $data['mail_province'] ? $data['mail_province'] : '北京市';
|
||
$data['mail_city'] = $data['mail_city'] ? $data['mail_city'] : '北京市';
|
||
$data['paying_province'] = $data['paying_province'] ? $data['paying_province'] : '北京市';
|
||
$data['paying_city'] = $data['paying_city'] ? $data['paying_city'] : '北京市';
|
||
$data['paying_other_province'] = $data['paying_other_province'] ? $data['paying_other_province'] : '北京市';
|
||
$data['paying_other_city'] = $data['paying_other_city'] ? $data['paying_other_city'] : '北京市';
|
||
$data['driver_info'] = $data['driver_info'] ? json_decode($data['driver_info'], true) : [];
|
||
$data['professional'] = $data['professional'] ? json_decode($data['professional'], true) : [];
|
||
$data['military_country'] = $data['military_country'] ? json_decode($data['military_country'], true) : [];
|
||
$data['formers_info'] = $data['formers_info'] ? json_decode($data['formers_info'], true) : [];
|
||
$data['immediate_info'] = $data['immediate_info'] ? json_decode($data['immediate_info'], true) : [];
|
||
View::assign('data', $data);
|
||
View::assign('flag', $flag);
|
||
return View::fetch('upvisa');
|
||
}
|
||
|
||
public function submit()
|
||
{
|
||
$id = Request::param('order_sn');
|
||
if (empty($id)) {
|
||
return $this->error('参数不能为空!');
|
||
}
|
||
if (empty($_REQUEST['captcha'])) {
|
||
return $this->error('验证码不能为空!');
|
||
}
|
||
$verify = new \api\Verify();
|
||
if (!$verify->check($_REQUEST['captcha'], 1)) {
|
||
return $this->error('验证码错误!');
|
||
}
|
||
unset($_REQUEST['s'], $_REQUEST['file'], $_REQUEST['captcha']);
|
||
$res = Db::name('visa')->where(['order_sn' => $id])->find();
|
||
if (empty($res)) {
|
||
return $this->error('参数错误');
|
||
}
|
||
if (empty($res['is_effective'])) {
|
||
return $this->error('链接已失效');
|
||
}
|
||
//随行人员信息json
|
||
if (isset($_REQUEST['is_accom_people']) && $_REQUEST['is_accom_people'] == 1) {
|
||
$_REQUEST['accom_people'] = arrayToJson(['accom_people_last_name', 'accom_people_first_name', 'relationship'], [
|
||
$_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']
|
||
]);
|
||
unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
|
||
} else {
|
||
unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
|
||
}
|
||
if (isset($_REQUEST['is_to_us']) && $_REQUEST['is_to_us'] == 1) {
|
||
//去过美国信息
|
||
$_REQUEST['to_us_info'] = arrayToJson(['to_us_date', 'to_us_stay_date', 'to_us_stay_type'], [
|
||
$_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']
|
||
]);
|
||
unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
|
||
|
||
} else {
|
||
unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
|
||
|
||
}
|
||
//是否有驾照信息
|
||
if (isset($_REQUEST['is_us_driver']) && !empty($_REQUEST['is_us_driver'])) {
|
||
$_REQUEST['driver_info'] = arrayToJson(['driver_number', 'driver_state'], [
|
||
$_REQUEST['driver_number'], $_REQUEST['driver_state']
|
||
]);
|
||
unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
|
||
|
||
} else {
|
||
unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
|
||
}
|
||
if (isset($_REQUEST['is_job']) && $_REQUEST['is_job'] == 1) {
|
||
//你以前是否有过工作
|
||
$_REQUEST['job_info'] = arrayToJson([
|
||
'job_unit_name', 'job_country', 'job_province', 'job_city',
|
||
'job_first_address', 'job_second_address', 'job_mobile', 'job_zip_code',
|
||
'job_title', 'supervisor_last_name', 'supervisor_first_name', 'job_startime',
|
||
'job_endtime', 'job_response'
|
||
], [
|
||
$_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province'],
|
||
$_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address'],
|
||
$_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title'],
|
||
$_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime'],
|
||
$_REQUEST['job_endtime'], $_REQUEST['job_response']
|
||
]);
|
||
unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
|
||
unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
|
||
unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
|
||
unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
|
||
unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
|
||
} else {
|
||
unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
|
||
unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
|
||
unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
|
||
unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
|
||
unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
|
||
}
|
||
if (isset($_REQUEST['is_educational']) && $_REQUEST['is_educational'] == 1) {
|
||
//你是否曾就读于任何中学或以上程度的教育机构
|
||
$_REQUEST['educational_info'] = arrayToJson([
|
||
'edu_name', 'edu_country', 'edu_province', 'edu_city',
|
||
'edu_first_address', 'edu_second_address', 'edu_zip_code', 'edu_course', 'edu_startime', 'edu_endtime'
|
||
], [
|
||
$_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city'],
|
||
$_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime'],
|
||
]);
|
||
unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
|
||
unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
|
||
|
||
} else {
|
||
unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
|
||
unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
|
||
|
||
}
|
||
if (isset($_REQUEST['language']) && !empty($_REQUEST['language'])) {
|
||
//请提供你所使用的语言
|
||
$language = array_filter($_REQUEST['language']);
|
||
if (empty($language)) {
|
||
$_REQUEST['language'] = '';
|
||
} else {
|
||
$_REQUEST['language'] = json_encode($language);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['language']);
|
||
}
|
||
if (isset($_REQUEST['professional']) && !empty($_REQUEST['professional'])) {
|
||
//请提供你所使用的语言
|
||
$language = array_filter($_REQUEST['professional']);
|
||
if (empty($language)) {
|
||
$_REQUEST['professional'] = '';
|
||
} else {
|
||
$_REQUEST['professional'] = json_encode($language);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['professional']);
|
||
}
|
||
//服役的国家
|
||
if (isset($_REQUEST['military_country']) && !empty($_REQUEST['military_country'])) {
|
||
|
||
$_REQUEST['military_country'] = arrayToJson([
|
||
'military_country', 'services', 'military_rank', 'military_specialties', 'military_start_date', 'military_end_date'
|
||
], [
|
||
$_REQUEST['military_country'], $_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']
|
||
]);
|
||
unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
|
||
} else {
|
||
unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
|
||
}
|
||
//美国是否有不包括父母在内的直系亲属
|
||
if (isset($_REQUEST['is_immediate']) && !empty($_REQUEST['is_immediate'])) {
|
||
|
||
$_REQUEST['immediate_info'] = arrayToJson([
|
||
'immediate_last_name', 'immediate_first_name', 'you_ship', 'identity'
|
||
], [
|
||
$_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']
|
||
]);
|
||
unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
|
||
} else {
|
||
unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
|
||
}
|
||
|
||
if (isset($_REQUEST['is_other_countries']) && $_REQUEST['is_other_countries'] == 1) {
|
||
$other_countries = array_filter($_REQUEST['other_countries']);
|
||
if (empty($other_countries)) {
|
||
$_REQUEST['other_countries'] = '';
|
||
} else {
|
||
$_REQUEST['other_countries'] = json_encode($other_countries);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['other_countries']);
|
||
}
|
||
if ($_REQUEST['marital'] == 'D' && !empty($_REQUEST['formers_last_name'])) {
|
||
//婚姻状况选择“离异”时 增加前任信息
|
||
$_REQUEST['formers_info'] = arrayToJson([
|
||
'formers_last_name', 'formers_first_name', 'formers_birth_date', 'formers_nationality',
|
||
'formers_birth_country', 'formers_birth_city', 'formers_marriage_date', 'formers_marriage_end_date',
|
||
'formers_marriage_end_explain', 'formers_marriage_end_country',
|
||
], [
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'], $_REQUEST['formers_nationality'],
|
||
$_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'], $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'],
|
||
$_REQUEST['formers_marriage_end_explain'], $_REQUEST['formers_marriage_end_country']
|
||
]);
|
||
unset(
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
|
||
$_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
|
||
$_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
|
||
$_REQUEST['formers_marriage_end_country']
|
||
);
|
||
} else {
|
||
unset(
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
|
||
$_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
|
||
$_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
|
||
$_REQUEST['formers_marriage_end_country']
|
||
);
|
||
}
|
||
// var_dump($_REQUEST);exit;
|
||
for ($i = 1; $i < 28; $i++) {
|
||
unset($_REQUEST['safety' . $i]);
|
||
}
|
||
$_REQUEST['visa_cate'] = getCate($_REQUEST['visa_detail']);
|
||
$_REQUEST['is_effective'] = 0;
|
||
$_REQUEST['progress'] = 100;
|
||
$resd = Db::name('visa')->where(['order_sn' => $id])->update($_REQUEST);
|
||
if ($resd !== false) {
|
||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cbe82d37-ede8-474b-81dc-1ca7dcf56d80';
|
||
$datas = array('msgtype' => 'text', 'text' => [
|
||
'content' => "订单号:{$res['order_sn']},姓名:{$_REQUEST['last_name_zn']}{$_REQUEST['first_name_zn']}美签表单已提交,请及时审核",
|
||
]);
|
||
Httpcurl::request($url, 'post', json_encode($datas), [
|
||
'Content-Type: application/json'
|
||
]);
|
||
|
||
return $this->success("提交成功", url('visa/upvisa')->build());
|
||
} else {
|
||
return $this->error('提交失败!');
|
||
}
|
||
}
|
||
|
||
public function saves()
|
||
{
|
||
$verify = new \api\Verify();
|
||
$id = Request::param('order_sn');
|
||
if (empty($id)) {
|
||
return $this->error('参数不能为空!');
|
||
}
|
||
if (empty($_REQUEST['captcha'])) {
|
||
return $this->error('验证码不能为空!');
|
||
}
|
||
if (!$verify->check($_REQUEST['captcha'], 1)) {
|
||
return $this->error('验证码错误!');
|
||
}
|
||
unset($_REQUEST['s'], $_REQUEST['file'], $_REQUEST['captcha']);
|
||
$res = Db::name('visa')->where(['order_sn' => $id])->find();
|
||
if (empty($res)) {
|
||
return $this->error('参数错误');
|
||
}
|
||
$ip = getIp();
|
||
Log::write('ip:' . $ip . '=====id:' . $id);
|
||
$disableips = Config::get('disable_ip');
|
||
if (in_array($ip, $disableips)) {
|
||
return $this->error('非法请求');
|
||
}
|
||
|
||
if (empty($res['is_effective'])) {
|
||
return $this->error('链接已失效');
|
||
}
|
||
//随行人员信息json
|
||
if (isset($_REQUEST['is_accom_people']) && $_REQUEST['is_accom_people'] == 1) {
|
||
$_REQUEST['accom_people'] = arrayToJson(['accom_people_last_name', 'accom_people_first_name', 'relationship'], [
|
||
$_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']
|
||
]);
|
||
unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
|
||
} else {
|
||
unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
|
||
}
|
||
if (isset($_REQUEST['is_to_us']) && $_REQUEST['is_to_us'] == 1) {
|
||
//去过美国信息
|
||
$_REQUEST['to_us_info'] = arrayToJson(['to_us_date', 'to_us_stay_date', 'to_us_stay_type'], [
|
||
$_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']
|
||
]);
|
||
unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
|
||
|
||
} else {
|
||
unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
|
||
|
||
}
|
||
//是否有驾照信息
|
||
if (isset($_REQUEST['is_us_driver']) && !empty($_REQUEST['is_us_driver'])) {
|
||
$_REQUEST['driver_info'] = arrayToJson(['driver_number', 'driver_state'], [
|
||
$_REQUEST['driver_number'], $_REQUEST['driver_state']
|
||
]);
|
||
unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
|
||
|
||
} else {
|
||
unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
|
||
}
|
||
if (isset($_REQUEST['is_job']) && $_REQUEST['is_job'] == 1) {
|
||
//你以前是否有过工作
|
||
$_REQUEST['job_info'] = arrayToJson([
|
||
'job_unit_name', 'job_country', 'job_province', 'job_city',
|
||
'job_first_address', 'job_second_address', 'job_mobile', 'job_zip_code',
|
||
'job_title', 'supervisor_last_name', 'supervisor_first_name', 'job_startime',
|
||
'job_endtime', 'job_response'
|
||
], [
|
||
$_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province'],
|
||
$_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address'],
|
||
$_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title'],
|
||
$_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime'],
|
||
$_REQUEST['job_endtime'], $_REQUEST['job_response']
|
||
]);
|
||
unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
|
||
unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
|
||
unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
|
||
unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
|
||
unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
|
||
} else {
|
||
unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
|
||
unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
|
||
unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
|
||
unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
|
||
unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
|
||
}
|
||
if (isset($_REQUEST['is_educational']) && $_REQUEST['is_educational'] == 1) {
|
||
//你是否曾就读于任何中学或以上程度的教育机构
|
||
$_REQUEST['educational_info'] = arrayToJson([
|
||
'edu_name', 'edu_country', 'edu_province', 'edu_city',
|
||
'edu_first_address', 'edu_second_address', 'edu_zip_code', 'edu_course', 'edu_startime', 'edu_endtime'
|
||
], [
|
||
$_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city'],
|
||
$_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime'],
|
||
]);
|
||
unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
|
||
unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
|
||
|
||
} else {
|
||
unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
|
||
unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
|
||
|
||
}
|
||
if (isset($_REQUEST['language']) && !empty($_REQUEST['language'])) {
|
||
//请提供你所使用的语言
|
||
$language = array_filter($_REQUEST['language']);
|
||
if (empty($language)) {
|
||
$_REQUEST['language'] = '';
|
||
} else {
|
||
$_REQUEST['language'] = json_encode($language);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['language']);
|
||
}
|
||
if (isset($_REQUEST['professional']) && !empty($_REQUEST['professional'])) {
|
||
//请提供你所使用的语言
|
||
$language = array_filter($_REQUEST['professional']);
|
||
if (empty($language)) {
|
||
$_REQUEST['professional'] = '';
|
||
} else {
|
||
$_REQUEST['professional'] = json_encode($language);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['professional']);
|
||
}
|
||
//服役的国家
|
||
if (isset($_REQUEST['military_country']) && !empty($_REQUEST['military_country'])) {
|
||
|
||
$_REQUEST['military_country'] = arrayToJson([
|
||
'military_country', 'services', 'military_rank', 'military_specialties', 'military_start_date', 'military_end_date'
|
||
], [
|
||
$_REQUEST['military_country'], $_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']
|
||
]);
|
||
unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
|
||
} else {
|
||
unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
|
||
}
|
||
//美国是否有不包括父母在内的直系亲属
|
||
if (isset($_REQUEST['is_immediate']) && !empty($_REQUEST['is_immediate'])) {
|
||
|
||
$_REQUEST['immediate_info'] = arrayToJson([
|
||
'immediate_last_name', 'immediate_first_name', 'you_ship', 'identity'
|
||
], [
|
||
$_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']
|
||
]);
|
||
unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
|
||
} else {
|
||
unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
|
||
}
|
||
|
||
if (isset($_REQUEST['is_other_countries']) && $_REQUEST['is_other_countries'] == 1) {
|
||
$other_countries = array_filter($_REQUEST['other_countries']);
|
||
if (empty($other_countries)) {
|
||
$_REQUEST['other_countries'] = '';
|
||
} else {
|
||
$_REQUEST['other_countries'] = json_encode($other_countries);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['other_countries']);
|
||
}
|
||
if ($_REQUEST['marital'] == 'D' && !empty($_REQUEST['formers_last_name'])) {
|
||
//婚姻状况选择“离异”时 增加前任信息
|
||
$_REQUEST['formers_info'] = arrayToJson([
|
||
'formers_last_name', 'formers_first_name', 'formers_birth_date', 'formers_nationality',
|
||
'formers_birth_country', 'formers_birth_city', 'formers_marriage_date', 'formers_marriage_end_date',
|
||
'formers_marriage_end_explain', 'formers_marriage_end_country',
|
||
], [
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'], $_REQUEST['formers_nationality'],
|
||
$_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'], $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'],
|
||
$_REQUEST['formers_marriage_end_explain'], $_REQUEST['formers_marriage_end_country']
|
||
]);
|
||
unset(
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
|
||
$_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
|
||
$_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
|
||
$_REQUEST['formers_marriage_end_country']
|
||
);
|
||
} else {
|
||
unset(
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
|
||
$_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
|
||
$_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
|
||
$_REQUEST['formers_marriage_end_country']
|
||
);
|
||
}
|
||
// var_dump($_REQUEST);exit;
|
||
for ($i = 1; $i < 28; $i++) {
|
||
unset($_REQUEST['safety' . $i]);
|
||
}
|
||
$_REQUEST['visa_cate'] = getCate($_REQUEST['visa_detail']);
|
||
$res = Db::name('visa')->where(['order_sn' => $id])->update($_REQUEST);
|
||
if ($res !== false) {
|
||
return $this->success("提交成功", url('visa/upvisa')->build());
|
||
} else {
|
||
return $this->error('提交失败!');
|
||
}
|
||
}
|
||
|
||
public function zancun()
|
||
{
|
||
$id = Request::param('order_sn');
|
||
if (empty($id)) {
|
||
return $this->error('参数不能为空!');
|
||
}
|
||
|
||
unset($_REQUEST['s'], $_REQUEST['file'], $_REQUEST['captcha']);
|
||
$res = Db::name('visa')->where(['order_sn' => $id])->find();
|
||
if (empty($res)) {
|
||
return $this->error('参数错误');
|
||
}
|
||
$ip = getIp();
|
||
Log::write('ip:' . $ip . '=====id:' . $id);
|
||
$disableips = Config::get('disable_ip');
|
||
if (in_array($ip, $disableips)) {
|
||
return $this->error('非法请求');
|
||
}
|
||
|
||
if (empty($res['is_effective'])) {
|
||
return $this->error('链接已失效');
|
||
}
|
||
//随行人员信息json
|
||
if (isset($_REQUEST['is_accom_people']) && $_REQUEST['is_accom_people'] == 1) {
|
||
$_REQUEST['accom_people'] = arrayToJson(['accom_people_last_name', 'accom_people_first_name', 'relationship'], [
|
||
$_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']
|
||
]);
|
||
unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
|
||
} else {
|
||
unset($_REQUEST['accom_people_last_name'], $_REQUEST['accom_people_first_name'], $_REQUEST['relationship']);
|
||
}
|
||
if (isset($_REQUEST['is_to_us']) && $_REQUEST['is_to_us'] == 1) {
|
||
//去过美国信息
|
||
$_REQUEST['to_us_info'] = arrayToJson(['to_us_date', 'to_us_stay_date', 'to_us_stay_type'], [
|
||
$_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']
|
||
]);
|
||
unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
|
||
|
||
} else {
|
||
unset($_REQUEST['to_us_date'], $_REQUEST['to_us_stay_date'], $_REQUEST['to_us_stay_type']);
|
||
|
||
}
|
||
//是否有驾照信息
|
||
if (isset($_REQUEST['is_us_driver']) && !empty($_REQUEST['is_us_driver'])) {
|
||
$_REQUEST['driver_info'] = arrayToJson(['driver_number', 'driver_state'], [
|
||
$_REQUEST['driver_number'], $_REQUEST['driver_state']
|
||
]);
|
||
unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
|
||
|
||
} else {
|
||
unset($_REQUEST['driver_number'], $_REQUEST['driver_state']);
|
||
}
|
||
if (isset($_REQUEST['is_job']) && $_REQUEST['is_job'] == 1) {
|
||
//你以前是否有过工作
|
||
$_REQUEST['job_info'] = arrayToJson([
|
||
'job_unit_name', 'job_country', 'job_province', 'job_city',
|
||
'job_first_address', 'job_second_address', 'job_mobile', 'job_zip_code',
|
||
'job_title', 'supervisor_last_name', 'supervisor_first_name', 'job_startime',
|
||
'job_endtime', 'job_response'
|
||
], [
|
||
$_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province'],
|
||
$_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address'],
|
||
$_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title'],
|
||
$_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime'],
|
||
$_REQUEST['job_endtime'], $_REQUEST['job_response']
|
||
]);
|
||
unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
|
||
unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
|
||
unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
|
||
unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
|
||
unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
|
||
} else {
|
||
unset($_REQUEST['job_unit_name'], $_REQUEST['job_country'], $_REQUEST['job_province']);
|
||
unset($_REQUEST['job_city'], $_REQUEST['job_first_address'], $_REQUEST['job_second_address']);
|
||
unset($_REQUEST['job_mobile'], $_REQUEST['job_zip_code'], $_REQUEST['job_title']);
|
||
unset($_REQUEST['supervisor_last_name'], $_REQUEST['supervisor_first_name'], $_REQUEST['job_startime']);
|
||
unset($_REQUEST['job_endtime'], $_REQUEST['job_response']);
|
||
}
|
||
if (isset($_REQUEST['is_educational']) && $_REQUEST['is_educational'] == 1) {
|
||
//你是否曾就读于任何中学或以上程度的教育机构
|
||
$_REQUEST['educational_info'] = arrayToJson([
|
||
'edu_name', 'edu_country', 'edu_province', 'edu_city',
|
||
'edu_first_address', 'edu_second_address', 'edu_zip_code', 'edu_course', 'edu_startime', 'edu_endtime'
|
||
], [
|
||
$_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city'],
|
||
$_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime'],
|
||
]);
|
||
unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
|
||
unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
|
||
|
||
} else {
|
||
unset($_REQUEST['edu_name'], $_REQUEST['edu_country'], $_REQUEST['edu_province'], $_REQUEST['edu_city']);
|
||
unset($_REQUEST['edu_first_address'], $_REQUEST['edu_second_address'], $_REQUEST['edu_zip_code'], $_REQUEST['edu_course'],
|
||
$_REQUEST['edu_startime'], $_REQUEST['edu_endtime']);
|
||
|
||
}
|
||
if (isset($_REQUEST['language']) && !empty($_REQUEST['language'])) {
|
||
//请提供你所使用的语言
|
||
$language = array_filter($_REQUEST['language']);
|
||
if (empty($language)) {
|
||
$_REQUEST['language'] = '';
|
||
} else {
|
||
$_REQUEST['language'] = json_encode($language);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['language']);
|
||
}
|
||
if (isset($_REQUEST['professional']) && !empty($_REQUEST['professional'])) {
|
||
//请提供你所使用的语言
|
||
$language = array_filter($_REQUEST['professional']);
|
||
if (empty($language)) {
|
||
$_REQUEST['professional'] = '';
|
||
} else {
|
||
$_REQUEST['professional'] = json_encode($language);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['professional']);
|
||
}
|
||
//服役的国家
|
||
if (isset($_REQUEST['military_country']) && !empty($_REQUEST['military_country'])) {
|
||
|
||
$_REQUEST['military_country'] = arrayToJson([
|
||
'military_country', 'services', 'military_rank', 'military_specialties', 'military_start_date', 'military_end_date'
|
||
], [
|
||
$_REQUEST['military_country'], $_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']
|
||
]);
|
||
unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
|
||
} else {
|
||
unset($_REQUEST['services'], $_REQUEST['military_rank'], $_REQUEST['military_specialties'], $_REQUEST['military_start_date'], $_REQUEST['military_end_date']);
|
||
}
|
||
//美国是否有不包括父母在内的直系亲属
|
||
if (isset($_REQUEST['is_immediate']) && !empty($_REQUEST['is_immediate'])) {
|
||
|
||
$_REQUEST['immediate_info'] = arrayToJson([
|
||
'immediate_last_name', 'immediate_first_name', 'you_ship', 'identity'
|
||
], [
|
||
$_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']
|
||
]);
|
||
unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
|
||
} else {
|
||
unset($_REQUEST['immediate_last_name'], $_REQUEST['immediate_first_name'], $_REQUEST['you_ship'], $_REQUEST['identity']);
|
||
}
|
||
|
||
if (isset($_REQUEST['is_other_countries']) && $_REQUEST['is_other_countries'] == 1) {
|
||
$other_countries = array_filter($_REQUEST['other_countries']);
|
||
if (empty($other_countries)) {
|
||
$_REQUEST['other_countries'] = '';
|
||
} else {
|
||
$_REQUEST['other_countries'] = json_encode($other_countries);
|
||
}
|
||
|
||
} else {
|
||
unset($_REQUEST['other_countries']);
|
||
}
|
||
if ($_REQUEST['marital'] == 'D' && !empty($_REQUEST['formers_last_name'])) {
|
||
//婚姻状况选择“离异”时 增加前任信息
|
||
$_REQUEST['formers_info'] = arrayToJson([
|
||
'formers_last_name', 'formers_first_name', 'formers_birth_date', 'formers_nationality',
|
||
'formers_birth_country', 'formers_birth_city', 'formers_marriage_date', 'formers_marriage_end_date',
|
||
'formers_marriage_end_explain', 'formers_marriage_end_country',
|
||
], [
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'], $_REQUEST['formers_nationality'],
|
||
$_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'], $_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'],
|
||
$_REQUEST['formers_marriage_end_explain'], $_REQUEST['formers_marriage_end_country']
|
||
]);
|
||
unset(
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
|
||
$_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
|
||
$_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
|
||
$_REQUEST['formers_marriage_end_country']
|
||
);
|
||
} else {
|
||
unset(
|
||
$_REQUEST['formers_last_name'], $_REQUEST['formers_first_name'], $_REQUEST['formers_birth_date'],
|
||
$_REQUEST['formers_nationality'], $_REQUEST['formers_birth_country'], $_REQUEST['formers_birth_city'],
|
||
$_REQUEST['formers_marriage_date'], $_REQUEST['formers_marriage_end_date'], $_REQUEST['formers_marriage_end_explain'],
|
||
$_REQUEST['formers_marriage_end_country']
|
||
);
|
||
}
|
||
// var_dump($_REQUEST);exit;
|
||
for ($i = 1; $i < 28; $i++) {
|
||
unset($_REQUEST['safety' . $i]);
|
||
}
|
||
$_REQUEST['visa_cate'] = getCate($_REQUEST['visa_detail']);
|
||
$res = Db::name('visa')->where(['order_sn' => $id])->update($_REQUEST);
|
||
if ($res !== false) {
|
||
return $this->success("提交成功", url('visa/upvisa')->build());
|
||
} else {
|
||
return $this->error('提交失败!');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 跳转到pc
|
||
*/
|
||
public function feepay()
|
||
{
|
||
$cfg = Config::get('wxpayvisa');
|
||
$app = Factory::payment($cfg);
|
||
$order_sn = Request::param('order_sn');
|
||
|
||
//判断支付是否已完成
|
||
$pay_result = Db::name('visa')->where(['order_sn' => $order_sn])->find();
|
||
if (empty($pay_result)) {
|
||
return ajaxReturn([
|
||
'code' => 0,
|
||
'msg' => '订单号错误',
|
||
]);
|
||
}
|
||
$order_sn = 'visa' . $order_sn;
|
||
$result = $app->order->unify([
|
||
'body' => '美国签证登记服务费',
|
||
'out_trade_no' => $order_sn,
|
||
'total_fee' => $pay_result['other_fee'],
|
||
'trade_type' => 'NATIVE',
|
||
'product_id' => $order_sn, // $message['product_id'] 则为生成二维码时的产品 ID
|
||
// ...
|
||
]);
|
||
if (!isset($result['result_code']) || ($result['result_code'] == 'FAIL')) {
|
||
return $this->error('初始化支付异常,请稍后重试');
|
||
}
|
||
$url = "/uploads/qrcode/{$order_sn}.png";
|
||
QRcode::png($result['code_url'], "." . $url, 'L', 4, 2);
|
||
|
||
//判断文件是否存在
|
||
if (!is_file("." . $url)) {
|
||
return ajaxReturn([
|
||
'code' => 0,
|
||
'msg' => '请重新支付',
|
||
]);
|
||
}
|
||
return ajaxReturn([
|
||
'code' => 1,
|
||
'msg' => '提交成功',
|
||
'data' => $url
|
||
]);
|
||
return $this->success('');
|
||
|
||
}
|
||
|
||
/**
|
||
* @return void
|
||
* 请求姓名电码
|
||
*/
|
||
public function telecode()
|
||
{
|
||
$last_name_zn = Request::param('last_name_zn');
|
||
$first_name_zn = Request::param('first_name_zn');
|
||
if (empty($last_name_zn) || empty($first_name_zn)) {
|
||
return $this->error("姓名为空");
|
||
}
|
||
try {
|
||
$res = queryNameTelecode($last_name_zn . $first_name_zn, mb_strlen($last_name_zn, 'UTF-8'));
|
||
} catch (\InvalidArgumentException $e) {
|
||
return $this->error($e->getMessage());
|
||
} catch (\RuntimeException $e) {
|
||
return $this->error($e->getMessage());
|
||
} catch (\Throwable $e) {
|
||
return $this->error("电码查询暂时不可用,请稍后重试或手动填写");
|
||
}
|
||
// 保持前端字段和每个汉字四位电码之间的空格,保留前导零。
|
||
return $this->success("请求成功", '', [
|
||
'code_last_name' => implode(' ', str_split($res['surname_code'], 4)),
|
||
'code_first_name' => implode(' ', str_split($res['given_name_code'], 4)),
|
||
]);
|
||
}
|
||
|
||
|
||
/**
|
||
* @return void
|
||
* 请求姓名电码
|
||
*/
|
||
public function addprocess()
|
||
{
|
||
$process = Request::param('process');
|
||
$order_sn = Request::param('order_sn');
|
||
if (empty($process) || empty($order_sn)) {
|
||
return $this->error("参数错误");
|
||
}
|
||
$order = Db::name('visa')->where(['order_sn' => $order_sn])->find();
|
||
if (empty($order)) {
|
||
return $this->error("订单不存在");
|
||
}
|
||
if ($order['progress'] > $process) {
|
||
return $this->error("进度已存在");
|
||
}
|
||
Db::name('visa')->where(['order_sn' => $order_sn])->update([
|
||
'progress' => $process,
|
||
]);
|
||
return $this->success("请求成功");
|
||
}
|
||
|
||
public function upsucc()
|
||
{
|
||
// $order_sn = Session::get('visa_order_sn');
|
||
// View::assign('order_sn',$order_sn);
|
||
return View::fetch('upsucc');
|
||
}
|
||
|
||
public function verify()
|
||
{
|
||
$verify = new \api\Verify();
|
||
$verify->entry(1);
|
||
}
|
||
}
|