import { GetRequestModel, PostRequestModel, QueryType } from '../../http/request-model' import { AccountLoginRsa } from '../../entity/login/login-rsa' import { AccountUserVo } from '../../entity/account/account-user' import { LogLogin } from '../../entity/system-log/log-login' import { getDefaultConfig } from '../../http/config/custom-config' const apiLogin = import.meta.env.VITE_APP_API_LOGIN || '/login' const apiLoginOut = import.meta.env.VITE_APP_API_LOGIN_OUT || '/loginOut' const apiMessage = import.meta.env.VITE_APP_API_MESSAGE || '' const apiCodeLogin = import.meta.env.VITE_APP_API_CODE_LOGIN || '' export default { /** * 获取rsa公钥key */ rsa: () => new GetRequestModel('/getRsaPublicKey', {}).request(), /** * 登录接口 * @param query */ login: (query?: QueryType) => new PostRequestModel(apiLogin, query).request(), /*** * 登录日志 * @param query */ page: (query?: QueryType) => new PostRequestModel('/logLogin/page', query).request(), /** * 退出登录 */ loginOut: () => new GetRequestModel(apiLoginOut).request(), /** * 获取手机验证码 */ getCode: (query?: QueryType) => { const defaultConfig = getDefaultConfig() defaultConfig.contentType = 'application/x-www-form-urlencoded' return new PostRequestModel(apiMessage, query, defaultConfig).request() }, /** * 通过手机验证码登录 */ loginByCode: (query?: QueryType) => { const defaultConfig = getDefaultConfig() defaultConfig.contentType = 'application/x-www-form-urlencoded' return new PostRequestModel(apiCodeLogin, query, defaultConfig).request() } }