feat(wallet): 钱包系统替代配额系统,新增支付与退款机制

- 新增钱包余额管理、充值、扣费、退款完整流程
- 新增支付网关抽象层(支持手动/支付宝/微信)
- 用量计费从配额系统迁移到钱包余额扣费
- 新增管理员钱包管理与支付订单管理页面
- 新增用户钱包中心页面
- 移除独立 Key 锁定机制,统一由钱包余额控制
- 新增相关 API 路由、序列化器与数据库迁移
- 新增钱包、支付、退款相关测试
This commit is contained in:
LewisPen
2026-03-08 00:05:48 +08:00
committed by fawney19
parent 9cdcce1b5f
commit 783f654953
108 changed files with 13152 additions and 3372 deletions

View File

@@ -102,19 +102,12 @@ export const useUsersStore = defineStore('users', () => {
}
}
async function resetUserQuota(userId: string) {
loading.value = true
error.value = null
async function getFullApiKey(userId: string, keyId: string): Promise<{ key: string }> {
try {
await usersApi.resetUserQuota(userId)
// 刷新用户列表以获取最新数据
await fetchUsers()
return await usersApi.getFullApiKey(userId, keyId)
} catch (err: unknown) {
error.value = parseApiError(err, '重置配额失败')
error.value = parseApiError(err, '获取完整 API Key 失败')
throw err
} finally {
loading.value = false
}
}
@@ -129,6 +122,6 @@ export const useUsersStore = defineStore('users', () => {
getUserApiKeys,
createApiKey,
deleteApiKey,
resetUserQuota
getFullApiKey
}
})