Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ python3 -m http.server 8000 --directory ui
1. 仪表盘 Dashboard — 点数余额、本月用量、共享收益、最近交易
2. 模型市场 Marketplace — 模型浏览、搜索、厂商筛选、排序(按价格/上下文)
3. 共享管理 Sharing — 默认只显示统计 + 我的共享列表(key 脱敏展示,可暂停/恢复/重新上架/彻底删除);点击"+ 添加 / 上架新 key"展开上架表单(须填 API Key,平台加密托管;分享者只填声明额度,单价由平台按模型定价自动计算并展示参考价),提交成功或取消后自动收起
4. 钱包 Wallet — 点数余额、充值/提现占位入口;收支明细已去重,统一到【交易记录】(页内提供跳转提示)
5. 交易记录 Transactions — 消费/收益/充值/提现唯一明细入口,Tab 筛选 + MRT 风格表格(列排序/列筛选/分页,与 Tab 叠加生效)
4. 钱包 Wallet — 点数余额、点数来源(赠送 10 点 · 剩 X 天 / 收益永久 / 充值永久,充值暂未开放)、充值/提现占位入口;收支明细已去重,统一到【交易记录】(页内提供跳转提示)
5. 交易记录 Transactions — 消费/收益/充值/提现/赠送(gift)唯一明细入口,Tab 筛选 + MRT 风格表格(列排序/列筛选/分页,与 Tab 叠加生效)
6. 设置 Settings — 账户、API Key 管理(完整增删改查:生成带名字、改名、删除需确认「删除后该 key 立即失效」、按名字搜索、一键复制完整 key——列表脱敏展示 atk_live_****xxxx,复制为完整值;file:// 下 clipboard API 受限时降级为选中+Ctrl/Cmd+C)、通知、偏好
7. 管理视图 Admin(管理员角色专属)— Key 池管理(添加/撤销)、成员管理(改部门:下拉可选部门或"未分配";任意金额充值,正整数校验;新注册成员默认未分配部门)、用量报表(按模型/成员)、组织管理(部门列表 + 部门增删改查 + 每月点数分配,含部门汇总统计,未分配成员不计入任何部门;保留组织设置卡片,含"关闭外部注册"企业部署开关)

Expand All @@ -54,6 +54,7 @@ ui/
## 数据说明

- 点数规则:1 USD = 1000 点;模型价格折算自 `data/models.example.json`(CNY 按 ~7.2 汇率示例折算)
- 点数机制(v1.2):注册赠送 10 点(1 周有效,钱包显示剩余天数,先扣有有效期的赠送点数);分享收益与未来充值点数永久有效;公共版当前无充值渠道(充值/提现按钮置灰"暂不支持")
- 上架单价不由分享者手填:单价是模型×厂商的客观属性,平台按模型价格表自动计算(参考单价 = 该模型输出价 点数/1M);模型无定价数据时给出"按默认价"兜底,不报错
- 上架需提交 API Key(password 输入):平台加密托管、仅用于代理调用;共享列表只展示脱敏值(如 sk-****1234,前 3 后 4),不展示明文
- 删除 = 彻底下架(key 从平台移除,不可恢复);暂停 = 临时不接单,可恢复
Expand Down
9 changes: 7 additions & 2 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,23 @@ <h3>点数余额 <span class="en">Points balance</span></h3>
<span class="muted wallet-note">充值 / 提现暂不支持(即将上线)</span>
</div>
</div>
<div class="card">
<h3>点数来源 <span class="en">Point sources</span></h3>
<p class="muted">赠送点数 1 周有效(先扣有有效期的赠送点数);收益 / 充值点数永久有效</p>
<div class="mini-list" id="points-sources"></div>
</div>
<div class="card">
<p class="wallet-hint">收支明细已统一到
<button class="btn btn-ghost" id="wallet-goto-tx">交易记录</button>
——涵盖消费(用别人的 key)、收益(别人用我的 key)、充值、提现</p>
——涵盖消费(用别人的 key)、收益(别人用我的 key)、充值、提现、赠送(新人体验券)</p>
</div>
</section>

<!-- 交易记录 Transactions -->
<section class="view hidden" id="view-transactions">
<header class="page-head">
<h2>交易记录 <span class="en">Transactions</span></h2>
<p>涵盖消费(用别人的 key)、收益(别人用我的 key)、充值、提现</p>
<p>涵盖消费(用别人的 key)、收益(别人用我的 key)、充值、提现、赠送(新人体验券)</p>
</header>
<div class="tabs" id="tx-tabs">
<button class="tab active" data-tx-tab="all">全部</button>
Expand Down
17 changes: 13 additions & 4 deletions ui/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
stat("点数余额 Points", D.fmt(D.USER.balance), "1 USD = 1000 点", "accent"),
stat("本月用量 Usage", D.fmt(monthUse) + " 点", "共 " + txs.filter((t) => t.type === "consume").length + " 笔消费"),
stat("共享收益 Earnings", "+" + D.fmt(monthEarn) + " 点", D.SHARINGS.filter((s) => s.status === "on").length + " 个 key 上架中"),
stat("交易笔数 Trades", txs.length + " 笔", "含充值 / 提现 / 消费 / 收益"),
stat("交易笔数 Trades", txs.length + " 笔", "含充值 / 提现 / 消费 / 收益 / 赠送"),
].join("");

$("#dash-recent").innerHTML = recent.map((t) =>
Expand Down Expand Up @@ -262,18 +262,27 @@
// 钱包只做余额与资金操作;收支明细统一到【交易记录】(见 index.html wallet-hint)
$("#side-balance").textContent = D.fmt(D.USER.balance);
$("#wallet-balance").textContent = D.fmt(D.USER.balance);
// 点数来源 / 有效期(v1.2:赠送 1 周有效、收益/充值永久)
const src = $("#points-sources");
if (src) {
src.innerHTML = D.POINT_SOURCES.map((s) =>
'<div class="mini-item"><div><div class="t">' + esc(s.label) + "</div>" +
'<div class="d">' + esc(s.note) + "</div></div>" +
'<div class="r"><span class="pts">' + (s.pts > 0 ? "+" : "") + D.fmt(s.pts) + "</span></div></div>"
).join("");
}
}

/* --- 交易记录 --- */

const TX_TYPE = {
consume: "消费", earn: "收益", topup: "充值", withdraw: "提现",
consume: "消费", earn: "收益", topup: "充值", withdraw: "提现", gift: "赠送",
};

const TX_COLUMNS = [
{ key: "time", title: "时间", sort: "string", filter: "text" },
{ key: "type", title: "类型", sort: "string", filter: "select", options: ["消费", "收益", "充值", "提现"], filterVal: (t) => TX_TYPE[t.type] || t.type,
render: (t) => t.type === "earn" ? '<span class="badge ok">收益</span>' : t.type === "consume" ? '<span class="badge accent">消费</span>' : '<span class="badge dim">' + esc(TX_TYPE[t.type] || t.type) + "</span>" },
{ key: "type", title: "类型", sort: "string", filter: "select", options: ["消费", "收益", "充值", "提现", "赠送"], filterVal: (t) => TX_TYPE[t.type] || t.type,
render: (t) => t.type === "earn" ? '<span class="badge ok">收益</span>' : t.type === "consume" ? '<span class="badge accent">消费</span>' : t.type === "gift" ? '<span class="badge ok">赠送</span>' : '<span class="badge dim">' + esc(TX_TYPE[t.type] || t.type) + "</span>" },
{ key: "partner", title: "模型 / Key", sort: "string", filter: "text" },
{ key: "tokens", title: "Token 用量", sort: "string", filter: "text" },
{ key: "pts", title: "点数", sort: "number", filter: "number-range",
Expand Down
10 changes: 9 additions & 1 deletion ui/js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@
// 当前用户(公共版)
USER: { name: "阿零", email: "demo@aitokenpool.local", balance: 12480 },

// 交易记录(消费 / 收益 / 充值 / 提现)——唯一明细数据源,钱包页与交易记录页共用此表
// 点数来源(v1.2 点数机制:注册赠送 10 点 / 1 周有效;分享收益与充值点数永久有效)
POINT_SOURCES: [
{ kind: "gift", label: "赠送点数", pts: 10, note: "新人体验券 · 剩 5 天(08-19 过期)" },
{ kind: "earn", label: "收益点数", pts: 12470, note: "分享 key 赚取 · 永久有效" },
{ kind: "topup", label: "充值点数", pts: 0, note: "永久有效 · 充值暂未开放" },
],

// 交易记录(消费 / 收益 / 充值 / 提现 / 赠送)——唯一明细数据源,钱包页与交易记录页共用此表
TRANSACTIONS: [
{ id: 13, time: "08-14 09:00", type: "gift", partner: "—", detail: "赠送 · 新人体验券(注册赠送)", tokens: "—", pts: +10, status: "入账" },
{ id: 1, time: "08-13 20:15", type: "consume", partner: "deepseek-v4-flash", detail: "消费 · 用 shared key", tokens: "1.2M", pts: -320, status: "成功" },
{ id: 2, time: "08-13 19:02", type: "earn", partner: "glm-5.2", detail: "收益 · 我的 key 被消费", tokens: "860K", pts: +420, status: "入账" },
{ id: 3, time: "08-13 17:44", type: "consume", partner: "gpt-5.5-pro", detail: "消费 · 用 shared key", tokens: "45K", pts: -860, status: "成功" },
Expand Down
Loading