trustbase-seller-backend 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trustbase-seller-backend",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "TrustBase Seller Backend (merchant edition) — 商品上链/订单/支付/质押 write API for TrustBase 保障链生态. 单卖家自托管形态: 签名 key 即卖家身份, 私钥不出门.",
5
5
  "main": "run-unified.js",
6
6
  "bin": {
@@ -273,15 +273,25 @@ function renderProgress(s){
273
273
  document.getElementById('shop-desc').textContent=s.shop_admin_url
274
274
  ? ('后台账号: '+(s.shop_admin_user||'admin')+' (密码见安装时输出); 上架后商品自动进入可信目录')
275
275
  : '后台入口路径见安装器输出 (形如 tbXXXXXXXX.php); 上架后商品自动进入可信目录';
276
- // 实名认证状态 (链上真状态 + 查询时间, 页面 15s 自动刷新)
276
+ // 实名认证状态 — 三态区分 (2026-09-25 实测反馈修复):
277
+ // 进件完成 (applyment.done) → 打勾, 藏表单
278
+ // 链上 KYC 过但进件未完成 → 不打勾, 文案说清两件事, 表单保持可填
279
+ // 其余 → 引导提交
277
280
  var vs=s.verification||{submitted:false,status:'none'};
278
281
  var qat=vs.queried_at?(' · 查询于 '+new Date(vs.queried_at*1000).toLocaleTimeString()):'';
279
282
  var chainTxt=vs.raw_status?('链上状态 '+vs.raw_status):'链上状态未知';
280
283
  var vStep=document.getElementById('st-verification');
281
- if(vs.status && vs.status.indexOf('approved')>=0){
284
+ var ap=s.applyment||null;
285
+ var apDone=!!(ap&&ap.done);
286
+ var kycOk=!!(vs.status && vs.status.indexOf('approved')>=0);
287
+ var applyForm=document.getElementById('apply-form');
288
+ if(apDone){
282
289
  vStep.className='step done'; vStep.querySelector('.mark').textContent='✅';
283
290
  document.getElementById('btn-verify').style.display='none';
284
- document.getElementById('verify-desc').textContent='认证已通过 (链上已 APPROVED), 引导金自动发放'+qat;
291
+ if(applyForm) applyForm.style.display='none';
292
+ document.getElementById('verify-desc').textContent='微信收款进件已完成 (sub_mchid='+(ap.sub_mchid||'')+'), 收款通道就绪'+qat;
293
+ } else if(kycOk){
294
+ document.getElementById('verify-desc').textContent='链上身份认证已过 ✅ · 微信收款进件未完成 — 请填写下方进件资料, 微信审核通过后收款通道才开通'+qat;
285
295
  } else if(vs.submitted){
286
296
  document.getElementById('verify-desc').textContent='实名已提交, 等待服务商审核 ('+chainTxt+qat+')';
287
297
  } else {
package/routes/onboard.js CHANGED
@@ -149,6 +149,17 @@ function createOnboardRouter(deps) {
149
149
  }
150
150
  } catch (_) { /* 链不可达: 保持默认 */ }
151
151
  }
152
+ // 进件状态 (2026-09-25 实测反馈修复): 第③步 done 以「微信特约商户进件完成」为准 —
153
+ // 链上 KYC APPROVED 只是身份认证辅助标记 (历史测试可遗留), 两者混用会让
154
+ // "链上已认证但进件没做"的商户看到"认证已通过"的误导文案。
155
+ let applyment = null;
156
+ try {
157
+ applyment = db.prepare("SELECT business_code, applyment_id, status, sub_mchid, sign_url FROM onboard_applyments ORDER BY created_at DESC LIMIT 1").get() || null;
158
+ } catch (_) { applyment = null; }
159
+ const applymentDone = !!(applyment && (
160
+ (applyment.sub_mchid && !String(applyment.sub_mchid).startsWith("pending-"))
161
+ || /finished/i.test(String(applyment.status || ""))
162
+ ));
152
163
  // 签名通道现状: 页面/客服诊断用 (只回路径与模式, 绝不回助记词/私钥)
153
164
  let signMode = null;
154
165
  try { signMode = chainWrites.signModeInfo(); } catch (_) { signMode = null; }
@@ -157,9 +168,15 @@ function createOnboardRouter(deps) {
157
168
  identity_created: !!tbAddress,
158
169
  tb_address: tbAddress,
159
170
  shop_name: shop ? shop.merchant_shortname : null,
160
- sub_mchid: shop ? shop.sub_mchid : "none",
171
+ sub_mchid: (applyment && applyment.sub_mchid) || (shop ? shop.sub_mchid : "none"),
161
172
  verification,
162
173
  grant,
174
+ applyment: applyment ? {
175
+ business_code: applyment.business_code,
176
+ status: applyment.status,
177
+ sub_mchid: applyment.sub_mchid || null,
178
+ done: applymentDone,
179
+ } : null,
163
180
  // 签名通道 + 目录 (页面显示, 客服排障; 2026-09-22 .215 签名故障暴露)
164
181
  sign_mode: signMode ? signMode.effective : null,
165
182
  sign_mode_configured: signMode ? signMode.configured : null,
@@ -172,7 +189,7 @@ function createOnboardRouter(deps) {
172
189
  steps: [
173
190
  { key: "identity", label: "卖家身份", done: !!tbAddress },
174
191
  { key: "backup", label: "备份纸密钥", done: null },
175
- { key: "verification", label: "微信收款认证", done: /approved/i.test(verification.status) },
192
+ { key: "verification", label: "微信收款认证", done: applymentDone, kyc_approved: /approved/i.test(verification.status) },
176
193
  { key: "grant", label: "引导金 100 TCT", done: grant.status === "issued" },
177
194
  { key: "listing", label: "上架商品", done: false },
178
195
  ],