import request from "@/utils/request";

/**
 * 获取营销用户列表
 * @returns {AxiosPromise}
 */
export const getMarketList = () => {
    return request({
        url: '/user-boot/user/getMarketList',
        method: 'post',
    })
}

/**
 * 根据用户获取营销数据
 */
export const getMarketData = (userId) => {

    let formData = new FormData();
    formData.append('userId', userId);
    return request({
        url: '/cs-device-boot/csMarketData/queryByUseId',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: formData
    })
}

/**
 * 查询营销人员未选择的工程
 */
export const getMarketEnginner = (userId) => {
    let formData = new FormData();
    formData.append('userId', userId);
    return request({
        url: '/cs-device-boot/csMarketData/queryEnginnerByUseId',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: formData
    })
}

/**
 * 新增营销数据
 */
export const addMarketData = (data) => {
    return request({
        url: '/cs-device-boot/csMarketData/add',
        method: 'post',
        data: data
    })
}

/**
 * 移除营销数据
 */
export const removeMarketData = (ids) => {
    let data = new FormData();
    data.append('ids', ids);
    return request({
        url: '/cs-device-boot/csMarketData/remove',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        method: 'post',
        data: data
    })
}