import {http2} from "@/utils/request.js";
/**新增签到奖励 */
export const addSignReward = (data) => {
  return http2.post('/api/v1/admin/activity/signin/add_reward', data,{
    headers:{
      'Content-Type':'multipart/form-data'
    }
  })
}
/**新增签到奖励类型 */
export const addSignRewardType = (data) => {
  return http2.post('/api/v1/admin/activity/signin/add_reward_type', data,{
    headers:{
      'Content-Type':'multipart/form-data'
    }
  })
}

// 拼团活动相关接口
/**获取拼团队伍列表 */
export const getGroupBuyList = () => {
  return http2.get('/api/v1/users/activity/group_buy/list')
}

/**获取拼团队伍详情 */
export const getGroupBuyDetail = (groupBuyId) => {
  return http2.get('/api/v1/users/activity/group_buy/detail', {
    params: { group_buy_id: groupBuyId }
  })
}

/**为队伍添加随机伪人 */
export const addRandomUser = (groupBuyId) => {
  const formData = new FormData()
  formData.append('group_buy_id', groupBuyId)
  return http2.post('/api/v1/admin/activity/group_buy/add_random_user', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**创建随机伪人队伍 */
export const addRandomGroup = (data) => {
  const formData = new FormData()
  formData.append('name', data.name)
  formData.append('group_buy_type_id', data.group_buy_type_id)
  return http2.post('/api/v1/admin/activity/group_buy/add_random_group', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**导出成功队伍信息 */
export const exportIdcInfo = () => {
  return http2.get('/api/v1/admin/activity/group_buy/export_idc_info')
}

/**为指定队伍下发订单 */
export const setOrder = (groupBuyId) => {
  const formData = new FormData()
  formData.append('group_buy_id', groupBuyId)
  return http2.post('/api/v1/admin/activity/group_buy/set_order', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
