import { queryStr } from '@/utils/query';
import { request } from 'umi';
import { erpApi } from './api'

export async function query() {
  return request('/api/users');
}
// export async function queryCurrent() {
//   return request<API.CurrentUser>('/api/currentUser');
// }
export async function queryCurrent() {
  return request(erpApi + '/erp/user/loginUserInfo');
}


export async function getMenu(): Promise<any> {
  return request(erpApi + '/erp/menu/getRouters', {
    method: 'PUT',
    data: ["game-data", 'gs_data']
  })
}

export async function editUser(prams: { oldPassword: string, password: string }) {
  return request(`${erpApi}/erp/user/profile/updatePwd${queryStr(prams)}`, {
    method: 'PUT'
  })
}
/** 重置密码 */
export async function modifyPasswordAjax(prams: { userId: string, password: string, oldPassword: string }) {
  let { userId, ...parm } = prams
  return request(`${erpApi}/erp/user/modifyPassword/${userId}`, {
    method: 'PUT',
    data: parm
  })
}
/**查询公众号到期 */
export async function getMpsTimeOut(userId: any): Promise<any> {
  return request(erpApi + `/system/mp/getMpsTimeOut/${userId}`)
}