feat(taobao): add native mini program with shared backend

Preserve H5 flows while adding Taobao identity, native capture, reports and isolated local development. Fix canceled province selection and expired-session logout. Record passing local regressions, two pre-existing H5 assertion failures and pending platform validation.
This commit is contained in:
xsl
2026-10-19 20:14:31 +08:00
parent d07f8cc1bb
commit 9eec4369da
61 changed files with 4827 additions and 17 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
'use strict';
const fs = require('node:fs'), path = require('node:path'), crypto = require('node:crypto');
// Lazy, owner-bound, single-flight tasks. Only WeChat jobs persist. Guest photos
// Lazy, owner-bound, single-flight tasks. Account jobs persist. Guest photos
// remain in RAM for at most five minutes; no paid work starts until requested.
module.exports = function({dir, collect, load, complete, now = Date.now}) {
const jobs = new Map();
@@ -16,7 +16,7 @@ module.exports = function({dir, collect, load, complete, now = Date.now}) {
fs.renameSync(tmp,file);
}
function register(owner,record,context) {
const job={token:crypto.randomBytes(24).toString('hex'),owner:owner.id,record,persist:owner.kind==='wechat',status:'pending',context};
const job={token:crypto.randomBytes(24).toString('hex'),owner:owner.id,record,persist:['wechat','taobao'].includes(owner.kind),status:'pending',context};
save(job);remember(job);
return {token:job.token,status:'pending'};
}
@@ -26,7 +26,7 @@ module.exports = function({dir, collect, load, complete, now = Date.now}) {
let job=jobs.get(token);
if (!job) {
try {job=JSON.parse(fs.readFileSync(path.join(dir,token+'.json'),'utf8'));} catch (_) {return null;}
if (job.owner!==owner.id || owner.kind!=='wechat') return null;
if (job.owner!==owner.id || !['wechat','taobao'].includes(owner.kind)) return null;
remember(job);
}
if (job.owner!==owner.id) return null;