import request from '@/utils/request'

// 查询用户管理列表
export function listUser(query) {
  return request({
    url: '/xq/user/list',
    method: 'get',
    params: query
  })
}

export function listUserByUserCode(usercode) {
  return request({
    url: '/xq/user/listByUserCode',
    method: 'get',
    params:{
      usercode: usercode,
      limit: 40
    }
  })
}

export function getUserByUsercode(usercode) {
  return request({
    url: '/xq/user/getByUsercode',
    method: 'get',
    params:{
      usercode: usercode
    }
  })
}

export function resetUserPassword(data) {
  return request({
    url: '/xq/user/resetPwd',
    method: 'post',
    data: data
  })
}

export function resetUserMobile(data) {
  return request({
    url: '/xq/user/updateMobile',
    method: 'put',
    data: data
  })
}

// 解绑用户邀请人
export function userUnBindInvite(userId) {
  return request({
    url: '/xq/user/unBindInvite',
    method: 'get',
    params:{userId}
  })
}

// 绑定用户邀请人
export function userBindInvite(userId,inviteUsercode) {
  return request({
    url: '/xq/user/bindInvite',
    method: 'get',
    params:{
      userId,inviteUsercode
    }
  })
}

export function userResetAvatar(id) {
  return request({
    url: '/xq/user/resetAvatar',
    method: 'post',
    data: {id}
  })
}

export function userResetNickname(id) {
  return request({
    url: '/xq/user/resetNickname',
    method: 'post',
    data: {id}
  })
}

export function userLock(id) {
  return request({
    url: '/xq/user/lock',
    method: 'post',
    data: {id}
  })
}

export function userUnlock(id) {
  return request({
    url: '/xq/user/unlock',
    method: 'post',
    data: {id}
  })
}

// 查询用户管理详细
export function getUser(id) {
  return request({
    url: '/xq/user/' + id,
    method: 'get'
  })
}

export function getFullUser(id) {
  return request({
    url: '/xq/user/fullUser',
    method: 'get',
    params: {"userId":id}
  })
}

// 新增用户管理
export function addUser(data) {
  return request({
    url: '/xq/user',
    method: 'post',
    data: data
  })
}

// 修改用户管理
export function updateUser(data) {
  return request({
    url: '/xq/user',
    method: 'put',
    data: data
  })
}

// 删除用户管理
export function delUser(id) {
  return request({
    url: '/xq/user/' + id,
    method: 'delete'
  })
}
