import { queryStr } from '@/utils/query';
import { request } from 'umi';
import { api } 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(api + '/erp/user/loginUserInfo');
}


export async function getMenu(): Promise<any> {
  return request(api + '/erp/menu/getRouters', {
    method: 'PUT',
    data: ["adq_put_v3"]// "ad_monitor", "adq_put", "ad_tt"
  })
}

export async function editUser(prams: { oldPassword: string, password: string }) {
  return request(`${api}/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(`${api}/erp/user/modifyPassword/${userId}`, {
    method: 'PUT',
    data: parm
  })
}
/**查询公众号到期 */
export async function getMpsTimeOut(userId: any): Promise<any> {
  return request(api + `/system/mp/getMpsTimeOut/${userId}`)
}
