修复EVUS子目录访问及H5支付返回流程
This commit is contained in:
@@ -23,6 +23,7 @@ const ESTA_COUNTRY = 'ESTA登记';
|
||||
const PAY_ESTA_MARK = 'estacn';
|
||||
const ESTA_MODEL = 'esta';
|
||||
const ESTA_INCOICETYPE = '6';
|
||||
const BASE_PATH = '/evus'; // 可后端模板注入
|
||||
|
||||
|
||||
// 公共函数
|
||||
|
||||
@@ -100,6 +100,7 @@ class Base extends BaseController
|
||||
View::assign('order_kefu', $config_result['data']['visa_png']);
|
||||
View::assign('invoice_url', $config_result['data']['invoice_url']);
|
||||
View::assign('menu_url', strtolower(Request::controller() . '/' . Request::action()));
|
||||
View::assign('base_path', BASE_PATH);
|
||||
$this->assignSeo();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ class Esta extends Base
|
||||
View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
|
||||
View::assign('goods', config('app.ESTA_GOODS'));
|
||||
View::assign('ismobile', isMobile() ? 1 : 0);
|
||||
View::assign('ppt_sample_url', '/new/assets/images/shili.jpg');
|
||||
View::assign('per_sample_url', '/new/assets/images/persion2.png');
|
||||
View::assign('ppt_sample_url', BASE_PATH . '/new/assets/images/shili.jpg');
|
||||
View::assign('per_sample_url', BASE_PATH . '/new/assets/images/persion2.png');
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
@@ -125,8 +125,8 @@ class Esta extends Base
|
||||
View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
|
||||
View::assign('goods', config('app.ESTA_GOODS'));
|
||||
View::assign('ismobile', isMobile() ? 1 : 0);
|
||||
View::assign('ppt_sample_url', '/new/assets/images/shili.jpg');
|
||||
View::assign('per_sample_url', '/new/assets/images/persion2.png');
|
||||
View::assign('ppt_sample_url', BASE_PATH . '/new/assets/images/shili.jpg');
|
||||
View::assign('per_sample_url', BASE_PATH . '/new/assets/images/persion2.png');
|
||||
return View::fetch();
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class Invoice extends Base
|
||||
{
|
||||
parent::initialize();
|
||||
if (!Session::has('user') || Session::get('user')['id'] <= 0) {
|
||||
throw new HttpResponseException(redirect('/home/login'));
|
||||
throw new HttpResponseException(redirect(url('home/login/index')->build()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class Invoice extends Base
|
||||
}
|
||||
$res['status'] = 1;
|
||||
$res['msg'] = $pay_result['msg'];
|
||||
$res['url'] = '/home/user/order';
|
||||
$res['url'] = url('home/user/order')->build();
|
||||
return json($res);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,6 @@ class Login extends Base
|
||||
public function logout()
|
||||
{
|
||||
Session::delete('user');
|
||||
return redirect('/home/index');
|
||||
return redirect(url('home/index/index')->build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ class Multiple extends Base
|
||||
$res = [
|
||||
'status' => 1,
|
||||
'msg' => '操作成功',
|
||||
'url' => '/home/user/order'
|
||||
'url' => url('home/user/order')->build()
|
||||
];
|
||||
return json($res);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class Pay extends Base
|
||||
]);
|
||||
}
|
||||
$pay_result = $pay_result['data'];
|
||||
if ($pay_result['pay_status']) {
|
||||
if (in_array($pay_result['pay_status'] ?? null, [1, '1'], true)) {
|
||||
return json([
|
||||
'status' => 1,
|
||||
'msg' => '支付成功',
|
||||
@@ -184,6 +184,10 @@ class Pay extends Base
|
||||
'url' => url('pay/h5pay', ['order_sn' => $order_sn])->build()
|
||||
]);
|
||||
}
|
||||
View::assign('order_sn', $this->order_sn);
|
||||
View::assign('payment_label', 'EVUS');
|
||||
View::assign('payment_check_url', url('home/pay/h5result', ['order_sn' => $this->order_sn])->build());
|
||||
View::assign('payment_success_url', url('home/pay/succ', ['order_sn' => $this->order_sn])->build());
|
||||
return View::fetch();
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class Payesta extends Base
|
||||
}
|
||||
$pay_result = $pay_result['data'];
|
||||
if ($pay_result['pay_status']) {
|
||||
return $this->success('您已支付成功,请勿重复支付', url('detail/index'));
|
||||
return redirect(url('home/payesta/succ', ['order_sn' => $order_sn])->build());
|
||||
}
|
||||
//微信pc
|
||||
$cfg = config('app.wechatpcpay');
|
||||
@@ -171,7 +171,7 @@ class Payesta extends Base
|
||||
]);
|
||||
}
|
||||
$pay_result = $pay_result['data'];
|
||||
if ($pay_result['pay_status']) {
|
||||
if (in_array($pay_result['pay_status'] ?? null, [1, '1'], true)) {
|
||||
return json([
|
||||
'status' => 1,
|
||||
'msg' => '支付成功',
|
||||
@@ -184,6 +184,10 @@ class Payesta extends Base
|
||||
'url' => url('payesta/h5pay', ['order_sn' => $order_sn])->build()
|
||||
]);
|
||||
}
|
||||
View::assign('order_sn', $this->order_sn);
|
||||
View::assign('payment_label', 'ESTA');
|
||||
View::assign('payment_check_url', url('home/payesta/h5result', ['order_sn' => $this->order_sn])->build());
|
||||
View::assign('payment_success_url', url('home/payesta/succ', ['order_sn' => $this->order_sn])->build());
|
||||
return View::fetch();
|
||||
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@ class Update extends Base
|
||||
View::assign('us', json_decode(file_get_contents('./json/us.json'), true));
|
||||
View::assign('goods', config('app.ESTA_GOODS'));
|
||||
View::assign('ismobile', isMobile() ? 1 : 0);
|
||||
View::assign('ppt_sample_url', '/new/assets/images/shili.jpg');
|
||||
View::assign('per_sample_url', '/new/assets/images/persion2.png');
|
||||
View::assign('ppt_sample_url', BASE_PATH . '/new/assets/images/shili.jpg');
|
||||
View::assign('per_sample_url', BASE_PATH . '/new/assets/images/persion2.png');
|
||||
View::assign('data', $pay_result['data']);
|
||||
View::assign('id', $pay_result['data']['id']);
|
||||
return View::fetch();
|
||||
|
||||
@@ -23,7 +23,7 @@ class User extends Base
|
||||
{
|
||||
parent::initialize();
|
||||
if (!Session::has('user') || Session::get('user')['id'] <= 0) {
|
||||
throw new HttpResponseException(redirect('/home/login'));
|
||||
throw new HttpResponseException(redirect(url('home/login/index')->build()));
|
||||
}
|
||||
$this->userinfo = Session::get('user');
|
||||
View::assign('userinfo', $this->userinfo);
|
||||
@@ -97,7 +97,7 @@ class User extends Base
|
||||
public function logout()
|
||||
{
|
||||
Session::delete('user');
|
||||
return redirect('/home/index');
|
||||
return redirect(url('home/index/index')->build());
|
||||
}
|
||||
|
||||
public function checkInvoice()
|
||||
@@ -165,7 +165,7 @@ class User extends Base
|
||||
$res = [
|
||||
'status' => 1,
|
||||
'msg' => '操作成功',
|
||||
'url' => '/home/invoice/index/order_sn/' . $order_sn
|
||||
'url' => url('home/invoice/index', ['order_sn' => $order_sn])->build()
|
||||
];
|
||||
return json($res);
|
||||
|
||||
|
||||
@@ -21,21 +21,21 @@ class Wechatpay extends Base
|
||||
$order_url = Config::get('app.get_evus_detail_url');
|
||||
$response = Httpcurl::request($order_url, 'post', ['order_sn'=>$order_sn,'model'=>MODEL]);
|
||||
if ($response[3]) {
|
||||
return $this->error('支付失败,请稍后重试', '/home/detail/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/detail/index')->build());
|
||||
}
|
||||
$pay_result = json_decode($response[0], true);
|
||||
if (empty($pay_result)) {
|
||||
return $this->error('支付失败,请稍后重试', '/home/detail/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/detail/index')->build());
|
||||
}
|
||||
if (!$pay_result['code']){
|
||||
return $this->error('支付失败,请稍后重试', '/home/detail/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/detail/index')->build());
|
||||
}
|
||||
$pay_result = $pay_result['data'];
|
||||
if ($pay_result['pay_status']) {
|
||||
|
||||
return redirect(url('home/pay/succ', ['order_sn' => $order_sn])->build());
|
||||
}else{
|
||||
return $this->error('支付失败,请稍后重试', '/home/detail/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/detail/index')->build());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,21 +49,21 @@ class Wechatpay extends Base
|
||||
$order_url = Config::get('app.get_order_detail_url');
|
||||
$response = Httpcurl::request($order_url, 'post', ['order_sn'=>$order_sn,'model'=>ESTA_MODEL]);
|
||||
if ($response[3]) {
|
||||
return $this->error('支付失败,请稍后重试', '/home/esta/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/esta/index')->build());
|
||||
}
|
||||
$pay_result = json_decode($response[0], true);
|
||||
if (empty($pay_result)) {
|
||||
return $this->error('支付失败,请稍后重试', '/home/esta/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/esta/index')->build());
|
||||
}
|
||||
if (!$pay_result['code']){
|
||||
return $this->error('支付失败,请稍后重试', '/home/esta/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/esta/index')->build());
|
||||
}
|
||||
$pay_result = $pay_result['data'];
|
||||
if ($pay_result['pay_status']) {
|
||||
|
||||
return redirect(url('home/payesta/succ', ['order_sn' => $order_sn])->build());
|
||||
}else{
|
||||
return $this->error('支付失败,请稍后重试', '/home/esta/index');
|
||||
return $this->error('支付失败,请稍后重试', url('home/esta/index')->build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1
app/home/view/pay/h5result.html
Normal file
1
app/home/view/pay/h5result.html
Normal file
@@ -0,0 +1 @@
|
||||
{include file="public/payment_result" /}
|
||||
1
app/home/view/payesta/h5result.html
Normal file
1
app/home/view/payesta/h5result.html
Normal file
@@ -0,0 +1 @@
|
||||
{include file="public/payment_result" /}
|
||||
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="{$logo_icon|default='/static/home/images/evus-icon.png'}">
|
||||
<link rel="stylesheet" href="/static/css/self.css?v={$asset_version}">
|
||||
<link rel="stylesheet" href="/static/home/css/reset.css">
|
||||
<link rel="stylesheet" href="/static/home/css/style.css?v={$asset_version}">
|
||||
<link rel="stylesheet" href="/static/home/css/style.css?v={$asset_version}-subdir1">
|
||||
<link rel="stylesheet" href="/static/ym/detail/main.css?v={$asset_version}">
|
||||
<link rel="stylesheet" href="/static/layui/css/layui.css?v={$asset_version}" />
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
@@ -28,6 +28,62 @@
|
||||
|
||||
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
|
||||
<script>LA.init({id:"3RUd6ZreOhSLFHFI",ck:"3RUd6ZreOhSLFHFI"})</script>
|
||||
<script>
|
||||
(function () {
|
||||
function detectBasePath() {
|
||||
var pathname = window.location.pathname || '';
|
||||
var match = pathname.match(/^\/[^\/]+(?=\/home\/|\/static\/|\/json\/|\/$)/);
|
||||
return match ? match[0] : '';
|
||||
}
|
||||
function normalizeBasePath(base) {
|
||||
base = (base || '').trim();
|
||||
|
||||
// 模板变量未渲染时,退回到 URL 推断
|
||||
if (!base || base === '/' || base.charAt(0) === '{') {
|
||||
base = detectBasePath();
|
||||
}
|
||||
|
||||
return base.replace(/\/+$/, '');
|
||||
}
|
||||
window.__BASE_PATH__ = normalizeBasePath('{$base_path}');
|
||||
window.withBase = function (url) {
|
||||
if (!url) {
|
||||
return url;
|
||||
}
|
||||
if (/^(?:[a-z][a-z0-9+\-.]*:)?\/\//i.test(url) || /^[a-z][a-z0-9+\-.]*:/i.test(url)) {
|
||||
return url;
|
||||
}
|
||||
if (url.charAt(0) !== '/') {
|
||||
return url;
|
||||
}
|
||||
var base = window.__BASE_PATH__ || '';
|
||||
if (!base) {
|
||||
return url;
|
||||
}
|
||||
if (url === base || url.indexOf(base + '/') === 0) {
|
||||
return url;
|
||||
}
|
||||
return base + url;
|
||||
};
|
||||
function attachAjaxPrefilter(jq) {
|
||||
if (!jq || !jq.ajaxPrefilter || jq.__with_base_prefilter_attached__) {
|
||||
return;
|
||||
}
|
||||
jq.__with_base_prefilter_attached__ = true;
|
||||
jq.ajaxPrefilter(function (options) {
|
||||
if (options && options.url) {
|
||||
options.url = window.withBase(options.url);
|
||||
}
|
||||
});
|
||||
}
|
||||
attachAjaxPrefilter(window.jQuery);
|
||||
attachAjaxPrefilter(window.$);
|
||||
// 兼容 layui 可能持有独立 jQuery 实例
|
||||
if (window.layui && window.layui.$) {
|
||||
attachAjaxPrefilter(window.layui.$);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<link rel="stylesheet" href="/static/home/css/agreement-layer.css?v=1">
|
||||
|
||||
<script>
|
||||
|
||||
18
app/home/view/public/payment_result.html
Normal file
18
app/home/view/public/payment_result.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{include file="public/head" /}
|
||||
<link rel="stylesheet" href="/static/home/css/home-menu.css?v=4">
|
||||
<link rel="stylesheet" href="/static/home/css/payment-result.css?v=1">
|
||||
<body class="main cn home home-layout-page">
|
||||
<div class="content detail-page__menu">{include file="public/home_menu" /}</div>
|
||||
<main class="payment-result" id="payment-result" data-check-url="{$payment_check_url}" data-success-url="{$payment_success_url}">
|
||||
<span class="payment-result__label">{$payment_label} · 支付结果</span>
|
||||
<h1>确认支付状态</h1>
|
||||
<p class="payment-result__order">订单号:{$order_sn}</p>
|
||||
<p id="payment-result-message" role="status" aria-live="polite">正在查询支付结果,请稍候…</p>
|
||||
<p class="payment-result__hint">如果您已完成付款,到账状态可能稍有延迟,请勿重复支付。</p>
|
||||
<button type="button" id="payment-result-check">重新查询</button>
|
||||
<a class="payment-result__home" href="{:url('home/index/index')}">返回首页</a>
|
||||
</main>
|
||||
{include file="public/footer" /}
|
||||
<script src="/static/home/js/payment-result.js?v=1"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>美签代传递信息填报</title>
|
||||
<script src="/static/home/js/ocr-image-compress.js?v=2"></script>
|
||||
<script src="/static/js/passport-ocr-sdk.min.js?v=1"></script>
|
||||
<link rel="stylesheet" href="/static/home/css/usvisa.css?v=6">
|
||||
<link rel="stylesheet" href="/static/home/css/usvisa.css?v=7">
|
||||
</head>
|
||||
<body>
|
||||
<main class="usvisa-page">
|
||||
@@ -265,11 +265,13 @@
|
||||
|
||||
<script>
|
||||
window.usvisaPageData = {
|
||||
uploadUrl: '{:url("home/upload/file_upload")}',
|
||||
submitUrl: '{:url("home/usvisa/submit")}',
|
||||
branches: <?= json_encode($branches, JSON_UNESCAPED_UNICODE) ?>,
|
||||
ocrConfigRaw: '{$ocr_config|default = ''}'.replace(/"/g, '"')
|
||||
};
|
||||
</script>
|
||||
<script src="/static/js/zxing-browser.min.js?v=1"></script>
|
||||
<script src="/static/home/js/usvisa.js?v=6"></script>
|
||||
<script src="/static/home/js/usvisa.js?v=7"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,7 +6,7 @@ return [
|
||||
// cookie 保存时间
|
||||
'expire' => 0,
|
||||
// cookie 保存路径
|
||||
'path' => '/',
|
||||
'path' => '/evus',
|
||||
// cookie 有效域名
|
||||
'domain' => '',
|
||||
// cookie 启用安全传输
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
return [
|
||||
// session name
|
||||
'name' => 'PHPSESSID',
|
||||
'name' => 'EVUSSESSID',
|
||||
// SESSION_ID的提交变量,解决flash上传跨域
|
||||
'var_session_id' => '',
|
||||
// 驱动方式 支持file cache
|
||||
|
||||
@@ -22,4 +22,10 @@ return [
|
||||
'taglib_begin' => '{',
|
||||
// 标签库标签结束标记
|
||||
'taglib_end' => '}',
|
||||
'tpl_replace_string' => [
|
||||
'/static/' => '/evus/static/',
|
||||
// 仅替换引号开头的站内路由,避免误改 /static/home/ 和外部地址。
|
||||
'"/home/' => '"/evus/home/',
|
||||
"'/home/" => "'/evus/home/",
|
||||
],
|
||||
];
|
||||
|
||||
@@ -18,6 +18,8 @@ require __DIR__ . '/../vendor/autoload.php';
|
||||
// 执行HTTP应用并响应
|
||||
$http = (new App())->http;
|
||||
|
||||
$_SERVER['SCRIPT_NAME'] = '/evus/index.php';
|
||||
$_SERVER['PHP_SELF'] = '/evus/index.php';
|
||||
$response = $http->run();
|
||||
|
||||
$response->send();
|
||||
|
||||
10
public/static/home/css/payment-result.css
Normal file
10
public/static/home/css/payment-result.css
Normal file
@@ -0,0 +1,10 @@
|
||||
.payment-result { max-width: 560px; margin: 40px auto; padding: 32px; background: #fff; border: 1px solid #dde5ed; border-radius: 16px; box-shadow: 0 12px 32px rgba(21,55,80,.07); color: #173d5b; text-align: center; }
|
||||
.payment-result__label { color: #65798c; font-size: 14px; }
|
||||
.payment-result h1 { margin: 14px 0 20px; font-size: 26px; }
|
||||
.payment-result p { margin: 14px 0; line-height: 1.8; }
|
||||
.payment-result__order { overflow-wrap: anywhere; }
|
||||
.payment-result__hint { color: #65798c; font-size: 14px; }
|
||||
.payment-result button { margin: 12px 0; padding: 12px 28px; border: 0; border-radius: 8px; background: #173d5b; color: #fff; cursor: pointer; }
|
||||
.payment-result button:disabled { opacity: .6; cursor: wait; }
|
||||
.payment-result__home { display: block; padding: 12px; color: #173d5b; }
|
||||
@media (max-width: 600px) { .payment-result { margin: 24px 12px; padding: 24px 18px; } }
|
||||
@@ -26,7 +26,7 @@ body.home-layout-page {
|
||||
line-height: 40px;
|
||||
margin-right: 80px;
|
||||
padding-left: 16px;
|
||||
background: url(/public/static/home/images/icon_nav_me.png) no-repeat left 12px;
|
||||
background: url(../images/icon_nav_me.png) no-repeat left 12px;
|
||||
background-size: auto 14px;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, .48), rgba(255, 255, 255, .78)),
|
||||
linear-gradient(90deg, rgba(244, 250, 253, .96) 0%, rgba(244, 250, 253, .72) 45%, rgba(244, 250, 253, .46) 100%),
|
||||
url("/static/home/images/index_bj_1.jpg") 31% center/cover no-repeat;
|
||||
url("../images/index_bj_1.jpg") 31% center/cover no-repeat;
|
||||
}
|
||||
|
||||
.hero::after {
|
||||
|
||||
34
public/static/home/js/payment-result.js
Normal file
34
public/static/home/js/payment-result.js
Normal file
@@ -0,0 +1,34 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
var panel = document.getElementById('payment-result');
|
||||
if (!panel) return;
|
||||
var button = document.getElementById('payment-result-check');
|
||||
var message = document.getElementById('payment-result-message');
|
||||
var busy = false;
|
||||
function checkPayment() {
|
||||
if (busy) return;
|
||||
busy = true;
|
||||
button.disabled = true;
|
||||
message.textContent = '正在查询支付结果,请稍候…';
|
||||
$.ajax({
|
||||
url: panel.getAttribute('data-check-url'),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
timeout: 20000
|
||||
}).done(function (result) {
|
||||
if (result && result.status === 1) {
|
||||
message.textContent = '支付成功,正在跳转…';
|
||||
window.location.replace(panel.getAttribute('data-success-url'));
|
||||
return;
|
||||
}
|
||||
message.textContent = '暂未确认支付成功。若已付款,请稍后重新查询,请勿重复支付。';
|
||||
}).fail(function () {
|
||||
message.textContent = '查询失败,请检查网络后重新查询。';
|
||||
}).always(function () {
|
||||
busy = false;
|
||||
button.disabled = false;
|
||||
});
|
||||
}
|
||||
button.addEventListener('click', checkPayment);
|
||||
checkPayment();
|
||||
})();
|
||||
@@ -525,7 +525,7 @@
|
||||
data.append('path', 'usvisa');
|
||||
|
||||
try {
|
||||
var response = await fetch('/home/upload/file_upload', {
|
||||
var response = await fetch(window.usvisaPageData.uploadUrl, {
|
||||
method: 'POST',
|
||||
body: data
|
||||
});
|
||||
@@ -648,7 +648,7 @@
|
||||
submitBtn.textContent = '提交中...';
|
||||
|
||||
try {
|
||||
var response = await fetch('/home/usvisa/submit', {
|
||||
var response = await fetch(window.usvisaPageData.submitUrl, {
|
||||
method: 'POST',
|
||||
body: new FormData(form)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user