import request from '@/config/axios'

// 推荐用户 VO
export interface DuserVO {
  // 用户编号
  id: number
  // 团队人员ID
  userId: number
  // 团队人员姓名
  name: string
  // 团队人员手机号码
  mobile: string
  // 团队人员来源
  source: number
  // 团队用户当前佣金
  integralId: number
  // 团队用户当前身价(等级)
  socialStatus: number
  // 团队用户当前点数
  socialStatusPoint: number
  // 用户类型
  categoryId: number
}

// 推荐用户 API
export const DuserApi = {
  // 查询推荐用户分页
  getDuserPage: async (params: any) => {
    return await request.get({ url: `/distri/duser/page`, params })
  },
  
  // 查询推荐用户详情
  getDuser: async (id: number) => {
    return await request.get({ url: `/distri/duser/get?id=` + id })
  },

  // 新增推荐用户
  createDuser: async (data: DuserVO) => {
    return await request.post({ url: `/distri/duser/create`, data })
  },

  // 修改推荐用户
  updateDuser: async (data: DuserVO) => {
    return await request.put({ url: `/distri/duser/update`, data })
  },

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

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