Add WeChat in-app JSAPI recharge for g2.tkmind.cn.

Use JSAPI with bound openid inside WeChat instead of QR long-press, and include related auth redirect and admin UX fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-16 16:20:04 +08:00
parent bb70634a96
commit f818dd0307
15 changed files with 260 additions and 32 deletions
+12
View File
@@ -1648,6 +1648,17 @@ export function createUserAuth(pool, options = {}) {
return rows[0] ?? null;
};
const getWechatOpenidForUser = async (userId, appId) => {
const [rows] = await pool.query(
`SELECT openid
FROM h5_user_wechat_identities
WHERE user_id = ? AND app_id = ?
LIMIT 1`,
[userId, appId],
);
return rows[0]?.openid ?? null;
};
const bindWechatToUser = async ({
userId,
appId,
@@ -2118,6 +2129,7 @@ export function createUserAuth(pool, options = {}) {
completeWechatBindAccount,
getWechatPendingBind,
getWechatBindingStatus,
getWechatOpenidForUser,
resetPassword,
verify,
revoke,