import request from '@/utils/request'

// 查询用户上下级关联列表
export function listRelation(query) {
    console.log(query)
    return request({
        url: '/service/appTeamStatistics/members/' + query.invitationCode,
        method: 'get',
        params: query
    })
}

// 获取用户等级数据
export function getLevelDetails(userId) {
    return request({
        url: '/service/appTeamStatistics/level/' + userId,
        method: 'get',
    })
}

// 查询用户上下级关联详细
export function getRelation(invitationCode) {
    return request({
        url: '/service/appTeamStatistics/levelDistribution/' + invitationCode,
        method: 'get',
    })
}

// 新增用户上下级关联
export function addRelation(data) {
    return request({
        url: '/system/relation',
        method: 'post',
        data: data
    })
}

// 修改用户上下级关联
export function updateRelation(data) {
    return request({
        url: '/service/appTeamStatistics/updateEnhanced',
        method: 'post',
        data: data
    })
}

// 获取团队统计详情
export function getTeamStatistics(userId) {
    return request({
        url: '/service/appTeamStatistics/statistics/' + userId,
        method: 'get',
    })
}

// 重新计算团队统计
export function recalculateStatistics(invitationCode) {
    return request({
        url: '/service/appTeamStatistics/statistics/recalculate/' + invitationCode,
        method: 'post',
    })
}



