Initial commit: One Pipe System
完整的管理系统,包含账户管理、卡片管理、套餐管理、财务管理等功能模块。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
166
src/types/api/account.ts
Normal file
166
src/types/api/account.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
/**
|
||||
* 账号相关类型定义
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
import { UserRole } from './auth'
|
||||
|
||||
// 账号状态
|
||||
export enum AccountStatus {
|
||||
ENABLED = 1, // 启用
|
||||
DISABLED = 0 // 禁用
|
||||
}
|
||||
|
||||
// 账号实体(统一账号模型,匹配后端 ModelAccountResponse)
|
||||
export interface PlatformAccount {
|
||||
ID: number
|
||||
CreatedAt?: string
|
||||
UpdatedAt?: string
|
||||
DeletedAt?: string | null
|
||||
creator: number // 创建人ID
|
||||
updater: number // 更新人ID
|
||||
username: string
|
||||
phone: string
|
||||
user_type: number // 用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)
|
||||
enterprise_id?: number | null // 关联企业ID
|
||||
shop_id?: number | null // 关联店铺ID
|
||||
status: AccountStatus // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 代理商实体
|
||||
export interface Agent {
|
||||
id: string | number
|
||||
agentCode: string // 代理商编码
|
||||
agentName: string // 代理商名称
|
||||
contactPerson: string // 联系人
|
||||
contactPhone: string // 联系电话
|
||||
email?: string
|
||||
// 层级关系
|
||||
parentId?: string | number // 上级代理商ID
|
||||
parentName?: string // 上级代理商名称
|
||||
level: number // 代理商层级(1为一级代理)
|
||||
// 角色和权限
|
||||
customerRoleId: string | number // 客户角色ID
|
||||
customerRoleName?: string
|
||||
// 状态信息
|
||||
status: AccountStatus
|
||||
// 账号信息
|
||||
username: string // 登录账号
|
||||
// 业务数据
|
||||
cardCount?: number // 网卡数量
|
||||
deviceCount?: number // 设备数量
|
||||
subAgentCount?: number // 下级代理数量
|
||||
// 时间信息
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
creatorName?: string
|
||||
}
|
||||
|
||||
// 企业客户实体
|
||||
export interface EnterpriseCustomer {
|
||||
id: string | number
|
||||
enterpriseCode: string // 企业编码
|
||||
enterpriseName: string // 企业名称
|
||||
contactPerson: string // 联系人
|
||||
contactPhone: string // 联系电话
|
||||
email?: string
|
||||
address?: string
|
||||
// 角色和权限
|
||||
customerRoleId: string | number // 客户角色ID
|
||||
customerRoleName?: string
|
||||
// 状态信息
|
||||
status: AccountStatus
|
||||
// 账号信息
|
||||
username: string // 登录账号
|
||||
// 业务数据
|
||||
cardCount?: number // 网卡数量
|
||||
deviceCount?: number // 设备数量
|
||||
// 时间信息
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
creatorName?: string
|
||||
}
|
||||
|
||||
// 客户账号(代理商+企业客户统一视图)
|
||||
export interface CustomerAccount {
|
||||
id: string | number
|
||||
accountType: 'agent' | 'enterprise' // 账号类型
|
||||
accountCode: string // 账号编码
|
||||
accountName: string // 账号名称
|
||||
username: string
|
||||
phone?: string
|
||||
email?: string
|
||||
customerRoleName?: string
|
||||
status: AccountStatus
|
||||
lastLoginTime?: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
// 账号查询参数
|
||||
export interface AccountQueryParams extends PaginationParams {
|
||||
keyword?: string // 关键词(用户名、姓名、手机号)
|
||||
roleId?: string | number
|
||||
status?: AccountStatus
|
||||
createTimeRange?: [string, string]
|
||||
}
|
||||
|
||||
// 代理商查询参数
|
||||
export interface AgentQueryParams extends PaginationParams {
|
||||
keyword?: string
|
||||
parentId?: string | number
|
||||
level?: number
|
||||
customerRoleId?: string | number
|
||||
status?: AccountStatus
|
||||
}
|
||||
|
||||
// 企业客户查询参数
|
||||
export interface EnterpriseQueryParams extends PaginationParams {
|
||||
keyword?: string
|
||||
customerRoleId?: string | number
|
||||
status?: AccountStatus
|
||||
}
|
||||
|
||||
// 创建账号参数(匹配后端 ModelCreateAccountRequest)
|
||||
export interface CreatePlatformAccountParams {
|
||||
username: string // 用户名 (3-50字符)
|
||||
password: string // 密码 (8-32字符)
|
||||
phone: string // 手机号 (11位)
|
||||
user_type: number // 用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)
|
||||
enterprise_id?: number | null // 关联企业ID(企业账号必填)
|
||||
shop_id?: number | null // 关联店铺ID(代理账号必填)
|
||||
}
|
||||
|
||||
// 创建代理商参数
|
||||
export interface CreateAgentParams {
|
||||
agentCode: string
|
||||
agentName: string
|
||||
contactPerson: string
|
||||
contactPhone: string
|
||||
email?: string
|
||||
parentId?: string | number
|
||||
customerRoleId: string | number
|
||||
username: string
|
||||
password: string
|
||||
status: AccountStatus
|
||||
}
|
||||
|
||||
// 创建企业客户参数
|
||||
export interface CreateEnterpriseParams {
|
||||
enterpriseCode: string
|
||||
enterpriseName: string
|
||||
contactPerson: string
|
||||
contactPhone: string
|
||||
email?: string
|
||||
address?: string
|
||||
customerRoleId: string | number
|
||||
username: string
|
||||
password: string
|
||||
status: AccountStatus
|
||||
}
|
||||
|
||||
// 账号操作参数
|
||||
export interface AccountOperationParams {
|
||||
id: string | number
|
||||
operation: 'resetPassword' | 'unbindPhone' | 'enable' | 'disable' | 'lock'
|
||||
newPassword?: string // 重置密码时需要
|
||||
}
|
||||
65
src/types/api/auth.ts
Normal file
65
src/types/api/auth.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 认证相关类型定义
|
||||
*/
|
||||
|
||||
// 用户角色类型
|
||||
export enum UserRole {
|
||||
SUPER_ADMIN = 'R_SUPER', // 超级管理员
|
||||
ADMIN = 'R_ADMIN', // 管理员
|
||||
AGENT = 'R_AGENT', // 代理商
|
||||
ENTERPRISE = 'R_ENTERPRISE' // 企业客户
|
||||
}
|
||||
|
||||
// 登录请求参数
|
||||
export interface LoginParams {
|
||||
username: string
|
||||
password: string
|
||||
device?: string
|
||||
}
|
||||
|
||||
// 登录响应数据
|
||||
export interface LoginData {
|
||||
access_token: string
|
||||
refresh_token: string
|
||||
expires_in: number
|
||||
permissions?: string[] | null
|
||||
user: UserInfo
|
||||
}
|
||||
|
||||
// 用户信息
|
||||
export interface UserInfo {
|
||||
id: number // 用户ID
|
||||
username: string // 用户名
|
||||
phone: string // 手机号
|
||||
user_type: number // 用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)
|
||||
user_type_name: string // 用户类型名称
|
||||
enterprise_id?: number // 企业ID(可选)
|
||||
enterprise_name?: string // 企业名称(可选)
|
||||
shop_id?: number // 店铺ID(可选)
|
||||
shop_name?: string // 店铺名称(可选)
|
||||
}
|
||||
|
||||
// 获取用户信息响应数据 (GET /api/admin/me)
|
||||
export interface UserInfoResponse {
|
||||
user: UserInfo
|
||||
permissions: string[]
|
||||
}
|
||||
|
||||
// 刷新 Token 参数
|
||||
export interface RefreshTokenParams {
|
||||
refreshToken: string
|
||||
}
|
||||
|
||||
// 刷新 Token 响应数据
|
||||
export interface RefreshTokenData {
|
||||
access_token: string
|
||||
refresh_token: string
|
||||
expires_in: number
|
||||
}
|
||||
|
||||
// 修改密码参数
|
||||
export interface ChangePasswordParams {
|
||||
oldPassword: string
|
||||
newPassword: string
|
||||
confirmPassword: string
|
||||
}
|
||||
229
src/types/api/card.ts
Normal file
229
src/types/api/card.ts
Normal file
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
* 网卡相关类型定义
|
||||
*/
|
||||
|
||||
import { PaginationParams, ImportTask } from './common'
|
||||
|
||||
// 运营商类型
|
||||
export enum Operator {
|
||||
CHINA_MOBILE = 'mobile', // 中国移动
|
||||
CHINA_UNICOM = 'unicom', // 中国联通
|
||||
CHINA_TELECOM = 'telecom', // 中国电信
|
||||
GS_MOBILE = 'gs_mobile', // GS移动
|
||||
GS_UNICOM = 'gs_unicom', // GS联通
|
||||
GS_TELECOM = 'gs_telecom', // GS电信
|
||||
DC_IOT = 'dc_iot', // DC物联
|
||||
GDWL = 'gdwl' // GDWL
|
||||
}
|
||||
|
||||
// 网卡状态
|
||||
export enum CardStatus {
|
||||
ACTIVATED = 1, // 激活
|
||||
DEACTIVATED = 2, // 停用
|
||||
TESTING = 3, // 测试
|
||||
INVENTORY = 4, // 库存
|
||||
SUSPENDED = 5, // 停机
|
||||
EXPIRED = 6 // 已过期
|
||||
}
|
||||
|
||||
// 网络类型
|
||||
export enum NetworkType {
|
||||
'2G' = '2G',
|
||||
'3G' = '3G',
|
||||
'4G' = '4G',
|
||||
'5G' = '5G',
|
||||
NB_IOT = 'NB-IoT'
|
||||
}
|
||||
|
||||
// 卡类型
|
||||
export enum CardType {
|
||||
MONTHLY = 'monthly', // 月卡
|
||||
ANNUAL = 'annual', // 年卡
|
||||
FLOW = 'flow' // 流量卡
|
||||
}
|
||||
|
||||
// 号卡商品实体
|
||||
export interface SimCardProduct {
|
||||
id: string | number
|
||||
productCode: string // 商品编码
|
||||
productName: string // 商品名称
|
||||
operator: Operator // 运营商
|
||||
networkType: NetworkType // 网络类型
|
||||
cardType: CardType // 卡类型
|
||||
description?: string
|
||||
price?: number // 价格
|
||||
status: 1 | 0 // 上架/下架
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
// 网卡实体
|
||||
export interface Card {
|
||||
id: string | number
|
||||
iccid: string // ICCID
|
||||
imsi?: string // IMSI
|
||||
msisdn?: string // 手机号码
|
||||
operator: Operator // 运营商
|
||||
networkType: NetworkType
|
||||
cardType: CardType
|
||||
status: CardStatus
|
||||
// 关联信息
|
||||
productId?: string | number // 关联商品ID
|
||||
productName?: string
|
||||
packageId?: string | number // 当前套餐ID
|
||||
packageName?: string
|
||||
agentId?: string | number // 所属代理商ID
|
||||
agentName?: string
|
||||
deviceId?: string | number // 绑定设备ID
|
||||
deviceCode?: string
|
||||
// 业务信息
|
||||
totalFlow?: number // 总流量(MB)
|
||||
usedFlow?: number // 已用流量(MB)
|
||||
remainFlow?: number // 剩余流量(MB)
|
||||
expireTime?: string // 过期时间
|
||||
activateTime?: string // 激活时间
|
||||
walletBalance?: number // 钱包余额
|
||||
// 导入信息
|
||||
importBatch?: string // 导入批次
|
||||
importTime?: string
|
||||
// 公司信息
|
||||
cardCompanyId?: string | number
|
||||
cardCompanyName?: string
|
||||
// 时间信息
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
// 网卡查询参数
|
||||
export interface CardQueryParams extends PaginationParams {
|
||||
keyword?: string // ICCID/IMSI/手机号
|
||||
operator?: Operator
|
||||
status?: CardStatus
|
||||
agentId?: string | number
|
||||
packageId?: string | number
|
||||
cardCompanyId?: string | number
|
||||
importBatch?: string
|
||||
expireTimeRange?: [string, string]
|
||||
importTimeRange?: [string, string]
|
||||
}
|
||||
|
||||
// 网卡导入批次信息
|
||||
export interface CardImportBatch extends ImportTask {
|
||||
importBatch: string // 导入批次号
|
||||
agentId?: string | number
|
||||
agentName?: string
|
||||
packageId?: string | number
|
||||
packageName?: string
|
||||
cardCompanyId?: string | number
|
||||
cardCompanyName?: string
|
||||
operator: Operator
|
||||
cardType: CardType
|
||||
operatorUser?: string // 操作人
|
||||
}
|
||||
|
||||
// 网卡操作类型
|
||||
export enum CardOperationType {
|
||||
RECHARGE = 'recharge', // 套餐充值
|
||||
SUSPEND = 'suspend', // 停机
|
||||
RESUME = 'resume', // 复机
|
||||
CHANGE_EXPIRE_TIME = 'changeExpireTime', // 更改过期时间
|
||||
TRANSFER = 'transfer', // 转卡
|
||||
ADD_FLOW = 'addFlow', // 增加流量
|
||||
REDUCE_FLOW = 'reduceFlow', // 减少流量
|
||||
CHANGE_WALLET = 'changeWallet', // 变更钱包余额
|
||||
RESET_PASSWORD = 'resetPassword', // 充值支付密码
|
||||
RENEW = 'renew' // 续充
|
||||
}
|
||||
|
||||
// 网卡操作参数
|
||||
export interface CardOperationParams {
|
||||
iccid: string
|
||||
operation: CardOperationType
|
||||
// 不同操作需要的参数
|
||||
packageId?: string | number // 套餐充值
|
||||
expireTime?: string // 更改过期时间
|
||||
targetIccid?: string // 转卡目标ICCID
|
||||
flow?: number // 增减流量
|
||||
amount?: number // 金额
|
||||
password?: string // 密码
|
||||
remark?: string // 备注
|
||||
}
|
||||
|
||||
// 号卡分配参数
|
||||
export interface CardAssignParams {
|
||||
productId: string | number
|
||||
agentId: string | number
|
||||
commissionMode: 'template' | 'custom' // 佣金模式:模板/自定义
|
||||
commissionTemplateId?: string | number // 佣金模板ID
|
||||
commissionRate?: number // 自定义佣金比例
|
||||
quantity: number // 分配数量
|
||||
}
|
||||
|
||||
// 网卡批量充值记录
|
||||
export interface BatchRechargeRecord {
|
||||
id: string | number
|
||||
batchNo: string // 批次号
|
||||
fileName: string // 文件名
|
||||
totalCount: number
|
||||
successCount: number
|
||||
failCount: number
|
||||
totalAmount?: number // 总金额
|
||||
status: 'pending' | 'processing' | 'completed' | 'failed'
|
||||
createTime: string
|
||||
operatorName?: string
|
||||
}
|
||||
|
||||
// 换卡申请
|
||||
export interface CardChangeApplication {
|
||||
id: string | number
|
||||
applicationNo: string // 申请单号
|
||||
oldIccid: string // 旧ICCID
|
||||
newIccid?: string // 新ICCID
|
||||
reason: string // 换卡原因
|
||||
status: 'pending' | 'approved' | 'rejected' | 'completed'
|
||||
applicantId: string | number
|
||||
applicantName: string
|
||||
applicantType: 'agent' | 'enterprise'
|
||||
applyTime: string
|
||||
processTime?: string
|
||||
processorName?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 处理换卡申请参数
|
||||
export interface ProcessCardChangeParams {
|
||||
id: string | number
|
||||
status: 'approved' | 'rejected'
|
||||
newIccid?: string // 通过时填写
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 流量详情
|
||||
export interface FlowDetail {
|
||||
date: string
|
||||
usedFlow: number // MB
|
||||
description?: string
|
||||
}
|
||||
|
||||
// 停复机记录
|
||||
export interface SuspendResumeRecord {
|
||||
id: string | number
|
||||
iccid: string
|
||||
operation: 'suspend' | 'resume'
|
||||
operatorName: string
|
||||
operateTime: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 网卡历史订单
|
||||
export interface CardOrder {
|
||||
id: string | number
|
||||
orderNo: string
|
||||
iccid: string
|
||||
orderType: 'recharge' | 'renew' | 'transfer'
|
||||
packageName?: string
|
||||
amount: number
|
||||
status: 'pending' | 'success' | 'failed'
|
||||
createTime: string
|
||||
payTime?: string
|
||||
}
|
||||
236
src/types/api/commission.ts
Normal file
236
src/types/api/commission.ts
Normal file
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
* 佣金相关类型定义
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 佣金状态
|
||||
export enum CommissionStatus {
|
||||
PENDING = 'pending', // 待结算
|
||||
SETTLED = 'settled', // 已结算
|
||||
WITHDRAWN = 'withdrawn', // 已提现
|
||||
FROZEN = 'frozen' // 冻结
|
||||
}
|
||||
|
||||
// 提现状态
|
||||
export enum WithdrawalStatus {
|
||||
PENDING = 'pending', // 待审核
|
||||
APPROVED = 'approved', // 已通过
|
||||
REJECTED = 'rejected', // 已拒绝
|
||||
PROCESSING = 'processing', // 处理中
|
||||
COMPLETED = 'completed', // 已完成
|
||||
FAILED = 'failed' // 失败
|
||||
}
|
||||
|
||||
// 佣金类型
|
||||
export enum CommissionType {
|
||||
CARD_SALE = 'cardSale', // 号卡销售佣金
|
||||
PACKAGE_SALE = 'packageSale', // 套餐销售佣金
|
||||
RECHARGE = 'recharge', // 充值佣金
|
||||
RENEWAL = 'renewal' // 续费佣金
|
||||
}
|
||||
|
||||
// 分佣模板
|
||||
export interface CommissionTemplate {
|
||||
id: string | number
|
||||
templateCode: string // 模板编码
|
||||
templateName: string // 模板名称
|
||||
description?: string
|
||||
// 分佣规则
|
||||
rules: CommissionRule[]
|
||||
status: 1 | 0 // 启用/禁用
|
||||
isDefault: boolean // 是否默认模板
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
creatorName?: string
|
||||
}
|
||||
|
||||
// 分佣规则
|
||||
export interface CommissionRule {
|
||||
id?: string | number
|
||||
type: CommissionType // 佣金类型
|
||||
rateType: 'fixed' | 'percentage' // 固定金额/百分比
|
||||
value: number // 金额或百分比值
|
||||
minAmount?: number // 最小触发金额
|
||||
maxAmount?: number // 最大触发金额
|
||||
description?: string
|
||||
}
|
||||
|
||||
// 佣金记录
|
||||
export interface CommissionRecord {
|
||||
id: string | number
|
||||
recordNo: string // 记录编号
|
||||
// 关联信息
|
||||
accountId: string | number
|
||||
accountName: string
|
||||
accountType: 'agent' | 'enterprise'
|
||||
// 佣金信息
|
||||
type: CommissionType
|
||||
amount: number // 佣金金额
|
||||
sourceAmount: number // 源交易金额
|
||||
rate: number // 佣金比例
|
||||
status: CommissionStatus
|
||||
// 来源信息
|
||||
sourceType: 'card' | 'package' | 'recharge' // 来源类型
|
||||
sourceId: string | number // 来源ID
|
||||
sourceName?: string
|
||||
orderId?: string | number // 关联订单ID
|
||||
orderNo?: string
|
||||
// 结算信息
|
||||
settleTime?: string // 结算时间
|
||||
withdrawTime?: string // 提现时间
|
||||
withdrawId?: string | number // 提现申请ID
|
||||
// 时间信息
|
||||
createTime: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 提现申请
|
||||
export interface WithdrawalApplication {
|
||||
id: string | number
|
||||
applicationNo: string // 申请单号
|
||||
// 申请人信息
|
||||
applicantId: string | number
|
||||
applicantName: string
|
||||
applicantType: 'agent' | 'enterprise'
|
||||
// 提现信息
|
||||
amount: number // 提现金额
|
||||
fee?: number // 手续费
|
||||
actualAmount?: number // 实际到账金额
|
||||
status: WithdrawalStatus
|
||||
// 收款信息
|
||||
bankName?: string // 银行名称
|
||||
bankAccount?: string // 银行账号
|
||||
accountName?: string // 账户名
|
||||
alipayAccount?: string // 支付宝账号
|
||||
wechatAccount?: string // 微信账号
|
||||
paymentMethod: 'bank' | 'alipay' | 'wechat' // 支付方式
|
||||
// 审核信息
|
||||
applyTime: string
|
||||
processTime?: string // 处理时间
|
||||
processorId?: string | number
|
||||
processorName?: string
|
||||
rejectReason?: string // 拒绝原因
|
||||
// 完成信息
|
||||
completeTime?: string
|
||||
transactionNo?: string // 交易流水号
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 客户账户(佣金视图)
|
||||
export interface CustomerCommissionAccount {
|
||||
id: string | number
|
||||
accountId: string | number
|
||||
accountName: string
|
||||
accountType: 'agent' | 'enterprise'
|
||||
// 佣金统计
|
||||
totalCommission: number // 总佣金
|
||||
settledCommission: number // 已结算佣金
|
||||
withdrawnCommission: number // 已提现佣金
|
||||
pendingCommission: number // 待结算佣金
|
||||
frozenCommission: number // 冻结佣金
|
||||
availableCommission: number // 可提现佣金
|
||||
// 提现统计
|
||||
totalWithdrawal: number // 累计提现
|
||||
withdrawalCount: number // 提现次数
|
||||
lastWithdrawalTime?: string // 最后提现时间
|
||||
// 时间信息
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
// 我的账户(当前登录账号的佣金数据)
|
||||
export interface MyCommissionAccount {
|
||||
// 佣金概览
|
||||
totalCommission: number
|
||||
settledCommission: number
|
||||
withdrawnCommission: number
|
||||
pendingCommission: number
|
||||
availableCommission: number
|
||||
frozenCommission: number
|
||||
// 本月数据
|
||||
monthCommission: number // 本月佣金
|
||||
monthSettled: number // 本月已结算
|
||||
// 今日数据
|
||||
todayCommission: number
|
||||
// 提现信息
|
||||
totalWithdrawal: number
|
||||
withdrawalCount: number
|
||||
pendingWithdrawal: number // 待审核提现
|
||||
// 图表数据(近7天/30天)
|
||||
chartData?: {
|
||||
dates: string[]
|
||||
commissions: number[]
|
||||
}
|
||||
}
|
||||
|
||||
// 佣金提现设置
|
||||
export interface WithdrawalSetting {
|
||||
id: string | number
|
||||
// 提现规则
|
||||
minAmount: number // 最小提现金额
|
||||
maxAmount?: number // 最大提现金额
|
||||
dailyLimit?: number // 每日提现次数限制
|
||||
fee: number // 手续费
|
||||
feeType: 'fixed' | 'percentage' // 固定金额/百分比
|
||||
// 审核设置
|
||||
autoApprove: boolean // 是否自动审核
|
||||
autoApproveAmount?: number // 自动审核金额阈值
|
||||
// 到账时间
|
||||
arrivalDays: number // 预计到账天数
|
||||
// 生效时间
|
||||
effectiveTime: string
|
||||
createTime: string
|
||||
creatorName?: string
|
||||
}
|
||||
|
||||
// 佣金查询参数
|
||||
export interface CommissionQueryParams extends PaginationParams {
|
||||
accountId?: string | number
|
||||
accountType?: 'agent' | 'enterprise'
|
||||
type?: CommissionType
|
||||
status?: CommissionStatus
|
||||
amountRange?: [number, number]
|
||||
createTimeRange?: [string, string]
|
||||
settleTimeRange?: [string, string]
|
||||
}
|
||||
|
||||
// 提现查询参数
|
||||
export interface WithdrawalQueryParams extends PaginationParams {
|
||||
applicationNo?: string
|
||||
applicantId?: string | number
|
||||
applicantName?: string
|
||||
status?: WithdrawalStatus
|
||||
paymentMethod?: 'bank' | 'alipay' | 'wechat'
|
||||
amountRange?: [number, number]
|
||||
applyTimeRange?: [string, string]
|
||||
}
|
||||
|
||||
// 创建分佣模板参数
|
||||
export interface CreateCommissionTemplateParams {
|
||||
templateCode: string
|
||||
templateName: string
|
||||
description?: string
|
||||
rules: CommissionRule[]
|
||||
isDefault: boolean
|
||||
}
|
||||
|
||||
// 申请提现参数
|
||||
export interface ApplyWithdrawalParams {
|
||||
amount: number
|
||||
paymentMethod: 'bank' | 'alipay' | 'wechat'
|
||||
bankName?: string
|
||||
bankAccount?: string
|
||||
accountName?: string
|
||||
alipayAccount?: string
|
||||
wechatAccount?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 审核提现参数
|
||||
export interface ProcessWithdrawalParams {
|
||||
id: string | number
|
||||
status: 'approved' | 'rejected'
|
||||
rejectReason?: string
|
||||
remark?: string
|
||||
}
|
||||
75
src/types/api/common.ts
Normal file
75
src/types/api/common.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* API 通用类型定义
|
||||
*/
|
||||
|
||||
// 基础响应类型
|
||||
export interface BaseResponse<T = any> {
|
||||
code: number
|
||||
msg: string
|
||||
data: T
|
||||
timestamp?: string
|
||||
}
|
||||
|
||||
// 分页请求参数
|
||||
export interface PaginationParams {
|
||||
current?: number
|
||||
size?: number
|
||||
pageNum?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
// 分页响应数据
|
||||
export interface PaginationData<T> {
|
||||
items: T[] // 后端实际返回的是 items,不是 records
|
||||
total: number
|
||||
size: number
|
||||
page: number // 后端返回的是 page,不是 current
|
||||
pages?: number
|
||||
}
|
||||
|
||||
// 分页响应
|
||||
export interface PaginationResponse<T = any> extends BaseResponse {
|
||||
data: PaginationData<T>
|
||||
}
|
||||
|
||||
// 列表响应
|
||||
export interface ListResponse<T = any> extends BaseResponse {
|
||||
data: T[]
|
||||
}
|
||||
|
||||
// 日期范围参数
|
||||
export type DateRange = [string, string] | string[]
|
||||
|
||||
// 排序参数
|
||||
export interface SortParams {
|
||||
field?: string
|
||||
order?: 'asc' | 'desc' | 'ascending' | 'descending'
|
||||
}
|
||||
|
||||
// 批量操作参数
|
||||
export interface BatchOperationParams<T = any> {
|
||||
ids: (string | number)[]
|
||||
data?: T
|
||||
}
|
||||
|
||||
// 导入任务状态
|
||||
export enum ImportTaskStatus {
|
||||
PENDING = 'pending',
|
||||
PROCESSING = 'processing',
|
||||
SUCCESS = 'success',
|
||||
FAILED = 'failed',
|
||||
PARTIAL_SUCCESS = 'partial_success'
|
||||
}
|
||||
|
||||
// 导入任务信息
|
||||
export interface ImportTask {
|
||||
id: string | number
|
||||
fileName: string
|
||||
status: ImportTaskStatus
|
||||
totalCount: number
|
||||
successCount: number
|
||||
failCount: number
|
||||
createdTime: string
|
||||
completedTime?: string
|
||||
errorMessage?: string
|
||||
}
|
||||
143
src/types/api/device.ts
Normal file
143
src/types/api/device.ts
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* 设备相关类型定义
|
||||
*/
|
||||
|
||||
import { PaginationParams, ImportTask } from './common'
|
||||
|
||||
// 设备状态
|
||||
export enum DeviceStatus {
|
||||
ONLINE = 'online', // 在线
|
||||
OFFLINE = 'offline', // 离线
|
||||
FAULT = 'fault', // 故障
|
||||
MAINTENANCE = 'maintenance' // 维护中
|
||||
}
|
||||
|
||||
// 设备操作类型
|
||||
export enum DeviceOperationType {
|
||||
RESTART = 'restart', // 重启
|
||||
RESET = 'reset', // 重置
|
||||
UPGRADE = 'upgrade', // 升级
|
||||
CONFIG = 'config', // 配置
|
||||
BIND_CARD = 'bindCard', // 绑定网卡
|
||||
UNBIND_CARD = 'unbindCard' // 解绑网卡
|
||||
}
|
||||
|
||||
// 设备实体
|
||||
export interface Device {
|
||||
id: string | number
|
||||
deviceCode: string // 设备编码
|
||||
deviceName?: string // 设备名称
|
||||
deviceType?: string // 设备类型
|
||||
model?: string // 设备型号
|
||||
manufacturer?: string // 制造商
|
||||
// 网卡信息
|
||||
currentIccid?: string // 当前绑定的ICCID
|
||||
currentOperator?: string // 当前运营商
|
||||
currentImei?: string // IMEI
|
||||
// 卡槽信息(双卡设备)
|
||||
card1Iccid?: string
|
||||
card1Operator?: string
|
||||
card2Iccid?: string
|
||||
card2Operator?: string
|
||||
// 状态信息
|
||||
status: DeviceStatus
|
||||
onlineStatus: boolean // 在线状态
|
||||
lastOnlineTime?: string // 最后在线时间
|
||||
// 所属信息
|
||||
agentId?: string | number
|
||||
agentName?: string
|
||||
// 位置信息
|
||||
location?: string
|
||||
latitude?: number
|
||||
longitude?: number
|
||||
// 其他信息
|
||||
firmwareVersion?: string // 固件版本
|
||||
hardwareVersion?: string // 硬件版本
|
||||
activateTime?: string // 激活时间
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
// 设备查询参数
|
||||
export interface DeviceQueryParams extends PaginationParams {
|
||||
keyword?: string // 设备编码/名称/ICCID
|
||||
deviceType?: string
|
||||
status?: DeviceStatus
|
||||
onlineStatus?: boolean
|
||||
agentId?: string | number
|
||||
hasCard?: boolean // 是否绑定网卡
|
||||
operator?: string
|
||||
}
|
||||
|
||||
// 设备操作参数
|
||||
export interface DeviceOperationParams {
|
||||
deviceId: string | number
|
||||
operation: DeviceOperationType
|
||||
iccid?: string // 绑定/解绑网卡时需要
|
||||
config?: Record<string, any> // 配置参数
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 设备卡信息
|
||||
export interface DeviceCardInfo {
|
||||
deviceId: string | number
|
||||
deviceCode: string
|
||||
// 主卡信息
|
||||
mainCard?: {
|
||||
iccid: string
|
||||
operator: string
|
||||
imei?: string
|
||||
status: string
|
||||
signal?: number // 信号强度
|
||||
flow?: {
|
||||
total: number
|
||||
used: number
|
||||
remain: number
|
||||
}
|
||||
}
|
||||
// 副卡信息(双卡设备)
|
||||
viceCard?: {
|
||||
iccid: string
|
||||
operator: string
|
||||
imei?: string
|
||||
status: string
|
||||
signal?: number
|
||||
flow?: {
|
||||
total: number
|
||||
used: number
|
||||
remain: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 修改设备卡信息参数
|
||||
export interface UpdateDeviceCardParams {
|
||||
deviceId: string | number
|
||||
mainCardIccid?: string
|
||||
viceCardIccid?: string
|
||||
}
|
||||
|
||||
// 设备批量分配参数
|
||||
export interface DeviceBatchAssignParams {
|
||||
deviceIds: (string | number)[]
|
||||
targetAgentId: string | number
|
||||
includeCards: boolean // 是否连同网卡一起分配
|
||||
}
|
||||
|
||||
// 设备导入任务
|
||||
export interface DeviceImportTask extends ImportTask {
|
||||
agentId?: string | number
|
||||
agentName?: string
|
||||
operatorName?: string
|
||||
}
|
||||
|
||||
// 设备导入数据项
|
||||
export interface DeviceImportItem {
|
||||
deviceCode: string
|
||||
deviceName?: string
|
||||
deviceType?: string
|
||||
iccid?: string // 绑定的ICCID
|
||||
card1Iccid?: string
|
||||
card2Iccid?: string
|
||||
location?: string
|
||||
}
|
||||
42
src/types/api/index.ts
Normal file
42
src/types/api/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* API 类型统一导出
|
||||
*/
|
||||
|
||||
// 通用类型
|
||||
export * from './common'
|
||||
|
||||
// 认证相关
|
||||
export * from './auth'
|
||||
|
||||
// 角色相关
|
||||
export * from './role'
|
||||
|
||||
// 权限相关
|
||||
export * from './permission'
|
||||
|
||||
// 账号相关
|
||||
export * from './account'
|
||||
|
||||
// 平台账号相关
|
||||
export * from './platformAccount'
|
||||
|
||||
// 代理账号相关
|
||||
export * from './shopAccount'
|
||||
|
||||
// 店铺相关
|
||||
export * from './shop'
|
||||
|
||||
// 网卡相关
|
||||
export * from './card'
|
||||
|
||||
// 套餐相关
|
||||
export * from './package'
|
||||
|
||||
// 设备相关
|
||||
export * from './device'
|
||||
|
||||
// 佣金相关
|
||||
export * from './commission'
|
||||
|
||||
// 设置相关
|
||||
export * from './setting'
|
||||
142
src/types/api/package.ts
Normal file
142
src/types/api/package.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
/**
|
||||
* 套餐相关类型定义
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
import { Operator } from './card'
|
||||
|
||||
// 套餐状态
|
||||
export enum PackageStatus {
|
||||
ENABLED = 1, // 启用
|
||||
DISABLED = 0 // 禁用
|
||||
}
|
||||
|
||||
// 套餐类型
|
||||
export enum PackageType {
|
||||
MONTHLY = 'monthly', // 月套餐
|
||||
ANNUAL = 'annual', // 年套餐
|
||||
FLOW = 'flow' // 流量包
|
||||
}
|
||||
|
||||
// 套餐系列
|
||||
export interface PackageSeries {
|
||||
id: string | number
|
||||
seriesCode: string // 系列编码
|
||||
seriesName: string // 系列名称
|
||||
operator: Operator // 运营商
|
||||
description?: string
|
||||
status: PackageStatus
|
||||
packageCount?: number // 系列下套餐数量
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
creatorName?: string
|
||||
}
|
||||
|
||||
// 套餐实体
|
||||
export interface Package {
|
||||
id: string | number
|
||||
packageCode: string // 套餐编码
|
||||
packageName: string // 套餐名称
|
||||
seriesId: string | number // 所属系列ID
|
||||
seriesName?: string
|
||||
operator: Operator
|
||||
packageType: PackageType
|
||||
// 套餐内容
|
||||
totalFlow: number // 总流量(MB)
|
||||
duration: number // 有效期(天)
|
||||
price: number // 价格
|
||||
description?: string
|
||||
// 状态和可见性
|
||||
status: PackageStatus
|
||||
isPublic: boolean // 是否公开(管理员可见全部,代理商只能看到自己的)
|
||||
// 创建信息
|
||||
creatorId: string | number
|
||||
creatorName?: string
|
||||
creatorType: 'admin' | 'agent' // 创建者类型
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
// 套餐查询参数
|
||||
export interface PackageQueryParams extends PaginationParams {
|
||||
keyword?: string // 套餐名称/编码
|
||||
seriesId?: string | number
|
||||
operator?: Operator
|
||||
packageType?: PackageType
|
||||
status?: PackageStatus
|
||||
isPublic?: boolean
|
||||
creatorId?: string | number
|
||||
priceRange?: [number, number]
|
||||
}
|
||||
|
||||
// 套餐系列查询参数
|
||||
export interface PackageSeriesQueryParams extends PaginationParams {
|
||||
keyword?: string
|
||||
operator?: Operator
|
||||
status?: PackageStatus
|
||||
}
|
||||
|
||||
// 创建/编辑套餐系列参数
|
||||
export interface PackageSeriesFormData {
|
||||
seriesCode: string
|
||||
seriesName: string
|
||||
operator: Operator
|
||||
description?: string
|
||||
status: PackageStatus
|
||||
}
|
||||
|
||||
// 创建/编辑套餐参数
|
||||
export interface PackageFormData {
|
||||
packageCode: string
|
||||
packageName: string
|
||||
seriesId: string | number
|
||||
operator: Operator
|
||||
packageType: PackageType
|
||||
totalFlow: number
|
||||
duration: number
|
||||
price: number
|
||||
description?: string
|
||||
status: PackageStatus
|
||||
isPublic: boolean
|
||||
}
|
||||
|
||||
// 套餐分配参数
|
||||
export interface PackageAssignParams {
|
||||
packageId: string | number
|
||||
agentId: string | number // 直级代理ID
|
||||
commissionMode: 'template' | 'custom' // 佣金模式
|
||||
commissionTemplateId?: string | number
|
||||
commissionRate?: number // 自定义佣金比例
|
||||
}
|
||||
|
||||
// 套餐变更记录
|
||||
export interface PackageChangeRecord {
|
||||
id: string | number
|
||||
iccid: string
|
||||
oldPackageId?: string | number
|
||||
oldPackageName?: string
|
||||
newPackageId: string | number
|
||||
newPackageName: string
|
||||
changeType: 'upgrade' | 'downgrade' | 'renew' // 升级/降级/续费
|
||||
amount?: number
|
||||
status: 'pending' | 'success' | 'failed'
|
||||
operatorId: string | number
|
||||
operatorName: string
|
||||
changeTime: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
// 套餐分配记录
|
||||
export interface PackageAssignRecord {
|
||||
id: string | number
|
||||
packageId: string | number
|
||||
packageName: string
|
||||
agentId: string | number
|
||||
agentName: string
|
||||
commissionMode: 'template' | 'custom'
|
||||
commissionTemplateId?: string | number
|
||||
commissionTemplateName?: string
|
||||
commissionRate?: number
|
||||
assignTime: string
|
||||
operatorName?: string
|
||||
}
|
||||
75
src/types/api/permission.ts
Normal file
75
src/types/api/permission.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 权限相关类型定义 - 匹配后端 ModelPermission
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 权限类型
|
||||
export enum PermissionType {
|
||||
MENU = 1, // 菜单权限
|
||||
BUTTON = 2 // 按钮权限
|
||||
}
|
||||
|
||||
// 权限状态
|
||||
export enum PermissionStatus {
|
||||
ENABLED = 1, // 启用
|
||||
DISABLED = 0 // 禁用
|
||||
}
|
||||
|
||||
// 权限实体(匹配后端 ModelPermission)
|
||||
export interface Permission {
|
||||
ID: number
|
||||
CreatedAt?: string
|
||||
UpdatedAt?: string
|
||||
DeletedAt?: string | null
|
||||
creator?: number // 创建人ID
|
||||
updater?: number // 更新人ID
|
||||
perm_name: string // 权限名称
|
||||
perm_code: string // 权限编码
|
||||
perm_type: PermissionType // 权限类型 (1:菜单, 2:按钮)
|
||||
parent_id?: number | null // 父级权限ID
|
||||
url?: string // URL路径
|
||||
platform?: string // 平台标识 (all:全部, web:Web后台, h5:H5端)
|
||||
sort?: number // 排序序号
|
||||
status: PermissionStatus // 状态 (0:禁用, 1:启用)
|
||||
available_for_role_types?: string // 可用的角色类型
|
||||
children?: Permission[] // 子权限列表(树形结构)
|
||||
}
|
||||
|
||||
// 权限树节点
|
||||
export interface PermissionTreeNode {
|
||||
id: string | number
|
||||
label: string
|
||||
value: string
|
||||
permissionCode: string
|
||||
permissionType: PermissionType
|
||||
parentId?: string | number
|
||||
children?: PermissionTreeNode[]
|
||||
}
|
||||
|
||||
// 权限查询参数
|
||||
export interface PermissionQueryParams extends PaginationParams {
|
||||
perm_name?: string // 权限名称模糊查询
|
||||
perm_code?: string // 权限编码模糊查询
|
||||
perm_type?: number | null // 权限类型 (1:菜单, 2:按钮)
|
||||
status?: number | null // 状态 (0:禁用, 1:启用)
|
||||
parent_id?: number | null // 父权限ID
|
||||
platform?: string // 适用端口 (all:全部, web:Web后台, h5:H5端)
|
||||
available_for_role_type?: number | null // 可用角色类型 (1:平台角色, 2:客户角色)
|
||||
}
|
||||
|
||||
// 创建权限参数
|
||||
export interface CreatePermissionParams {
|
||||
perm_name: string // 权限名称
|
||||
perm_code: string // 权限编码
|
||||
perm_type: number // 权限类型 (1:菜单, 2:按钮)
|
||||
parent_id?: number | null // 父权限ID
|
||||
url?: string // 请求路径
|
||||
platform?: string // 适用端口 (all:全部, web:Web后台, h5:H5端),默认为 all
|
||||
sort?: number // 排序值
|
||||
}
|
||||
|
||||
// 更新权限参数
|
||||
export interface UpdatePermissionParams extends Partial<CreatePermissionParams> {
|
||||
status?: number // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
82
src/types/api/platformAccount.ts
Normal file
82
src/types/api/platformAccount.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 平台账号相关类型定义 - 匹配后端 API 文档
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 平台账号响应实体(匹配后端 ModelAccountResponse - 使用大写字段名)
|
||||
export interface PlatformAccountResponse {
|
||||
ID: number // 账号ID
|
||||
CreatedAt?: string // 创建时间
|
||||
UpdatedAt?: string // 更新时间
|
||||
DeletedAt?: string | null // 删除时间
|
||||
creator?: number // 创建人ID
|
||||
updater?: number // 更新人ID
|
||||
username: string // 用户名
|
||||
phone: string // 手机号
|
||||
user_type: number // 用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)
|
||||
enterprise_id?: number | null // 关联企业ID
|
||||
shop_id?: number | null // 关联店铺ID
|
||||
status: number // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 平台账号列表查询参数
|
||||
export interface PlatformAccountQueryParams extends PaginationParams {
|
||||
username?: string // 用户名模糊查询
|
||||
phone?: string // 手机号模糊查询
|
||||
status?: number | null // 状态 (0:禁用, 1:启用)
|
||||
page?: number // 页码
|
||||
page_size?: number // 每页数量
|
||||
}
|
||||
|
||||
// 创建平台账号参数(匹配后端 ModelCreateAccountRequest)
|
||||
export interface CreatePlatformAccountParams {
|
||||
username: string // 用户名
|
||||
password: string // 密码
|
||||
phone: string // 手机号
|
||||
user_type: number // 用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)
|
||||
enterprise_id?: number | null // 关联企业ID(企业账号必填)
|
||||
shop_id?: number | null // 关联店铺ID(代理账号必填)
|
||||
}
|
||||
|
||||
// 更新平台账号参数(匹配后端 ModelUpdateAccountParams)
|
||||
export interface UpdatePlatformAccountParams {
|
||||
username?: string | null // 用户名
|
||||
password?: string | null // 密码
|
||||
phone?: string | null // 手机号
|
||||
status?: number | null // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 修改密码参数
|
||||
export interface ChangePlatformAccountPasswordParams {
|
||||
new_password: string // 新密码
|
||||
}
|
||||
|
||||
// 分配角色参数
|
||||
export interface AssignRolesParams {
|
||||
role_ids: number[] // 角色ID列表
|
||||
}
|
||||
|
||||
// 启用/禁用账号参数
|
||||
export interface UpdateAccountStatusParams {
|
||||
status: number // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 平台账号角色响应
|
||||
export interface PlatformAccountRoleResponse {
|
||||
creator?: number // 创建人ID
|
||||
role_desc?: string // 角色描述
|
||||
role_name?: string // 角色名称
|
||||
role_type?: number // 角色类型
|
||||
status?: number // 状态
|
||||
updater?: number // 更新人ID
|
||||
ID?: number // 角色ID
|
||||
}
|
||||
|
||||
// 平台账号列表分页响应(匹配后端 ModelAccountPageResult)
|
||||
export interface PlatformAccountPageResult {
|
||||
items: PlatformAccountResponse[] | null // 账号列表
|
||||
page?: number // 当前页码
|
||||
size?: number // 每页数量
|
||||
total?: number // 总记录数
|
||||
}
|
||||
48
src/types/api/request.ts
Normal file
48
src/types/api/request.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 请求相关类型定义
|
||||
*/
|
||||
|
||||
// 错误消息模式
|
||||
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined
|
||||
|
||||
// 请求配置选项
|
||||
export interface RequestOptions {
|
||||
// 是否将参数拼接到URL
|
||||
joinParamsToUrl?: boolean
|
||||
// 是否格式化日期
|
||||
formatDate?: boolean
|
||||
// 是否转换响应数据
|
||||
isTransformResponse?: boolean
|
||||
// 是否返回原生响应
|
||||
isReturnNativeResponse?: boolean
|
||||
// 是否添加前缀
|
||||
joinPrefix?: boolean
|
||||
// API URL
|
||||
apiUrl?: string
|
||||
// 错误消息模式
|
||||
errorMessageMode?: ErrorMessageMode
|
||||
// 是否添加时间戳
|
||||
joinTime?: boolean
|
||||
// 是否忽略取消令牌
|
||||
ignoreCancelToken?: boolean
|
||||
// 是否携带token
|
||||
withToken?: boolean
|
||||
}
|
||||
|
||||
// 请求方法类型
|
||||
export type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
|
||||
|
||||
// 请求头类型
|
||||
export interface RequestHeaders {
|
||||
[key: string]: string | number | boolean
|
||||
}
|
||||
|
||||
// 基础请求配置
|
||||
export interface BaseRequestConfig {
|
||||
url: string
|
||||
method?: RequestMethod
|
||||
headers?: RequestHeaders
|
||||
params?: Record<string, any>
|
||||
data?: any
|
||||
timeout?: number
|
||||
}
|
||||
54
src/types/api/response.ts
Normal file
54
src/types/api/response.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 响应相关类型定义
|
||||
*/
|
||||
|
||||
// 基础接口返回的数据结构
|
||||
export interface BaseResponse<T = any> {
|
||||
// 状态码
|
||||
code: number
|
||||
// 消息
|
||||
msg: string
|
||||
// 数据
|
||||
data: T
|
||||
// 可选字段,用于返回 token
|
||||
token?: string
|
||||
}
|
||||
|
||||
// 分页查询参数
|
||||
export interface PaginationParams {
|
||||
// 当前页码
|
||||
page: number
|
||||
// 每页数量
|
||||
pageSize: number
|
||||
// 其他查询参数
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
// 分页响应数据结构
|
||||
export interface PaginationResponse<T> extends BaseResponse {
|
||||
// 当前页
|
||||
currentPage: number
|
||||
// 每页条数
|
||||
pageSize: number
|
||||
// 总页数
|
||||
lastPage: number
|
||||
// 总条数
|
||||
total: number
|
||||
// 数据列表
|
||||
data: T[]
|
||||
}
|
||||
|
||||
// 列表响应数据结构
|
||||
export interface ListResponse<T> extends BaseResponse {
|
||||
data: T[]
|
||||
}
|
||||
|
||||
// 详情响应数据结构
|
||||
export interface DetailResponse<T> extends BaseResponse {
|
||||
data: T
|
||||
}
|
||||
|
||||
// 操作响应数据结构(增删改)
|
||||
export interface OperationResponse extends BaseResponse {
|
||||
data: boolean | null
|
||||
}
|
||||
54
src/types/api/role.ts
Normal file
54
src/types/api/role.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 角色相关类型定义 - 匹配后端 ModelRole
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 角色类型
|
||||
export enum RoleType {
|
||||
PLATFORM = 1, // 平台角色
|
||||
CUSTOMER = 2 // 客户角色
|
||||
}
|
||||
|
||||
// 角色状态
|
||||
export enum RoleStatus {
|
||||
ENABLED = 1, // 启用
|
||||
DISABLED = 0 // 禁用
|
||||
}
|
||||
|
||||
// 角色实体(匹配后端 ModelRole)
|
||||
export interface PlatformRole {
|
||||
ID: number
|
||||
CreatedAt?: string
|
||||
UpdatedAt?: string
|
||||
DeletedAt?: string | null
|
||||
creator: number // 创建人ID
|
||||
updater: number // 更新人ID
|
||||
role_name: string // 角色名称
|
||||
role_desc: string // 角色描述
|
||||
role_type: RoleType // 角色类型
|
||||
status: RoleStatus // 状态
|
||||
}
|
||||
|
||||
// 角色查询参数
|
||||
export interface RoleQueryParams extends PaginationParams {
|
||||
role_name?: string
|
||||
role_type?: RoleType
|
||||
status?: RoleStatus
|
||||
}
|
||||
|
||||
// 创建/编辑角色参数
|
||||
export interface PlatformRoleFormData {
|
||||
role_name: string
|
||||
role_desc: string
|
||||
role_type: RoleType
|
||||
status: RoleStatus
|
||||
}
|
||||
|
||||
// 权限树节点
|
||||
export interface PermissionTreeNode {
|
||||
id: number
|
||||
label: string
|
||||
value: string
|
||||
children?: PermissionTreeNode[]
|
||||
}
|
||||
123
src/types/api/setting.ts
Normal file
123
src/types/api/setting.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* 设置相关类型定义
|
||||
*/
|
||||
|
||||
// 支付方式
|
||||
export enum PaymentMethod {
|
||||
ALIPAY = 'alipay', // 支付宝
|
||||
WECHAT = 'wechat', // 微信支付
|
||||
BANK = 'bank' // 银行卡
|
||||
}
|
||||
|
||||
// 收款商户设置
|
||||
export interface PaymentMerchantSetting {
|
||||
id?: string | number
|
||||
// 支付宝配置
|
||||
alipay?: {
|
||||
enabled: boolean
|
||||
appId: string
|
||||
privateKey: string
|
||||
publicKey: string
|
||||
notifyUrl?: string
|
||||
}
|
||||
// 微信支付配置
|
||||
wechat?: {
|
||||
enabled: boolean
|
||||
appId: string
|
||||
mchId: string
|
||||
apiKey: string
|
||||
certPath?: string
|
||||
notifyUrl?: string
|
||||
}
|
||||
// 银行转账配置
|
||||
bank?: {
|
||||
enabled: boolean
|
||||
bankName: string
|
||||
accountName: string
|
||||
accountNumber: string
|
||||
branchName?: string
|
||||
}
|
||||
updateTime?: string
|
||||
updaterName?: string
|
||||
}
|
||||
|
||||
// 开发能力(API Key)
|
||||
export interface DevelopmentCapability {
|
||||
id: string | number
|
||||
accountId: string | number
|
||||
accountName: string
|
||||
// API 密钥
|
||||
appKey: string
|
||||
appSecret: string // 前端只显示部分
|
||||
// 权限范围
|
||||
scopes: string[] // 允许访问的 API 范围
|
||||
// IP 白名单
|
||||
ipWhitelist?: string[]
|
||||
// 状态
|
||||
status: 'active' | 'disabled'
|
||||
// 限流配置
|
||||
rateLimit?: {
|
||||
requestsPerSecond: number
|
||||
requestsPerDay: number
|
||||
}
|
||||
// 统计信息
|
||||
totalCalls?: number // 总调用次数
|
||||
todayCalls?: number // 今日调用次数
|
||||
lastCallTime?: string // 最后调用时间
|
||||
// 时间信息
|
||||
createTime: string
|
||||
updateTime?: string
|
||||
expireTime?: string // 过期时间
|
||||
}
|
||||
|
||||
// 生成 API Key 参数
|
||||
export interface GenerateApiKeyParams {
|
||||
scopes: string[]
|
||||
ipWhitelist?: string[]
|
||||
expireDays?: number // 有效期天数
|
||||
rateLimit?: {
|
||||
requestsPerSecond: number
|
||||
requestsPerDay: number
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新 Secret 响应
|
||||
export interface RefreshSecretResponse {
|
||||
appSecret: string
|
||||
}
|
||||
|
||||
// API 调用日志
|
||||
export interface ApiCallLog {
|
||||
id: string | number
|
||||
appKey: string
|
||||
apiPath: string // API 路径
|
||||
method: string // HTTP 方法
|
||||
requestIp: string
|
||||
requestTime: string
|
||||
responseTime: string
|
||||
duration: number // 耗时(ms)
|
||||
statusCode: number
|
||||
success: boolean
|
||||
errorMessage?: string
|
||||
}
|
||||
|
||||
// 系统通知设置
|
||||
export interface NotificationSetting {
|
||||
id?: string | number
|
||||
// 邮件通知
|
||||
email?: {
|
||||
enabled: boolean
|
||||
events: string[] // 需要邮件通知的事件
|
||||
}
|
||||
// 短信通知
|
||||
sms?: {
|
||||
enabled: boolean
|
||||
events: string[]
|
||||
}
|
||||
// 站内消息
|
||||
internal?: {
|
||||
enabled: boolean
|
||||
events: string[]
|
||||
}
|
||||
updateTime?: string
|
||||
}
|
||||
70
src/types/api/shop.ts
Normal file
70
src/types/api/shop.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* 店铺相关类型定义 - 匹配后端 API 文档
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 店铺响应实体
|
||||
export interface ShopResponse {
|
||||
id: number // 店铺ID
|
||||
created_at: string // 创建时间
|
||||
updated_at: string // 更新时间
|
||||
shop_name: string // 店铺名称
|
||||
shop_code: string // 店铺编号
|
||||
level: number // 店铺层级 (1-7级)
|
||||
parent_id: number | null // 上级店铺ID
|
||||
province: string // 省份
|
||||
city: string // 城市
|
||||
district: string // 区县
|
||||
address: string // 详细地址
|
||||
contact_name: string // 联系人姓名
|
||||
contact_phone: string // 联系人电话
|
||||
status: number // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 店铺列表查询参数
|
||||
export interface ShopQueryParams extends PaginationParams {
|
||||
shop_name?: string // 店铺名称模糊查询
|
||||
shop_code?: string // 店铺编号模糊查询
|
||||
parent_id?: number | null // 上级店铺ID
|
||||
level?: number | null // 店铺层级 (1-7级)
|
||||
status?: number | null // 状态 (0:禁用, 1:启用)
|
||||
page?: number // 页码
|
||||
page_size?: number // 每页数量
|
||||
}
|
||||
|
||||
// 创建店铺参数
|
||||
export interface CreateShopParams {
|
||||
shop_name: string // 店铺名称(必填)
|
||||
shop_code: string // 店铺编号(必填)
|
||||
init_username: string // 初始账号用户名(必填)
|
||||
init_password: string // 初始账号密码(必填)
|
||||
init_phone: string // 初始账号手机号(必填)
|
||||
parent_id?: number | null // 上级店铺ID(一级店铺可不填)
|
||||
province?: string // 省份
|
||||
city?: string // 城市
|
||||
district?: string // 区县
|
||||
address?: string // 详细地址
|
||||
contact_name?: string // 联系人姓名
|
||||
contact_phone?: string // 联系人电话
|
||||
}
|
||||
|
||||
// 更新店铺参数
|
||||
export interface UpdateShopParams {
|
||||
shop_name: string // 店铺名称(必填)
|
||||
status: number // 状态(必填)
|
||||
province?: string // 省份
|
||||
city?: string // 城市
|
||||
district?: string // 区县
|
||||
address?: string // 详细地址
|
||||
contact_name?: string // 联系人姓名
|
||||
contact_phone?: string // 联系人电话
|
||||
}
|
||||
|
||||
// 店铺列表分页响应
|
||||
export interface ShopPageResult {
|
||||
items: ShopResponse[] | null // 店铺列表
|
||||
page?: number // 当前页码
|
||||
size?: number // 每页数量
|
||||
total?: number // 总记录数
|
||||
}
|
||||
58
src/types/api/shopAccount.ts
Normal file
58
src/types/api/shopAccount.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 代理账号相关类型定义 - 匹配后端 API 文档
|
||||
*/
|
||||
|
||||
import { PaginationParams } from './common'
|
||||
|
||||
// 代理账号响应实体(根据API文档使用小写字段名)
|
||||
export interface ShopAccountResponse {
|
||||
id: number // 账号ID
|
||||
created_at: string // 创建时间
|
||||
updated_at: string // 更新时间
|
||||
username: string // 用户名
|
||||
phone: string // 手机号
|
||||
shop_id: number // 店铺ID
|
||||
user_type: number // 用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)
|
||||
status: number // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 代理账号列表查询参数
|
||||
export interface ShopAccountQueryParams extends PaginationParams {
|
||||
username?: string // 用户名模糊查询
|
||||
phone?: string // 手机号精确查询
|
||||
shop_id?: number | null // 店铺ID过滤
|
||||
status?: number | null // 状态 (0:禁用, 1:启用)
|
||||
page?: number // 页码
|
||||
page_size?: number // 每页数量
|
||||
}
|
||||
|
||||
// 创建代理账号参数
|
||||
export interface CreateShopAccountParams {
|
||||
username: string // 用户名
|
||||
password: string // 密码
|
||||
phone: string // 手机号
|
||||
shop_id: number // 店铺ID
|
||||
}
|
||||
|
||||
// 更新代理账号参数
|
||||
export interface UpdateShopAccountParams {
|
||||
username: string // 用户名
|
||||
}
|
||||
|
||||
// 重置密码参数
|
||||
export interface UpdateShopAccountPasswordParams {
|
||||
new_password: string // 新密码
|
||||
}
|
||||
|
||||
// 更新状态参数
|
||||
export interface UpdateShopAccountStatusParams {
|
||||
status: number // 状态 (0:禁用, 1:启用)
|
||||
}
|
||||
|
||||
// 代理账号列表分页响应
|
||||
export interface ShopAccountPageResult {
|
||||
items: ShopAccountResponse[] | null // 账号列表
|
||||
page?: number // 当前页码
|
||||
size?: number // 每页数量
|
||||
total?: number // 总记录数
|
||||
}
|
||||
Reference in New Issue
Block a user