import request from '@/config/axios'

// 推荐用户佣金 VO
export interface IntegralVO {
  // 用户编号
  id: number
  // 用户ID
  userId: number
  // 当前佣金
  currentQuota: number
  // 冻结佣金
  freezeQuota: number
  // 用户类型
  categoryId: number
}

// 推荐用户佣金 API
export const IntegralApi = {
  // 查询推荐用户佣金分页
  getIntegralPage: async (params: any) => {
    return await request.get({ url: `/distri/integral/page`, params })
  },

  // 查询推荐用户佣金详情
  getIntegral: async (id: number) => {
    return await request.get({ url: `/distri/integral/get?id=` + id })
  },

  // 新增推荐用户佣金
  createIntegral: async (data: IntegralVO) => {
    return await request.post({ url: `/distri/integral/create`, data })
  },

  // 修改推荐用户佣金
  updateIntegral: async (data: IntegralVO) => {
    return await request.put({ url: `/distri/integral/update`, data })
  },

  // 删除推荐用户佣金
  deleteIntegral: async (id: number) => {
    return await request.delete({ url: `/distri/integral/delete?id=` + id })
  },

  // 导出推荐用户佣金 Excel
  exportIntegral: async (params) => {
    return await request.download({ url: `/distri/integral/export-excel`, params })
  }
}