import http from '@/utils/request'

// 获取账号列表
export function getAccountList (params) {
  return http.post('/admin/admin', { data: params })
}

// 新增账户
export function addAccount (params) {
  return http.post('/admin/admin/add', { data: params })
}

// 更新账户
export function updateAccount (params) {
  if (!params.password) {
    delete params.password
  }
  return http.post('/admin/admin/update', { data: params })
}

// 删除账户
export function deleteAccount (id) {
  let params = {
    idList: [id]
  }
  return http.post('/admin/admin/delete', { data: params })
}

// 获取用户信息
export function getSelf () {
  return http.post('/admin/auth/getCurrent')
}

// 更新用户信息
export function updateSelf (params) {
  return http.post('/admin/admin/updateSelf', { data: params })
}
