优化支付宝支付流程与 Web 端体验

- 支付宝新窗口跳转,轮询与手动刷新增加加载反馈
- 支付回跳先校验订单状态,避免未付款误报成功
- 门户登录回调统一,云文件打开加载与版本冲突同步
- 精简本地 start.bat 与 README 说明

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24kycj
2026-06-23 11:27:45 +08:00
parent 23b958753d
commit 4d19d7e814
13 changed files with 400 additions and 214 deletions
+47 -1
View File
@@ -161,6 +161,40 @@
.then(packCloudResult);
}
function syncCloudFileAfterConflict(id) {
var oldKey = (typeof window !== 'undefined' && window.openAs && window.openAs.name) ? window.openAs.name : '';
return authedFetch('files/' + id, { headers: { Accept: 'application/json' } })
.then(function (response) {
if (!response.ok) return null;
return response.json();
})
.then(function (payload) {
if (!payload || !payload.ok || !payload.data) return null;
var d = payload.data;
var newKey = typeof window.soonApplyCloudMeta === 'function'
? window.soonApplyCloudMeta(d)
: ('soondesign_file:' + d.id + ':v' + d.version);
if (oldKey && oldKey !== newKey && typeof window.soonLocalRemove === 'function') {
window.soonLocalRemove(oldKey);
}
if (typeof window.soonRecentOnCloudSave === 'function') {
window.soonRecentOnCloudSave({
fileKey: newKey,
fileId: d.id,
name: d.name,
version: d.version
}, oldKey, null);
}
if (typeof window !== 'undefined' && window.openAs && newKey) {
window.openAs.name = newKey;
}
if (typeof window.soonToast === 'function') {
window.soonToast('文件已在其他端更新,已同步版本,请再次保存', 'warn');
}
return newKey;
});
}
function updateCloudFile(id, name, jsonStr, version) {
if (!requireCloudAuth('保存')) return Promise.reject(new Error('unauthorized'));
var body = { name: normalizeSoonName(name), json: jsonStr };
@@ -170,7 +204,19 @@
headers: JSON_HEADERS,
body: JSON.stringify(body)
})
.then(function (r) { return r.text().then(function (t) { return handleCloudResponse(r, t); }); })
.then(function (r) {
return r.text().then(function (t) {
if (r.status === 409) {
return syncCloudFileAfterConflict(id).then(function () {
var err = new Error('version_conflict');
err.status = 409;
err.conflictSynced = true;
return Promise.reject(err);
});
}
return handleCloudResponse(r, t);
});
})
.then(packCloudResult);
}