import request from '@/common/system/request';

/**
 * 查询用户是否可以成为分销商
 * @returns {Promise<any>}
 */
export const getDistributionInfo = async () => {
    const res = await request.post("Distribution/Info");
    if (res.code == 0) {
        return res.data;
    }
    return null;
}

/**
 * 申请成为分销商接口
 * @param {Object} data 分销商申请数据
 * @returns {Promise<any>}
 */
export const applyDistribution = async (data) => {
    const res = await request.post("Distribution/ApplyDistribution", data);
    if (res.code == 0) {
        return res.data;
    }
    return null;
}

/**
 * 获取分销商排行
 * @param {Object} params 分页参数
 * @returns {Promise<any>}
 */
export const getDistributionRanking = async (params) => {
    const res = await request.post("Distribution/GetDistributionRanking", params);
    if (res.code == 0) {
        return res.data;
    }
    return null;
}

/**
 * 获取我的订单统计
 * @returns {Promise<any>}
 */
export const getOrderSum = async () => {
    const res = await request.post("Distribution/GetOrderSum");
    if (res.code == 0) {
        return res.data;
    }
    return null;
}

/**
 * 获取我的下级用户数量
 * @returns {Promise<any>}
 */
export const getTeamSum = async () => {
    const res = await request.post("Distribution/GetTeamSum");
    if (res.code == 0) {
        return res.data;
    }
    return null;
} 