fix: 修复分销数据不显示和用户ID唯一性问题

1. 分销数据修复:
   - 添加访问记录API,即使未登录也记录访问
   - 登录成功后自动绑定推荐码
   - 在链接访问时立即记录访问统计

2. 支付商品名称修复:
   - 支付时显示完整章节名称而非仅ID
   - 格式:章节9.12-美业整合:一个人的公司如何月入十万

3. 用户ID唯一性修复:
   - 移除mockLogin,必须使用真实微信登录
   - 用户ID使用openId作为唯一标识
   - 同一微信用户每次登录都是同一ID
This commit is contained in:
卡若
2026-01-29 11:11:58 +08:00
parent 6989ade3e2
commit 395501e961
3 changed files with 172 additions and 48 deletions

View File

@@ -550,6 +550,12 @@ Page({
let paymentData = null
try {
// 获取章节完整名称用于支付描述
const sectionTitle = this.data.section?.title || sectionId
const description = type === 'fullbook'
? '《一场Soul的创业实验》全书'
: `章节${sectionId}-${sectionTitle.length > 20 ? sectionTitle.slice(0, 20) + '...' : sectionTitle}`
const res = await app.request('/api/miniprogram/pay', {
method: 'POST',
data: {
@@ -557,7 +563,7 @@ Page({
productType: type,
productId: sectionId,
amount,
description: type === 'fullbook' ? '《一场Soul的创业实验》全书' : `章节-${sectionId}`,
description,
userId: app.globalData.userInfo?.id || ''
}
})