import { request } from '@umijs/max';

export async function usersPage(body) {
    return request('/api/users/page', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}

export async function usersAdd(body) {
    return request('/api/users/add', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}

export async function usersUpdate(body) {
    return request('/api/users/update', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}


export async function usersDelete(body) {
    return request('/api/users/deleteBatchByIds', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}

export async function updateUserLevel(body) {
    return request('/api/users/updateUserLevel', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}
export async function userTransferHanging(body) {
    return request('/api/users/userTransferHanging', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}

export async function exportUser(body) {
    return request('/api/users/export ', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
        responseType: 'blob'
    });
}

export async function pageUpAndDownLevel(id) {
    return request(`/api/users/upAndDownLevel?id=${id}`, {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
    });
}

export async function userRecharge(body) {
    return request('/api/users/userRecharge', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}


// 获取短信
export async function smsCode() {
    return request(`/api/sms/sensitiveSendSms`, {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
    });
}

export async function accountChange(body) {
    return request(`/api/users/accountChange`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
        },
        data: body || {},
    });
}

