Skip to content

feat(provider): 订阅源流量信息展示#19

Open
PrintNow wants to merge 1 commit into
mainfrom
feat/provider-traffic-info
Open

feat(provider): 订阅源流量信息展示#19
PrintNow wants to merge 1 commit into
mainfrom
feat/provider-traffic-info

Conversation

@PrintNow

Copy link
Copy Markdown
Owner

Summary

  • 解析上游订阅源返回的 subscription-userinfo 响应头,存储流量使用数据(upload/download/total/expire)
  • 前端 Providers 页面新增流量列,展示进度条 + 百分比 + 到期倒计时
  • 拆分 Providers.tsx 为目录结构,遵循 CustomConfigDetail 模式
  • 数据库迁移使用时间戳版本号

Changes

后端:

  • internal/model/provider.go — 新增 4 个可空流量字段
  • internal/service/provider.go — FetchAndCache 解析 subscription-userinfo header
  • internal/repository/migrations/schema.go — 迁移版本号改用时间戳 (20260429133900)

前端:

  • frontend/src/pages/Providers/ — 页面拆分为 traffic + shared 子模块
  • traffic/TrafficCell.tsx — 流量展示组件(进度条、Badge、CalendarDays 图标)
  • traffic/traffic-utils.ts — formatBytes / calcUsagePercent / daysRemaining 等工具函数
  • 安装 shadcn Progress 组件
  • 新增流量相关 i18n 键(zh + en)

Test plan

  • 刷新一个返回 subscription-userinfo 的订阅源,确认 API 响应中 traffic_* 字段有值
  • 刷新一个不返回流量信息的订阅源,确认 traffic_* 字段为 null,前端显示 -
  • 前端流量列正确显示进度条、百分比、已用/总量、到期日期和剩余天数
  • 过期订阅显示红色,临期(≤7天)显示 amber
  • Go 和 TypeScript 编译通过

解析上游订阅源返回的 subscription-userinfo 响应头,存储并展示
流量使用情况(已用/总量进度条、到期时间倒计时)。

后端:
- Provider 模型新增 traffic_upload/download/total/expire_at 字段
- FetchAndCache 中解析 subscription-userinfo header
- 数据库迁移使用时间戳版本号 (20260429133900)

前端:
- 拆分 Providers 页面为目录结构(参考 CustomConfigDetail 模式)
- TrafficCell 组件:进度条 + 百分比 Badge + 到期天数
- 安装 shadcn Progress 组件
- 新增流量相关 i18n 翻译
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant