This commit is contained in:
parent
4c261ce928
commit
46ed573221
|
|
@ -45,8 +45,14 @@
|
|||
let inviterId = null
|
||||
|
||||
// 1. 扫码进入:解析 scene 参数(inviter={userId})
|
||||
if (options.scene) {
|
||||
const scene = decodeURIComponent(options.scene)
|
||||
// 注意:options.scene 是微信启动场景值(数字,如1048),
|
||||
// 自定义 scene 参数在 options.query.scene 中(字符串)
|
||||
const sceneStr = (options.query && options.query.scene)
|
||||
? String(options.query.scene)
|
||||
: (typeof options.scene === 'string' ? options.scene : '')
|
||||
|
||||
if (sceneStr) {
|
||||
const scene = decodeURIComponent(sceneStr)
|
||||
console.log('[App] 扫码 scene 解码后:', scene)
|
||||
const match = scene.match(/inviter=(\d+)/)
|
||||
if (match) {
|
||||
|
|
@ -57,9 +63,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
// 2. 分享链接进入:解析 inviterId 参数
|
||||
if (!inviterId && options.inviterId) {
|
||||
inviterId = options.inviterId
|
||||
// 2. 分享链接进入:解析 inviterId 参数(query 中直接带 inviterId)
|
||||
const queryInviterId = (options.query && options.query.inviterId) || options.inviterId
|
||||
if (!inviterId && queryInviterId) {
|
||||
inviterId = queryInviterId
|
||||
console.log('[App] 从query参数获取inviterId:', inviterId)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user