523 lines
12 KiB
TypeScript
523 lines
12 KiB
TypeScript
import { request } from '../request';
|
|
|
|
/**
|
|
* Login
|
|
*
|
|
* @param username User name
|
|
* @param password Password
|
|
*/
|
|
export function fetchLogin(body: Api.Auth.LoginBody) {
|
|
return request<Api.Auth.LoginToken>({
|
|
url: '/auth/login',
|
|
method: 'post',
|
|
data: body
|
|
});
|
|
}
|
|
|
|
//邮箱验证码接口
|
|
export function sendCaptcha(body: Api.Auth.EmailCaptcha) {
|
|
return request({
|
|
url: `/system/email/code?email=${body.email}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
//验证注册
|
|
export function doCheckUserRepeat(body: Api.Auth.CheckBody) {
|
|
return request<boolean>({
|
|
url: '/auth/checkRepeat',
|
|
method: 'post',
|
|
data: body
|
|
});
|
|
}
|
|
|
|
//添加注册
|
|
export function fetchRegister(body: Api.Auth.RegisterBody) {
|
|
return request({
|
|
url: '/auth/register',
|
|
method: 'post',
|
|
data: body
|
|
});
|
|
}
|
|
|
|
/** logout */
|
|
export function doDeleteLogout() {
|
|
return request<App.Service.Response<null>>({
|
|
url: '/auth/logout',
|
|
method: 'delete'
|
|
});
|
|
}
|
|
|
|
/** Get user info */
|
|
export function doGetUserInfo() {
|
|
return request<Api.Auth.UserInfo>({ url: '/system/user/getInfo' });
|
|
}
|
|
|
|
/**
|
|
* Refresh token
|
|
*
|
|
* @param refreshToken Refresh token
|
|
*/
|
|
export function fetchRefreshToken(refreshToken: string) {
|
|
return request<Api.Auth.LoginToken>({
|
|
url: '/auth/refreshToken',
|
|
method: 'post',
|
|
data: {
|
|
refreshToken
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* return custom backend error
|
|
*
|
|
* @param code error code
|
|
* @param msg error message
|
|
*/
|
|
export function fetchCustomBackendError(code: string, msg: string) {
|
|
return request({ url: '/auth/error', params: { code, msg } });
|
|
}
|
|
|
|
/** Get check code */
|
|
export function doGetCheckCode() {
|
|
return request<{ uuid: string; img: string }>({
|
|
url: '/code'
|
|
});
|
|
}
|
|
/** Get rate limit list */
|
|
export function fetchRateLimitList() {
|
|
return request<Api.Auth.RateLimit[]>({
|
|
url: '/system/rateLimit/list',
|
|
method: 'get'
|
|
});
|
|
}
|
|
/** Add rate limit config */
|
|
export function addRateLimit(data: Api.Auth.RateLimitAdd) {
|
|
return request<any>({
|
|
url: '/system/rateLimit',
|
|
method: 'post',
|
|
data
|
|
});
|
|
}
|
|
|
|
/** Edit rate limit config */
|
|
export function editRateLimit(data: Api.Auth.RateLimitAdd & { id: number }) {
|
|
return request<any>({
|
|
url: '/system/rateLimit',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
|
|
/** Remove rate limit config */
|
|
export function removeRateLimit(ids: number | number[]) {
|
|
return request<any>({
|
|
url: `/system/rateLimit/${ids}`,
|
|
method: 'delete'
|
|
});
|
|
}
|
|
/** Get package list */
|
|
export function fetchPackageList() {
|
|
return request<Api.Auth.Package[]>({
|
|
url: '/system/package/list',
|
|
method: 'get'
|
|
});
|
|
}
|
|
/** Add package config */
|
|
export function addPackage(data: Api.Auth.PackageAdd) {
|
|
return request<any>({
|
|
url: '/system/package',
|
|
method: 'post',
|
|
data
|
|
});
|
|
}
|
|
/** 修改套餐 */
|
|
export function updatePackage(data: Api.Auth.PackageAdd & { id: string }) {
|
|
return request<any>({
|
|
url: '/system/package',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
|
|
/** 删除套餐 */
|
|
export function deletePackage(id: string) {
|
|
return request<any>({
|
|
url: `/system/package/${id}`,
|
|
method: 'delete'
|
|
});
|
|
}
|
|
/** Get CDR history list */
|
|
export function fetchCdrHistory(params: Api.Auth.CdrHistoryParams) {
|
|
return request<Api.Auth.CdrHistoryResponse>({
|
|
url: '/system/cdr/pageHistory',
|
|
method: 'get',
|
|
params
|
|
});
|
|
}
|
|
/** Get bill list */
|
|
export function fetchBillList(params: Api.Auth.BillParams) {
|
|
return request<Api.Auth.BillResponse>({
|
|
url: '/system/order/page',
|
|
method: 'get',
|
|
params
|
|
});
|
|
}
|
|
/** 获取AP设备列表 */
|
|
export function fetchApDeviceList(siteId: string, params: Omit<Api.Device.ApDeviceParams, 'siteId'>) {
|
|
return request<Api.Device.ApDeviceResponse>({
|
|
url: `/system/device/page/${siteId}`,
|
|
method: 'get',
|
|
params
|
|
});
|
|
}
|
|
/** 删除AP设备 */
|
|
export function deleteApDevices(ids: string) {
|
|
return request<any>({
|
|
url: `/system/device/${ids}`,
|
|
method: 'delete'
|
|
});
|
|
}
|
|
/** 获取终端设备列表 */
|
|
export function fetchTerminalList(params: Api.Device.TerminalDeviceParams) {
|
|
return request<Api.Device.TerminalDeviceResponse>({
|
|
url: '/system/client/list',
|
|
method: 'get',
|
|
params
|
|
});
|
|
}
|
|
/** 获取计费规则列表 */
|
|
export function fetchBillRuleList() {
|
|
return request<Api.Billing.BillRuleResponse>({
|
|
url: '/system/billRule/list',
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
/** 更新计费规则 */
|
|
export function updateBillRule(data: Api.Billing.BillRuleUpdate) {
|
|
return request<any>({
|
|
url: '/system/billRule',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 获取仪表盘概览数据 */
|
|
export function getDashboardOverview() {
|
|
return request<Api.DashboardOverview>({
|
|
url: '/system/dashboard/overview',
|
|
method: 'get'
|
|
});
|
|
}
|
|
/** 获取仪表盘站点列表 */
|
|
export function getDashboardSiteList(params: { pageNum: number; pageSize: number; searchKey?: string }) {
|
|
return request<Api.DashboardSiteResponse>({
|
|
url: '/system/dashboard/page',
|
|
method: 'get',
|
|
params
|
|
});
|
|
}
|
|
/** 获取KYC审核列表 */
|
|
export function fetchKycList(params: Api.Kyc.KycParams) {
|
|
return request<Api.Kyc.KycResponse>({
|
|
url: '/system/kyc/page',
|
|
method: 'get',
|
|
params
|
|
});
|
|
}
|
|
/** KYC审核通过 */
|
|
export function approveKyc(id: string, userId: number) {
|
|
return request<any>({
|
|
url: `/system/kyc/approve`,
|
|
method: 'put',
|
|
data: { id, userId }
|
|
});
|
|
}
|
|
|
|
/** KYC审核拒绝 */
|
|
export function rejectKyc(id: string, userId: number, reason: string) {
|
|
return request<any>({
|
|
url: `/system/kyc/reject`,
|
|
method: 'put',
|
|
data: {
|
|
id,
|
|
userId,
|
|
description: reason
|
|
}
|
|
});
|
|
}
|
|
/** 忘记 AP 设备 */
|
|
export function forgetApDevice(siteId: string, deviceMac: string) {
|
|
return request<any>({
|
|
url: `/system/device/forget/${siteId}/${deviceMac}`,
|
|
method: 'post'
|
|
});
|
|
}
|
|
/** 添加 AP 设备 */
|
|
export function addApDevice(siteId: string, params: Api.Device.AddApDeviceItem) {
|
|
// 确保始终发送包含 devices 数组的请求体
|
|
const requestData: Api.Device.AddApDeviceParams = {
|
|
devices: [params] // 即使 params 是空对象,也会发送 { devices: [{}] }
|
|
};
|
|
|
|
return request<any>({
|
|
url: `/system/device/add/${siteId}`,
|
|
method: 'post',
|
|
data: requestData
|
|
});
|
|
}
|
|
/** 重启 AP 设备 */
|
|
export function rebootApDevice(siteId: string, deviceMac: string) {
|
|
return request<any>({
|
|
url: `/system/device/reboot/${siteId}/${deviceMac}`,
|
|
method: 'post'
|
|
});
|
|
}
|
|
|
|
/** 获取站点列表 */
|
|
export function fetchSiteList(params: Api.Site.SiteParams) {
|
|
return request<Api.Site.SiteResponse>({
|
|
url: '/system/site/page',
|
|
method: 'get',
|
|
params: {
|
|
pageNum: params.pageNum,
|
|
pageSize: params.pageSize
|
|
}
|
|
});
|
|
}
|
|
/** 更新 AP 设备配置 */
|
|
export function updateApDeviceConfig(siteId: string, mac: string, config: Api.Device.ApDeviceConfigUpdate) {
|
|
return request<any>({
|
|
url: `/system/device/updateConfig/${siteId}/${mac}`,
|
|
method: 'post',
|
|
data: config
|
|
});
|
|
}
|
|
/** 获取 AP 设备配置 */
|
|
export function getApDeviceConfig(siteId: string, deviceMac: string) {
|
|
return request<Api.Device.ApDeviceConfigResponse>({
|
|
url: `/system/device/getConfig/${siteId}/${deviceMac}`,
|
|
method: 'post'
|
|
});
|
|
}
|
|
/** 纳管 AP 设备 */
|
|
export function adoptApDevice(siteId: string, deviceMac: string, params?: { username?: string; password?: string }) {
|
|
return request<any>({
|
|
url: `/system/device/startAdopt/${siteId}/${deviceMac}`,
|
|
method: 'post',
|
|
data: params
|
|
});
|
|
}
|
|
/** 获取 WLAN 群组列表 */
|
|
export function fetchWlanGroups(siteId: string) {
|
|
return request<Api.Wlan.WlanGroupResponse>({
|
|
url: `/system/wlan/group/${siteId}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
/** 获取无线网络列表 */
|
|
export function fetchWlanSsidList(siteId: string, wlanId: string, params: { pageNum: number; pageSize: number }) {
|
|
return request<Api.Wlan.WlanSsidResponse>({
|
|
url: `/system/wlan/ssid/${siteId}/${wlanId}`,
|
|
method: 'get',
|
|
params: {
|
|
pageNum: params.pageNum,
|
|
pageSize: params.pageSize
|
|
}
|
|
});
|
|
}
|
|
/** 添加无线网络 */
|
|
export function addWlanSsid(siteId: string, wlanId: string, params: Api.Wlan.AddWlanSsidParams) {
|
|
return request<any>({
|
|
url: `/system/wlan/ssid/${siteId}/${wlanId}`,
|
|
method: 'post',
|
|
data: params
|
|
});
|
|
}
|
|
/** 删除无线网络 */
|
|
export function deleteWlanSsid(siteId: string, wlanId: string, ssidId: string) {
|
|
return request<any>({
|
|
url: `/system/wlan/ssid/${siteId}/${wlanId}/${ssidId}`,
|
|
method: 'delete'
|
|
});
|
|
}
|
|
/** 获取无线网络配置 */
|
|
export function getWlanSsidConfig(siteId: string, wlanId: string, ssidId: string) {
|
|
return request<Api.Wlan.WlanSsidConfigResponse>({
|
|
url: `/system/wlan/ssid/${siteId}/${wlanId}/${ssidId}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
/** 修改无线网络配置 */
|
|
export function updateWlanSsid(siteId: string, wlanId: string, ssidId: string, params: Api.Wlan.AddWlanSsidParams) {
|
|
return request<any>({
|
|
url: `/system/wlan/ssid/${siteId}/${wlanId}/${ssidId}`,
|
|
method: 'put',
|
|
data: params
|
|
});
|
|
}
|
|
/** 获取门户列表 */
|
|
export function fetchPortalList(siteId: string, params: { pageNum: number; pageSize: number }) {
|
|
return request<Api.Portal.PortalResponse>({
|
|
url: `/system/portal/${siteId}`,
|
|
method: 'get',
|
|
params: {
|
|
pageNum: params.pageNum,
|
|
pageSize: params.pageSize
|
|
}
|
|
});
|
|
}
|
|
/** 获取 SSID 列表 */
|
|
export function fetchSsidList(siteId: string) {
|
|
return request<Api.Portal.SsidListResponse>({
|
|
url: `/system/wlan/ssids/${siteId}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
/** 添加门户 */
|
|
export function addPortal(siteId: string, params: Api.Portal.AddPortalParams) {
|
|
return request<any>({
|
|
url: `/system/portal/${siteId}`,
|
|
method: 'post',
|
|
data: params
|
|
});
|
|
}
|
|
/** 获取门户配置 */
|
|
export function getPortalConfig(siteId: string, portalId: string) {
|
|
return request<Api.Portal.AddPortalParams>({
|
|
url: `/system/portal/${siteId}/${portalId}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
/** 更新门户配置 */
|
|
export function updatePortalConfig(siteId: string, portalId: string, params: Api.Portal.AddPortalParams) {
|
|
return request<any>({
|
|
url: `/system/portal/${siteId}/${portalId}`,
|
|
method: 'put',
|
|
data: params
|
|
});
|
|
}
|
|
/** 删除门户 */
|
|
export function deletePortal(siteId: string, portalId: string) {
|
|
return request<any>({
|
|
url: `/system/portal/${siteId}/${portalId}`,
|
|
method: 'delete'
|
|
});
|
|
}
|
|
|
|
/** 首页邮箱重置密码 */
|
|
export function fetcodeReset(data:any) {
|
|
return request({
|
|
url: '/system/user/profile/forgotPwd',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 获取邮箱验证码 */
|
|
export function getEmailCode(email: string) {
|
|
return request<any>({
|
|
url: `/system/email/code`,
|
|
method: 'get',
|
|
params: { email }
|
|
});
|
|
}
|
|
|
|
/** 重置密码 */
|
|
export function resetPassword(data: { email: string; code: string; password: string }) {
|
|
return request<any>({
|
|
url: '/system/user/profile/forgotPwd',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 通过原密码修改密码 */
|
|
export function updatePasswordByOld(data: { oldPassword: string; newPassword: string }) {
|
|
return request<any>({
|
|
url: '/system/user/profile/updatePwd',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 添加站点 */
|
|
export function addSite(data: Api.Site.AddSiteParams) {
|
|
return request<any>({
|
|
url: '/system/site',
|
|
method: 'post',
|
|
data
|
|
});
|
|
}
|
|
|
|
/** 删除站点 */
|
|
export function deleteSite(siteId: string) {
|
|
return request<any>({
|
|
url: `/system/site/${siteId}`,
|
|
method: 'delete'
|
|
});
|
|
}
|
|
|
|
/** 获取站点配置 */
|
|
export function getSiteConfig(siteId: string) {
|
|
return request<Api.Site.SiteConfig>({
|
|
url: `/system/site/${siteId}`,
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
|
|
/** 更新站点配置 */
|
|
export function updateSite(siteId: string, data: Api.Site.UpdateSiteParams) {
|
|
return request<any>({
|
|
url: `/system/site/${siteId}`,
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 获取用户信息 */
|
|
export function getUserProfile() {
|
|
return request<any>({
|
|
url: '/system/user/profile',
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
/** 更新用户信息 */
|
|
export function updateUserProfile(data: { email: string; code: string }) {
|
|
return request<any>({
|
|
url: '/system/user/profile',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 更新支付配置 */
|
|
export function updatePaymentConfig(data: {
|
|
currency: string;
|
|
currencySymbol: string;
|
|
paymentMethods: string[];
|
|
}) {
|
|
return request<any>({
|
|
url: '/system/config/pay',
|
|
method: 'put',
|
|
data
|
|
});
|
|
}
|
|
/** 获取支付配置 */
|
|
export function getPaymentConfig() {
|
|
return request<{
|
|
currency: string;
|
|
currencySymbol: string;
|
|
paymentMethods: string[];
|
|
}>({
|
|
url: '/system/config/pay',
|
|
method: 'get'
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|