import { get, post } from '../http'

/**
 * @description:获取查询所有用户列表
 * @param {*} params
 * @return {*}
 */
export const getUserList = async (params: any) => {
  return await get<any>('/sysUser/list', params)
}
/**
 * @description:恢复密码
 * @param {*} params
 * @return {*}
 */
export const resetPwd = async (ids: any) => {
  if (!Array.isArray(ids)) {
    ids = [ids]
  }
  return await post<any>('/sysUser/resetPwd', { ids })
}
/**
 * @description:根据id获取用户详情
 * @param {*} params
 * @return {*}
 */
export const getUserDetails = async (id: string) => {
  return await get<any>(`/sysUser/selectUserId/${id}`)
}

/**
 * @description:根据id获取用户密码修改记录
 * @param {*} params
 * @return {*}
 */
export const getUserChangerecored = async (params: Record<string, any>) => {
  return await get<any>(`/userOpLog/list`, params)
}
/**
 * @description:个人上传记录
 * @param {*} params
 * @return {*}
 */
export const getUserQuestionFile = async (params: any) => {
  return await get<any>('/sysFileInfo/selectUserQuestionFile', params)
}
/**
 * @description:用户试卷列表
 * @param {*} params
 * @return {*}
 */
export const getUserHistoryPaperList = async (params: any) => {
  return await get<any>('/paper/list', params)
}

/**
 * @description:试题列表
 * @param {*} data
 * @return {*}
 */
export const getUserQuestionList = async (data: any) => {
  return await post<any>('/userQuestion/backstageList', data)
}

// ----
/**
 * @description: 获取用户信息
 * @param {string} id
 */
export const getUserInfoToId = async (params: Record<string, any>) => {
  return await get<any>('/sysUser/getUser', params)
}
/**
 * @description: 获取用户订单
 * @param {Record} params
 * @param {*} any
 */
export const getOrderForUser = async (params: Record<string, any>) => {
  return await get<any>('/orderManagement/userOrders', params)
}
/**
 * @description: 获取用户充值
 * @param {Record} params
 * @param {*} any
 */
export const getPayForUser = async (params: Record<string, any>) => {
  return await get<any>('/pay/UserFindList', params)
}
/**
 * @description: 获取用户QA
 * @param {Record} params
 * @param {*} any
 */
export const getQAForUser = async (params: Record<string, any>) => {
  return await get<any>('/smartConfig/useQAList', params)
}
/**
 * @description: 获取应用QA
 * @param {Record} params
 * @param {*} any
 */
export const getQAForApp = async (params: Record<string, any>) => {
  return await get<any>('/smartConfig/backgroundList', params)
}
/**
 * @description: 获取应用配置
 * @param {Record} params
 * @param {*} any
 */
export const getConfigForApp = async (params: Record<string, any>) => {
  return await get<any>('/functionApplication/list', params)
}
/**
 * @description: 保存用户备注
 * @param {Record} params
 * @param {*} any
 */
export const saveUserRemark = async (data: Record<string, any>) => {
  return await post<any>('/sysUser/editNotes', data)
}

/**
 * @description: 添加用户
 * @param {Record} data
 * @param {*} any
 */
export const addUserRemark = async (data: Record<string, any>) => {
  return await post<any>('/sysUser', data)
}

/**
 * @description: 编辑用户
 * @param {Record} data
 * @param {*} any
 */
export const editUserRemark = async (data: Record<string, any>) => {
  return await post<any>('/sysUser/editUser', data)
}

/**
 * @description: vip用户数据-查询列表-查询用户vip结束时间
 * @param {Record} params
 * @param {*} any
 */
export const getUserVipLength = async (params: Record<string, any>) => {
  return await get<any>('/vipUserInfo/list', params)
}

/**
 * @description: 延期会员期限
 * @param {Record} data
 * @param {*} any
 */
export const extensionVipLength = async (data: Record<string, any>) => {
  return await post<any>('/vipUserInfo/postponeVipDay', data)
}
