/** * Namespace Api * * All backend api type */ declare namespace Api { namespace Common { /** common params of paginating */ interface PaginatingCommonParams { /** total count */ total: number; } /** common params of paginating query list data */ interface PaginatingQueryRecord extends PaginatingCommonParams { rows: T[]; } /** * enable status * * - "0": enabled * - "1": disabled */ type EnableStatus = '1' | '0'; /** common record */ type CommonRecord = { /** record creator */ createBy: string; /** record create time */ createTime: string; /** record updater */ updateBy: string; /** record update time */ updateTime: string; /** record status */ status: EnableStatus; } & T; type CommonTree = { id: number; label: string; children?: CommonTree[]; }[]; } namespace Department { interface Dept { createBy: any; createTime: any; updateBy: any; updateTime: any; remark: any; deptId: number; parentId: number; ancestors: string; deptName: string; orderNum: number; leader: string; phone: any; email: any; status: string; delFlag: any; parentName: any; children: any[]; } } /** * Namespace Auth * * Backend api module: "auth" */ namespace Auth { interface LoginToken { access_token: string; refreshToken: string; } /** User info */ interface UserInfo { user: User | null; roles: string[]; /** permissions */ permissions: string[]; } interface User { createBy: string; createTime: string; updateBy: any; updateTime: any; remark: string; userId: number; deptId: number; userName: string; nickName: string; email: string; phonenumber: string; sex: string; avatar: string; password: string; status: '0' | '1'; delFlag: string; loginIp: string; loginDate: string; birthDate: string; dept: Department.Dept; roles: Role[]; roleId: string; postIds: number[]; roleIds: number[]; admin: boolean; } interface Role { remark: any; roleId: number; roleName: string; roleKey: string; roleSort: number; dataScope: string; menuCheckStrictly: boolean; deptCheckStrictly: boolean; status: string; delFlag: '0' | '1'; flag: boolean; menuIds: number[] | null; deptIds: number[] | null; permissions: any; admin: boolean; } interface LoginBody { username: string; password: string; code: string; uuid: string; authType: string; wanfiRedirectParams: any; } interface RegisterBody { username: string; password: string; authType: string; email: string; fullName?: string; age: number; address?: string; sex?: string; phonenumber?: string; } interface EmailCaptcha { email: string; } interface CheckBody { username?: string; email?: string; phonenumber?: string; authType: string; } interface ChangeInfoBody { userId: number; userName: string; nickName?: string | undefined; email: string; phonenumber?: string | undefined; sex?: string | undefined; birthDate?: string | undefined; age?: number; } } /** * Namespace Route * * Backend api module: "route" */ namespace Route { type ElegantConstRoute = import('@elegant-router/types').ElegantConstRoute; interface MenuRoute extends ElegantConstRoute { id: string; } interface UserRoute { routes: MenuRoute[]; home: import('@elegant-router/types').LastLevelRouteKey; } } /** * namespace SystemManage * * backend api module: "systemManage" */ namespace SystemManage { type CommonSearchParams = { /** page number */ pageNum: number; /** page size */ pageSize: number; }; /** role */ type Role = Common.CommonRecord<{ remark: string; roleId: number; roleName: string; roleKey: string; roleSort: number; dataScope: string; menuCheckStrictly: boolean; deptCheckStrictly: boolean; status: string; delFlag: '0' | '1'; flag: boolean; menuIds: number[] | null; deptIds: number[] | null; permissions: string; admin: boolean; }>; /** role search params */ type RoleSearchParams = Partial< Pick & CommonSearchParams >; /** role list */ type RoleList = Common.PaginatingQueryRecord; /** all role */ type AllRole = Pick; /** * user gender * * - "1": "male" * - "2": "female" */ type UserGender = '1' | '2'; /** user */ type UserInfo = Common.CommonRecord<{ /** user name */ username: string; /** user gender */ userGender: UserGender | null; /** user nick name */ nickName: string; /** user phone */ userPhone: string; /** user email */ userEmail: string; /** user role code collection */ userRoles: string[]; }>; /** user search params */ type UserSearchParams = Partial< Pick & CommonSearchParams >; /** user list */ type UserList = Common.PaginatingQueryRecord; type UserPostsAndRoles = { posts: Post[]; roles: Role[]; postIds: number[]; roleIds: number[]; }; /** * menu type * * - "1": directory * - "2": menu */ type MenuType = 'M' | 'C' | 'F'; type MenuButton = { /** * button code * * it can be used to control the button permission */ code: string; /** button description */ desc: string; }; /** * icon type * * - "1": iconify icon * - "2": local icon */ type IconType = '1' | '2'; type Menu = Common.CommonRecord<{ /** parent menu id */ parentId: number; /** menu type */ menuType: MenuType; /** menu name */ menuName: string; /** route name */ routeName: string; /** route path */ routePath: string; /** component */ component?: string; menuId: number; path: string; /** * i18n key * * it is for internationalization */ i18nKey?: App.I18n.I18nKey; /** iconify icon name or local icon name */ icon: string; /** icon type */ iconType: IconType; /** menu order */ orderNum: number; /** whether to cache the route */ keepAlive?: '0' | '1'; /** outer link */ href?: string; /** whether to retain the route */ status: '0' | '1'; /** whether to hide the route in the menu */ hideInMenu?: '0' | '1'; /** * The menu key will be activated when entering the route * * The route is not in the menu * * @example * the route is "user_detail", if it is set to "user_list", the menu "user_list" will be activated */ activeMenu?: import('@elegant-router/types').LastLevelRouteKey; /** By default, the same route path will use one tab, if set to true, it will use multiple tabs */ multiTab?: boolean; /** If set, the route will be fixed in tabs, and the value is the order of fixed tabs */ fixedIndexInTab?: number; /** menu buttons */ buttons?: MenuButton[]; /** children menu */ children?: Menu[]; /** is external link */ isFrame: '0' | '1'; /** perms to request api */ perms: string; /** menu name(path combine) */ name: string; isCache: '0' | '1'; visible: '0' | '1'; }>; /** menu list */ type MenuList = Common.PaginatingQueryRecord; type MenuTree = { id: number; label: string; pId: number; children?: MenuTree[]; }; // dept api /** dept */ type Dept = { createBy: string; createTime: string; updateBy: string; updateTime: string; remark: string; deptId: number; parentId: number; ancestors: string; deptName: string; orderNum: number; leader: string; phone: string; email: string; status: '0' | '1'; delFlag: string; parentName: string; children: Dept[]; }; type DeptList = Common.PaginatingQueryRecord; /** dept search params */ type DeptSearchParams = Partial & CommonSearchParams>; // post api type Post = { createBy: string; createTime: string; updateBy: any; updateTime: any; remark: string; postId: number; postCode: string; postName: string; postSort: number; status: '0' | '1'; flag: boolean; }; type PostSearchParams = Partial & CommonSearchParams>; type PostList = Common.PaginatingQueryRecord; // dict api type Dict = { createBy: string; createTime: string; updateBy: string; updateTime: string; remark: string; dictId: number; dictName: string; dictType: string; status: '0' | '1'; delFlag: string; }; type DictSearchParams = Partial & CommonSearchParams>; type DictList = Common.PaginatingQueryRecord; } /** * Namespace Dashboard * * Backend api module: "dashboard" */ namespace Dashboard { /** Gauge data */ interface GaugeData { balance: string | number; clientNum: number; traffic: number; trafficUsed: number; trafficEnable: boolean; rateLimitEnable: boolean; upLimitEnable: boolean; downLimitEnable: boolean; upLimit: number; downLimit: number; packageName:string; clientNumEnable:boolean; price:string; error?: any; } } /** * Namespace Device * * Backend api module: "device" */ namespace Device { /** Device information */ interface DeviceInfo { /** Device unique key */ key: string; /** Device name */ deviceName: string; /** MAC address */ macAddress: string; /** Current speed */ speed: string; } /** Device list response */ interface DeviceListResponse { /** List of devices */ rows: DeviceInfo[]; /** Total count */ total: number; } /** Historical device information */ interface HistoricalDeviceInfo { /** Device unique key */ key: string; /** Device name */ deviceName: string; /** MAC address */ macAddress: string; /** Connection time */ connectionTime: string; /** Disconnection time */ disconnectionTime: string; /** Data usage */ dataUsage: string; } /** Historical device list response */ interface HistoricalDeviceListResponse { /** List of historical devices */ rows: HistoricalDeviceInfo[]; /** Total count */ total: number; } interface DeviceInfo { id: number; clientName: string; clientMac: string; clientDeviceType: string; activity: number; } interface DeviceResponse { total: number; rows: DeviceInfo[]; } interface HistoricalDeviceInfo { id: number; clientName: string; clientMac: string; startTime: number; // 时间戳 endTime: number; // 时间戳 duration: number; // 流量使用量(bytes) } interface HistoricalDeviceResponse { total: number; rows: HistoricalDeviceInfo[]; } } namespace CDR { /** CDR record information */ interface CDRRecord { /** Record ID */ id: number; /** AP name */ ap_name: string; /** Upload traffic */ traffic_up: number; /** Download traffic */ traffic_down: number; /** Up time */ up_time: string; /** Last seen time */ last_seen_time: string; } interface CDRRecord { /** Record ID */ id: number; /** Client name */ clientName: string; /** Client MAC address */ clientMac: string; /** Upload traffic in bytes */ trafficUp: number; /** Download traffic in bytes */ trafficDown: number; /** Start time timestamp */ startTime: number; /** End time timestamp */ endTime: number; } /** CDR record list response */ interface CDRListResponse { /** List of CDR records */ rows: CDRRecord[]; /** Total count */ total: number; } /** CDR query params */ interface CDRQueryParams { /** Page number */ pageNum: number; /** Page size */ pageSize: number; } } namespace Package { interface PackageItem { id: string; amount: number; price: number; description?: string; } interface PackageListResponse { code: number; msg: string; data: PackageItem[]; total?: number; } interface OrderSubmitParams { packageId: string; type: 0; // 限定为字面量类型 0 } /** Package history record information */ interface PackageHistoryRecord { /** Record ID */ id: number; /** Order creation time */ createTime: string; /** Order amount */ orderAmount: string; /** Order status: 1-paid, 0-unpaid */ status: number; /** Package information */ upackage?: { /** Package name */ packageName: string; /** Package price */ price: number; /** Whether traffic is limited */ trafficEnable: boolean; /** Traffic limit in bytes */ traffic: number; /** Period number */ periodNum: number; /** Period type: 0-hour, 1-day, 2-month, 3-year */ periodType: number; }; } /** Package history response */ interface PackageHistoryResponse { code: number; msg: string; data: { rows: PackageHistoryRecord[]; total: number; }; } /** Package history response */ interface PackageHistoryResponse { code: number; msg: string; data: { rows: PackageHistoryRecord[]; total: number; }; } /** Package history query parameters */ interface PackageHistoryQueryParams { pageNum: number; pageSize: number; } } /** * Namespace Bill * * Backend api module: "bill" */ namespace Bill { /** Bill record information */ interface BillRecord { id: string; startTime: string | null; endTime: string | null; traffic: string | null; amount: string; status: number; createTime: string; } /** Bill list response */ interface BillListResponse { rows: BillRecord[]; total: number; } /** Bill query parameters */ interface BillQueryParams { pageNum: number; pageSize: number; } } namespace Recharge { /** Recharge record information */ interface RechargeRecord { id: string; delFlag: boolean; createBy: number; createTime: string; updateBy: number; updateTime: string; userId: number; packageId: string | null; paymentId: string | null; orderNo: string | null; type: number; orderAmount: string; status: number; } /** Recharge list response */ interface RechargeListResponse { rows: RechargeRecord[]; total: number; } /** Recharge query parameters */ interface RechargeQueryParams { pageNum: number; pageSize: number; } } namespace Order { /** Order type enum */ type OrderType = 0 | 1 | 2; // 根据实际需要添加其他类型 /** Base order params */ interface BaseOrderParams { type: OrderType; status: number; } /** Package order params */ interface PackageOrderParams extends BaseOrderParams { type: 0; packageId: string; } /** Recharge order params */ interface RechargeOrderParams extends BaseOrderParams { type: 1; orderAmount: number; } /** Combined order params type */ type SubmitOrderParams = PackageOrderParams | RechargeOrderParams; } namespace KYC { /** KYC status enum */ type KYCStatus = 'UNVERIFIED' | 'PENDING' | 'VERIFIED' | 'REJECTED' | 'unverified' | 'pending' | 'verified' | 'rejected'; // 支持大小写 /** KYC info */ interface KYCInfo { status: KYCStatus; fullName?: string; birthDate?: string; idCardFile?: string; photoFile?: string; rejectReason?: string; verifiedTime?: string; } /** KYC response */ interface KYCResponse { code: number; msg: string; data: KYCInfo; } /** ID Type enum */ enum IDType { DRIVERS_LICENSE = 1, PASSPORT = 2, RESIDENCE_PERMIT = 3, STUDENT_ID = 4, MEDICARE_CARD = 5, BIRTH_CERTIFICATE = 6 } /** KYC verify params */ interface KYCVerifyParams { realName:string; birthDate: string; idType: IDType; // 改为数字类型 idFile: string; identifyPicture: string; kycRequestStatus: number; } } }