diff --git a/index.html b/index.html
index d2025b2..e28d23d 100644
--- a/index.html
+++ b/index.html
@@ -7,7 +7,7 @@
我的资料
diff --git a/js/app.js b/js/app.js
index ed7b170..e4e4362 100644
--- a/js/app.js
+++ b/js/app.js
@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
- var VER = '26101005';
+ var VER = '26101006';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -5254,6 +5254,40 @@
}).catch(function () {});
}
loadDou();
+
+ /* ---------- 新人欢迎礼(2026-10-10 用户定,「首页 / 小程序后台」会话 375797cf 提供账本口径) ----------
+ 进首页就调统一兜豆账本:/doudou-ledger/api/auth/login {app:'box-app', openid, unionid} 换 token →
+ /me/report {rule:'welcome'}。账本保证每人只发一次:
+ · granted>0 且 duplicate=false → 弹「新人欢迎礼 +N 兜豆」(N 用返回的 granted,不写死),再按账本余额刷新兑换条;
+ · duplicate=true → 什么都不显示;接口失败 → 静默,下次进来再调;没有 openid(匿名)→ 不调。
+ 同源走 mp 反代(/doudou-ledger/ 已加进 nginx 统一反代),不跨域。 */
+ (function welcomeGift() {
+ const oid = hashParam('openid'), uid = hashParam('unionid');
+ if (!oid || DEMO) return;
+ const LEDGER = '/doudou-ledger/api';
+ fetch(LEDGER + '/auth/login', {
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ app: 'box-app', openid: oid, unionid: uid || null })
+ }).then(function (r) { return r.ok ? r.json() : null; }).then(function (j) {
+ if (!j || !j.token) return null;
+ return fetch(LEDGER + '/me/report', {
+ method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + j.token },
+ body: JSON.stringify({ rule: 'welcome' })
+ }).then(function (r) { return r.ok ? r.json() : null; });
+ }).then(function (res) {
+ if (!res || res.duplicate || !(res.granted > 0)) return;
+ loadDou(); // 余额以账本为准:领完立刻重拉,不在前端加减
+ const show = function () {
+ $('#wgN').textContent = res.granted;
+ /* 进页面时可能已经有别的弹窗(如完善资料引导)开着 → 不抢,改成一条 toast */
+ if (openedModal) toast('新人欢迎礼 +' + res.granted + ' 兜豆,已到账');
+ else openModal('modalWelcome');
+ };
+ setTimeout(show, 900);
+ }).catch(function () {});
+ })();
+ $('#wgGo').addEventListener('click', function () { closeModal(); openExchange(); });
+
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'visible') loadDou();
});
diff --git a/mama-box.css b/mama-box.css
index aaca6a0..b823819 100644
--- a/mama-box.css
+++ b/mama-box.css
@@ -4729,3 +4729,8 @@ a.skip:focus{left:16px;top:16px}
/* 「我的资料」弹窗里的退出登录(2026-10-10) */
.pf-logout{display:block;width:100%;margin-top:14px;padding:12px;border-radius:14px;background:#FFF4F2;font-size:14px;font-weight:700;color:#C33A2E;text-align:center}
+
+/* 新人欢迎礼弹窗(2026-10-10) */
+.wg-modal .wg-n{color:var(--brand)}
+.wg-modal .modal-foot{display:flex;gap:10px}
+.wg-modal .modal-foot .dl-btn{flex:1}