增加分销员中心-无感-绑定邀请人统一封装处理
This commit is contained in:
@@ -147,3 +147,11 @@ export const getConfig = (data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 分销员中心-无感-绑定邀请人
|
||||||
|
export const autoBindInviteUser = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + "/user/distribution/autoBindInviteUser",
|
||||||
|
method: "post",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
autoBindInviteUser
|
||||||
|
} from '@/common/api/market/distribution.js'
|
||||||
|
|
||||||
const accountInfo = wx.getAccountInfoSync();
|
const accountInfo = wx.getAccountInfoSync();
|
||||||
export const envVersion = accountInfo.miniProgram.envVersion;
|
export const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
let type = 3;
|
let type = 3;
|
||||||
@@ -13,6 +17,36 @@ if (envVersion === 'trial') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定用户邀请关系(核心函数)
|
||||||
|
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
|
||||||
|
* @param {Object} args - 绑定邀请关系的入参对象
|
||||||
|
* @param {number} [args.shopUserId] - 需要绑定邀请人的用户ID(integer <int64>,可选)
|
||||||
|
* @param {number} [args.shopId] - 店铺ID(integer <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) {
|
export function wxShare(par) {
|
||||||
return {
|
return {
|
||||||
...par,
|
...par,
|
||||||
|
|||||||
Reference in New Issue
Block a user