Files
evus.acvisa.com/app/home/controller/Lookup.php

54 lines
1.6 KiB
PHP

<?php
namespace app\home\controller;
use api\Httpcurl;
use think\facade\Db;
use think\facade\Log;
use think\facade\Request;
use think\facade\View;
class Lookup extends Base
{
public function index()
{
View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
return View::fetch();
}
public function enrollment()
{
$data = Request::instance()->param();
$params = [
'passportNum' => $data['passport_number'],
'b1b2Num' => $data['visa_foil_number'],
'surname' => $data['last_name'],
'givenname' => $data['first_name'],
'year_birthday' => (string)date_parse($data['birth_date'])['year'],
'month_birthday' => (string)date_parse($data['birth_date'])['month'],
'day_birthday' => (string)date_parse($data['birth_date'])['day'],
'country_birth' => $data['country_birth'],
];
$result = Httpcurl::request(config('app.LOOKUP_URL'), 'post', json_encode($params),[
'Content-Type: application/json',
]);
$config_result = json_decode($result[0], true);
if (empty($config_result)) {
return json([
'error_code'=>22,
'msg'=>"服务器错误,请稍后重试"
]);
}
return json($config_result);
}
/**
* 微信小程序专用
*/
public function wxmini()
{
View::assign('country_list', json_decode(file_get_contents('./json/country.json'), true));
return View::fetch();
}
}