// import { axios, baseUrl } from '@/libs/api.request'
// import { getRequestData } from '@/libs/util'
let axios
let baseUrl
let getRequestData = () => {}

export const getTableData = () => {
  return axios.request({
    url: 'get_table_data',
    method: 'get'
  })
}

// 管理员
// -修改密码
export const updatePassword = ({ oldPwd, newPwd1, newPwd2 }) => {
  const data = getRequestData()
  data.body = { oldPwd, newPwd1, newPwd2 }
  return axios.request({
    url: 'admin/updatePassword',
    data,
    method: 'post'
  })
}
// -获取管理员操作记录
export const getAdminLogList = ({ currentPage, pageSize, userKey, type, detail, timeStart, timeEnd }) => {
  const data = getRequestData()
  data.body = { currentPage, pageSize, userKey, type, detail, timeStart, timeEnd }
  return axios.request({
    url: 'admin/listAdminLog',
    data,
    method: 'post'
  })
}
// -修改日志的备注
export const updateLogComm = ({ logId, comm }) => {
  const data = getRequestData()
  data.body = { logId, comm }
  return axios.request({
    url: 'admin/updateLogComm',
    data,
    method: 'post'
  })
}
// -获取管理员集合
export const getAdminList = ({ currentPage, pageSize }) => {
  const data = getRequestData()
  data.body = { currentPage, pageSize }
  return axios.request({
    url: 'admin/listAdmin',
    data,
    method: 'post'
  })
}
// -删除管理员
export const delAdmin = (adminId) => {
  const data = getRequestData()
  data.body = { adminId }
  return axios.request({
    url: 'admin/delAdmin',
    data,
    method: 'post'
  })
}
// -添加管理员
export const createAdmin = (phone) => {
  const data = getRequestData()
  data.body = { phone }
  return axios.request({
    url: 'admin/createAdmin',
    data,
    method: 'post'
  })
}

// 首页
// -获取首页统计数据
export const getIndexCountInfo = () => {
  const data = getRequestData()
  return axios.request({
    url: 'index/getIndexCountInfo',
    data,
    method: 'post'
  })
}

// 用户管理
// -用户列表
export const getAccountList = ({ pageSize, currentPage, userKey, status, timeStart, timeEnd }) => {
  const data = getRequestData()
  data.body = { pageSize, currentPage, userKey, status, timeStart, timeEnd }
  return axios.request({
    url: 'user/listAccount',
    data,
    method: 'post'
  })
}
// -获取用户详细信息
export const getAccountDetail = (uid) => {
  const data = getRequestData()
  data.body = { uid }
  return axios.request({
    url: 'user/getAccountDetail',
    data,
    method: 'post'
  })
}
// -修改用户身份
export const updateAccountRole = ({ outId, roleId, authorityName }) => {
  const data = getRequestData()
  data.body = { outId, roleId, authorityName }
  return axios.request({
    url: 'user/updateUserRole',
    data,
    method: 'post'
  })
}
// -修改用户状态
export const updateAccountStatus = ({ uid, status }) => {
  const data = getRequestData()
  data.body = { uid, status }
  return axios.request({
    url: 'user/updateUserStatus',
    data,
    method: 'post'
  })
}
// -修改用户手机号
export const updateAccountPhone = ({ uid, newPhone }) => {
  const data = getRequestData()
  data.body = { uid, newPhone }
  return axios.request({
    url: 'user/updateUserPhone',
    data,
    method: 'post'
  })
}
// -清除实名信息
export const removeAuthInfo = (uid) => {
  const data = getRequestData()
  data.body = { uid }
  return axios.request({
    url: 'user/removeAuthInfo',
    data,
    method: 'post'
  })
}
// -通过uid获取用户姓名和手机号
export const getUserInfoByOutId = (outId) => {
  const data = getRequestData()
  data.body = { outId }
  return axios.request({
    url: 'user/getUserInfoByOutId',
    data,
    method: 'post'
  })
}
// -获取角色名称集合
export const getRoleList = () => {
  const data = getRequestData()
  return axios.request({
    url: 'user/listUserRole',
    data,
    method: 'post'
  })
}
// -通过手机号获取uid和姓名
export const getUserInfoByPhone = (phone) => {
  const data = getRequestData()
  data.body = { phone }
  return axios.request({
    url: 'user/getUserInfoByPhone',
    data,
    method: 'post'
  })
}
// -获取用户身份的用户列表
export const getRoleAccountList = ({ pageSize, currentPage, userKey, timeStart, timeEnd }) => {
  const data = getRequestData()
  data.body = { pageSize, currentPage, userKey, timeStart, timeEnd }
  return axios.request({
    url: 'user/listRoleAccount',
    data,
    method: 'post'
  })
}
// -删除用户身份
export const deleteAccountRole = (uid) => {
  const data = getRequestData()
  data.body = { uid }
  return axios.request({
    url: 'user/deleteUserRole',
    data,
    method: 'post'
  })
}

// -获取商户申请列表
export const getBusinessCheckList = ({ searchKey, currentPage, pageSize }) => {
  const data = getRequestData()
  data.body = { searchKey, currentPage, pageSize }
  return axios.request({
    url: 'user/listBusiness',
    data,
    method: 'post'
  })
}

// 上传
// -上传广告图片
export const uploadBannerImg = baseUrl + 'upload/uploadBannerImg'

// -上传文章图片
export const uploadInfoImg = baseUrl + 'upload/uploadInformationImg'

// -上传咨询图片
export const uploadInfoVideo = baseUrl + 'upload/uploadInformationVideo'

export const uploadImg = baseUrl + 'upload/uploadImg'
