
import request from '@/utils/request'


export const taskList = (data: any) => {
    return request({
        url: `api/tasks`,
        method: 'get',
        params: data

    })
}


export const addTask = (data: any) => {
    return request({
        url: `api/task`,
        method: 'post',
        data
    })
}

export const upTask = (data: any, id) => {
    return request({
        url: `api/task/${id}`,
        method: 'put',
        data: data

    })
}

export const deleteTask = (id) => {
    return request({
        url: `api/task/${id}`,
        method: 'delete'

    })
}


// 群列表
export const taskGroups = (data) => {
    return request({
        url: `api/task/groups`,
        method: 'get',
        params: data

    })
}
export const taskGroupsAdd = (data, id) => {
    return request({
        url: `api/task/group/${id}`,
        method: 'post',
        data

    })
}

export const taskFriends = (data) => {
    return request({
        url: `api/task/friends`,
        method: 'get',
        params: data

    })
}
export const taskFriendAdd = (data, id) => {
    return request({
        url: `api/task/friend/${id}`,
        method: 'post',
        data
    })
}
// 日志
export const taskLogs = (data) => {
    return request({
        url: `api/task/logs`,
        method: 'get',
        params: data

    })
}


// 素材
export const taskMaterials = (data) => {
    return request({
        url: `api/task/materials`,
        method: 'get',
        params: data

    })
}
export const taskMaterialsAdd = (data, id) => {
    return request({
        url: `api/task/material/${id}`,
        method: 'POST',
        data

    })
}


// 执行任务

export const execTask = (id) => {
    return request({
        url: `api/task/exec/${id}`,
        method: 'post',

    })
}


// 停止任务

export const stopTask = (id) => {
    return request({
        url: `api/task/stop/${id}`,
        method: 'post',

    })
}