forked from gxwebsoft/mp-10550
feat(invite): 优化邀请参数解析和处理逻辑
- 重构 invite 工具函数,增强参数解析能力 - 添加参数调试工具,便于排查问题 - 优化用户登录后的邀请关系处理流程- 调整 API调用,统一使用 dealerId替代 refereeId - 移除未使用的导入和冗余代码
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import { BaseUrl } from '@/config/app';
|
||||
|
||||
/**
|
||||
* 小程序码生成参数
|
||||
@@ -38,7 +39,7 @@ export interface InviteRelationParam {
|
||||
*/
|
||||
export interface BindRefereeParam {
|
||||
// 推荐人ID
|
||||
refereeId: number;
|
||||
dealerId: number;
|
||||
// 被推荐人ID (可选,如果不传则使用当前登录用户)
|
||||
userId?: number;
|
||||
// 推荐来源
|
||||
@@ -112,7 +113,7 @@ export async function generateMiniProgramCode(data: MiniProgramCodeParam) {
|
||||
try {
|
||||
const url = '/wx-login/getOrderQRCodeUnlimited/' + data.scene;
|
||||
// 由于接口直接返回图片buffer,我们直接构建完整的URL
|
||||
return `${API_BASE_URL}${url}`;
|
||||
return `${BaseUrl}${url}`;
|
||||
} catch (error: any) {
|
||||
throw new Error(error.message || '生成小程序码失败');
|
||||
}
|
||||
@@ -155,7 +156,7 @@ export async function bindRefereeRelation(data: BindRefereeParam) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-dealer-referee',
|
||||
{
|
||||
refereeId: data.refereeId,
|
||||
dealerId: data.dealerId,
|
||||
userId: data.userId,
|
||||
source: data.source || 'qrcode',
|
||||
scene: data.scene
|
||||
|
||||
Reference in New Issue
Block a user