提交
This commit is contained in:
70
app/home/controller/Visa.php
Normal file
70
app/home/controller/Visa.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\home\controller;
|
||||
|
||||
use api\Httpcurl;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Log;
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class Visa extends Base
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
View::assign('nation', json_decode(file_get_contents(CONFIG_JSON_VISA_NATIONALITY), true));
|
||||
View::assign('ismobile', isMobile() ? 1 : 0);
|
||||
return View::fetch();
|
||||
}
|
||||
public function get_sub_city(Request $request)
|
||||
{
|
||||
$id = $request->param('id');
|
||||
$city = find_json(CONFIG_JSON_STATE, 'id', $id);
|
||||
if ($city) {
|
||||
return $this->success('成功', '', $city[0]);
|
||||
} else {
|
||||
return $this->success('成功', '', []);
|
||||
}
|
||||
}
|
||||
|
||||
public function do_apply()
|
||||
{
|
||||
$request = $this->request;
|
||||
$data = $request->post();
|
||||
$order_sn = getOrderNumber();
|
||||
unset($data['check1']);
|
||||
unset($data['check2']);
|
||||
|
||||
$data['model'] = MODEL;
|
||||
$data['token'] = md5(MODEL);
|
||||
$data['order_sn'] = $order_sn;
|
||||
$data['source'] = Session::get('source');
|
||||
$data['is_mobile'] = isMobile();
|
||||
|
||||
/*处理 map */
|
||||
$nationality_map = json_decode(file_get_contents(CONFIG_JSON_NATIONALITY_MAP), true) ?? [];
|
||||
$data['nation'] = $nationality_map[$data['nation']] ?? $data['nation'];
|
||||
|
||||
$order_res = Httpcurl::request(config('app.CREATE_ORDER_URL'), 'post', $data);
|
||||
$order = json_decode($order_res[0], true);
|
||||
Log::info(json_encode($order));
|
||||
if (!$order['code']) {
|
||||
return $this->error(lang('controller.submission_failed'));
|
||||
}
|
||||
Session::set('order_sn', $order_sn);
|
||||
Session::set('total_price', $data['total_price']);
|
||||
$url = url('wepay/pcpay', ['order_sn' => $order_sn]);
|
||||
if (isMobile()) {
|
||||
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) {
|
||||
$url = url('wepay/wxpay', ['order_sn' => $order_sn]);
|
||||
}else{
|
||||
$url = url('wepay/h5pay', ['order_sn' => $order_sn]);
|
||||
}
|
||||
|
||||
}
|
||||
return $this->success(lang('controller.success'), $url);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user