mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-03 16:22:27 +08:00
feat: 添加使用量统计和数据分析功能
This commit is contained in:
@@ -125,4 +125,21 @@ export function formatBillingType(type: string | undefined | null): string {
|
||||
'free_tier': '免费套餐'
|
||||
}
|
||||
return typeMap[type || ''] || type || '按量付费'
|
||||
}
|
||||
|
||||
// Format cost with 4 decimal places (for cache analysis)
|
||||
export function formatCost(cost: number | null | undefined): string {
|
||||
if (cost === null || cost === undefined) return '-'
|
||||
return `$${cost.toFixed(4)}`
|
||||
}
|
||||
|
||||
// Format remaining time from unix timestamp
|
||||
export function formatRemainingTime(expireAt: number | undefined, currentTime: number): string {
|
||||
if (!expireAt) return '未知'
|
||||
const remaining = expireAt - currentTime
|
||||
if (remaining <= 0) return '已过期'
|
||||
|
||||
const minutes = Math.floor(remaining / 60)
|
||||
const seconds = Math.floor(remaining % 60)
|
||||
return `${minutes}分${seconds}秒`
|
||||
}
|
||||
Reference in New Issue
Block a user