增加分销员中心-无感-绑定邀请人统一封装处理

This commit is contained in:
2026-01-20 10:16:11 +08:00
parent 0444b68cb2
commit a125995808
2 changed files with 42 additions and 0 deletions

View File

@@ -147,3 +147,11 @@ export const getConfig = (data) => {
};
// 分销员中心-无感-绑定邀请人
export const autoBindInviteUser = (data) => {
return request({
url: prveUrl + "/user/distribution/autoBindInviteUser",
method: "post",
data: data,
});
};

View File

@@ -1,3 +1,7 @@
import {
autoBindInviteUser
} from '@/common/api/market/distribution.js'
const accountInfo = wx.getAccountInfoSync();
export const envVersion = accountInfo.miniProgram.envVersion;
let type = 3;
@@ -13,6 +17,36 @@ if (envVersion === 'trial') {
}
/**
* 绑定用户邀请关系(核心函数)
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
* @param {Object} args - 绑定邀请关系的入参对象
* @param {number} [args.shopUserId] - 需要绑定邀请人的用户IDinteger <int64>,可选)
* @param {number} [args.shopId] - 店铺IDinteger <int64>,可选)
* @param {string} args.inviteCode - 邀请人的邀请码(必填,非空校验通过后才会执行绑定逻辑)
* @returns {void} 无返回值
*/
export function bindInvite(args) {
// 解构入参对象,获取需要的核心参数
const {
shopUserId,
shopId,
inviteCode
} = args;
// 校验邀请码有效性若邀请码为空、null、undefined则直接返回不执行后续绑定逻辑
if (!inviteCode || inviteCode === null || inviteCode === undefined) {
return;
}
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
autoBindInviteUser({
id: shopUserId,
shopId,
inviteCode
});
}
export function wxShare(par) {
return {
...par,