Files
jiu/web/license-result.njk
T
wangjia c010d8b416 fix(site): 官网 401 自动用 refresh_token 续签重试;资产加构建版本号破缓存
- 新增共享 auth.js(jiuAuth):access token 60 分钟过期后,checkout 提交/
  结果页轮询遇 401 自动 POST /auth/refresh 换新 token 并重试一次,仍失败
  才跳登录——修复「已登录点提交订单却被踢回登录页」
- 登录判定放宽为 access 或 refresh token 任一存在(refresh 7 天有效)
- 所有 JS/CSS 引用加 ?v=构建版本号:修复旧版 nav.js 被浏览器缓存后在新
  页面执行(右上角错位的旧用户面板、带引号的 "张三" 显示)
- nav.js 改经 jiuAuth 读 localStorage(JSON 解码,去掉引号显示)
- 登录页回填上次的门店编号与账号

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
2026-07-03 21:08:13 +08:00

71 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
layout: base.njk
title: 支付结果
description: 支付宝支付完成后的到账确认页。
permalink: /license/result/
---
{# pay 回跳页(return_urlpay 拼 out_trade_no):轮询购买单状态,到账以 webhook 续期为准。 #}
<div class="container" style="padding:64px 24px 96px">
<div class="result" id="waiting">
<div class="ring wait"><svg class="ic"><use href="#i-ic11"/></svg></div>
<h2>确认到账中…</h2>
<p>支付完成后到账通常在数秒内确认,请稍候。<br/>本页会自动刷新结果,无需手动操作。</p>
</div>
<div class="result" id="ok" style="display:none">
<div class="ring good"><svg class="ic"><use href="#i-check"/></svg></div>
<h2>支付成功,授权已续期</h2>
<p id="okDetail">门店授权已更新。</p>
<div class="ono">订单号 <b id="orderNo">—</b></div>
<div class="acts">
<a class="btn primary lg" href="/app/">进入系统</a>
<a class="btn ghost lg" href="/#pricing">返回套餐</a>
</div>
</div>
<div class="result" id="slow" style="display:none">
<div class="ring wait"><svg class="ic"><use href="#i-ic11"/></svg></div>
<h2>到账确认中</h2>
<p>付款已提交,但到账确认比平时慢一些。<br/>授权会在到账后自动续期——稍后可在 App「系统设置 → 授权」查看,无需重复付款。</p>
<div class="acts">
<a class="btn primary lg" href="/app/">进入系统</a>
<a class="btn ghost lg" href="mailto:{{ site.support.email }}">联系支持</a>
</div>
</div>
</div>
<script>
(function () {
var API = '{{ site.appBaseUrl }}';
function $(id) { return document.getElementById(id); }
var otn = new URLSearchParams(location.search).get('out_trade_no');
if (!otn || !jiuAuth.loggedIn()) { $('waiting').style.display = 'none'; $('slow').style.display = 'block'; return; }
var tries = 0, maxTries = 30; // 2s × 30 = 60s
function poll() {
tries++;
jiuAuth.authFetch(API, '/api/v1/license/purchase/' + encodeURIComponent(otn), {})
.then(function (r) { return r.ok ? r.json() : null; })
.then(function (j) {
var d = j && j.data;
if (d && d.status === 'paid') {
$('orderNo').textContent = otn;
if (d.expires_at) {
$('okDetail').textContent = '门店授权已续期至 ' + new Date(d.expires_at).toLocaleDateString('zh-CN') + '。';
}
$('waiting').style.display = 'none';
$('ok').style.display = 'block';
return;
}
next();
})
.catch(next);
}
function next() {
if (tries >= maxTries) { $('waiting').style.display = 'none'; $('slow').style.display = 'block'; return; }
setTimeout(poll, 2000);
}
poll();
})();
</script>