import request from '@/utils/request'

// 查询列表
export function list(query) {
  return request({
    url: '/crowdsource/admin/list',
    method: 'get',
    params: query
  })
}

export function publishTask(form) {
  return request({
    url: '/crowdsource/apply',
    method: 'post',
    data: form
  })
}

export function listApply(query) {
  return request({
    url: '/crowdsource/apply/list',
    method: 'get',
    params: query
  })
}


export function getApply(applyId) {
  return request({
    url: '/crowdsource/apply/' + applyId,
    method: 'get'
  })
}

export function auditTask(form) {
  return request({
    url: '/crowdsource/admin/audit',
    method: 'post',
    data:form
  })
}
export function getById(id) {
  return request({
    url: '/crowdsource/'+id,
    method: 'get'
  })
}
export function claimTask(id) {
  return request({
    url: '/crowdsource/claim/'+id,
    method: 'get'
  })
}
export function myClaim(query) {
  return request({
    url: '/crowdsource/claim',
    method: 'get',
    params: query
  })
}
export function myApply(query) {
  return request({
    url: '/crowdsource/apply',
    method: 'get',
    params: query
  })
}
export function myPublish(query) {
  return request({
    url: '/crowdsource/publish',
    method: 'get',
    params: query
  })
}

export function getApplicant(taskId) {
  return request({
    url: '/crowdsource/applicant/'+ taskId,
    method: 'get'
  })
}

export function assignTester(param) {
  return request({
    url: '/crowdsource/assign',
    method: 'post',
    data: param
  })
}


// 获取详情
export function getdetesterId(userID,taskId) {
  return request({
    url: '/crowdsource/tester/detail/' + userID +'/'+taskId,
    method: 'get'
  })
}

// 获取类型字典
export function getType() {
  return request({
    url: '/system/dict/data/type/crowdsourcing_task_type',
    method: 'get',
    headers: {
      isToken: false
    },
  })
}


// 删除任务
export function delTask(id) {
  return request({
    url: '/crowdsource/admin/delete/'+id,
    method: 'delete',
  })
}


