Skip to content

Commit eaf30f7

Browse files
committed
人民币折算:金额主显 ¥、站点余额次显,消耗统计按充值成本计 (v1.3.0)
- 站点新增「充值折算汇率」(站点 $1 折合 ¥ 多少,留空按 1:1),编辑弹窗配置 - 总览:总剩余余额 / 今日总消耗 / 日均消耗 / 累计已用全部按各站汇率折算成 ¥, 配了汇率时总剩余余额卡片副显站点余额合计($) - 站点行:余额主显 ¥(汇率非 1 时副显站点 $ 余额),用量进度、今日消耗、 日均估算同步折算;总余额趋势图、日均消耗对比图、趋势弹窗均以 ¥ 计 - 用量统计页:实际消耗按各站汇率折算(合并模型/时间桶时逐站换算) - 余额告警不受影响:低余额阈值与耗尽判断仍按站点余额($),表单已注明
1 parent 5d51ab8 commit eaf30f7

6 files changed

Lines changed: 91 additions & 57 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
- **余额预测**:记录余额历史(30 天),线性回归估算日均消耗与预计耗尽时间;点击任意站点查看趋势图(历史折线 + 虚线耗尽投影 + 悬停查看);识别充值,只按最近一段消耗回归
2020
- **通知告警**:余额偏低 / 耗尽 / 查询失败 / 恢复正常 / 预计即将耗尽(**阈值可按天或小时设置**),状态迁移触发、自动去重、可配重复提醒间隔;支持 10 种渠道:
2121
Telegram、钉钉(含加签)、企业微信、飞书(含签名)、Bark、ntfy、Server酱(含 sctp 新版)、Resend 邮件、SMTP 邮件(内置零依赖客户端,465 SSL / 587 STARTTLS)、自定义 Webhook,每个渠道可单独测试
22+
- **人民币折算**:每个站点可配置充值汇率(站点 $1 折合 ¥ 多少,如 1:2 充值);
23+
余额、消耗、图表等金额主显人民币(未配置按 1:1),站点原始余额作为次要信息展示;
24+
**余额告警阈值仍按站点余额判断**,不受汇率影响
2225
- **面板登录**:网页需要账号密码登录(scrypt 哈希 + HMAC 签名会话 Cookie,7 天有效;登录失败限流);默认账号 `admin / admin123`,登录后请在「设置」中修改
2326
- **内置演示**:首次启动自动创建演示中转站(数据来自内置 mock,含完整的登录→过期→自动续期链路演示),可直接删除
2427

lib/store.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export class Store {
177177
email: input.email ? String(input.email).trim() : "",
178178
password: input.password ? String(input.password) : "",
179179
lowBalanceUsd: numOrNull(input.lowBalanceUsd),
180+
// 充值折算汇率:站点 $1 折合人民币(¥);null 按 1:1 展示
181+
cnyPerUsd: numOrNull(input.cnyPerUsd),
180182
demo: !!input.demo,
181183
createdAt: new Date().toISOString(),
182184
s2Tokens: null, // Sub2API 密码模式的令牌缓存 {accessToken, refreshToken, expiresAt}
@@ -199,6 +201,7 @@ export class Store {
199201
for (const f of fields) if (f in patch) s[f] = String(patch[f] ?? "").trim();
200202
if ("password" in patch) s.password = String(patch.password ?? "");
201203
if ("lowBalanceUsd" in patch) s.lowBalanceUsd = numOrNull(patch.lowBalanceUsd);
204+
if ("cnyPerUsd" in patch) s.cnyPerUsd = numOrNull(patch.cnyPerUsd);
202205
// 凭证或站点实际变化才作废令牌缓存(前端编辑总会带上 type/email 原值,
203206
// 无脑作废会导致每次改名都触发一次完整重登录)
204207
const credsChanged =

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "relay-monitor",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"private": true,
55
"description": "监控 sub2api / new-api 中转站余额的网页面板",
66
"type": "module",

0 commit comments

Comments
 (0)