feat(invite): 优化邀请参数解析和处理逻辑

- 重构 invite 工具函数,增强参数解析能力
- 添加参数调试工具,便于排查问题
- 优化用户登录后的邀请关系处理流程- 调整 API调用,统一使用 dealerId替代 refereeId
- 移除未使用的导入和冗余代码
This commit is contained in:
2025-08-26 18:53:14 +08:00
parent 0a6f21d182
commit 24c6e6c0fd
13 changed files with 358 additions and 64 deletions

View File

@@ -4,7 +4,7 @@ import {Input, Radio, Button} from '@nutui/nutui-react-taro'
import {TenantId} from "@/config/app";
import './login.scss';
import {saveStorageByLoginUser} from "@/utils/server";
import {handleInviteRelation} from "@/utils/invite";
import {handleInviteRelation, getStoredInviteParams} from "@/utils/invite";
// 微信获取手机号回调参数类型
interface GetPhoneNumberDetail {
@@ -40,6 +40,14 @@ const Login = (props: LoginProps) => {
/* 获取用户手机号 */
const handleGetPhoneNumber = ({detail}: GetPhoneNumberEvent) => {
const {code, encryptedData, iv} = detail
// 获取存储的邀请参数
const inviteParams = getStoredInviteParams()
const refereeId = inviteParams?.inviter ? parseInt(inviteParams.inviter) : 0
console.log('Login组件登录时检测到的邀请参数:', inviteParams)
console.log('Login组件推荐人ID:', refereeId)
Taro.login({
success: function () {
if (code) {
@@ -51,7 +59,7 @@ const Login = (props: LoginProps) => {
encryptedData,
iv,
notVerifyPhone: true,
refereeId: 0,
refereeId: refereeId, // 使用解析出的推荐人ID
sceneType: 'save_referee',
tenantId: TenantId
},