import request from '@/utils/request/index'

export interface BasicResponseModel<T = any> {
  code: number
  message: string
  result: T
}

export interface BasicPageParams {
  pageNumber: number
  pageSize: number
  total: number
}

/**
 * @description: 获取用户信息
 */
export function getUserInfo() {
  return request({
    url: '/cbs-app/user/getUserInfo',
    method: 'get'
  })
}

/**
 * @description: 用户登录
 */
export function login(params: object) {
  return request({
    url: '/cbs-app/userlogin',
    method: 'POST',
    data: params,
    requestType: 'form'
  } as any)
}

/**
 * @description: 用户修改密码
 */
export function changePassword(params: any, uid: any) {
  return request({
    url: `/user/u${uid}/changepw`,
    method: 'POST',
    params
  })
}

/**
 * @description: 用户登出
 */
export function logout(params: any) {
  return request({
    url: '/login/logout',
    method: 'POST',
    params
  })
}

/**
 * @description: 更新用户信息
 */
export function userUpdateInfo(params: any) {
  return request({
    url: '/cbs-app/user/updateInfo',
    method: 'POST',
    data: params
  })
}

/**
 * @description: 发送验证码
 */
export function sendSms(params: any) {
  return request({
    url: '/cbs-app/open/sendSms',
    method: 'POST',
    requestType: 'form',
    data: params
  } as any)
}

/**
 * @description: 手机验证码修改密码
 */
export function updatePassword(params: any) {
  return request({
    url: '/cbs-app/user/updatePassword',
    method: 'POST',
    requestType: 'form',
    data: params
  } as any)
}
