dsh-ai-credits 2.4.2 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,13 +46,29 @@ DSH 的左侧栏最下面多一栏 **「赛博鸡蛋领取处」**,点进去
46
46
 
47
47
  两个栏目共用一套卡片,只是数据不同:`category: 'general'` 进「通用订阅」,`category: 'coding'` 进「编程工具订阅」。编程工具订阅里只放**限定本家编程软件使用**的套餐(WorkBuddy / CodeBuddy / Qoder / Trae / Cursor / Copilot / Windsurf / Devin);能跨工具用的 coding plan(火山方舟 Coding Plan、Kimi Code)放在通用订阅。
48
48
 
49
+ ### 数据源:以聚合站为主,本地快照兜底
50
+
51
+ 从 2.4.3 起,订阅数字的主数据源是聚合站 **codingplan.fyi**(`codingplan.js`):
52
+
53
+ | 项 | 说明 |
54
+ |:--|:--|
55
+ | 端点 | `plans.json` / `platforms.json` / `config.json`,三个静态 JSON |
56
+ | 规模 | 197 个套餐 / 52 个平台 → 剔除 50 个已下架 = **145 个在售**(国内 104 / 国际 41) |
57
+ | 缓存 | 6 小时 |
58
+ | 回退 | 取不到就用 `plans.js` 的 65 条本地快照,顶部会写明「这次没取到,显示本地快照」 |
59
+ | 卡片标记 | 聚合来的标「聚合」,限购的标「限购」,已下架的不收 |
60
+
61
+ **为什么换**:以前 65 条靠人工抄,每天还得把 65 个官网页面挨个探一遍才知道有没有变。现在主源一次请求拿全,官网只留 15 条代表页当备用 —— 一天的网络请求从 65 降到 18,数字还更全。
62
+
63
+ **没有照搬的地方**:聚合站的 `action` 字段是它的推广跳转链接,不采用;卡片一律链到 `codingplan.fyi` 首页,自己看详情再决定去哪家买。地区不按聚合站的 `supportsDomestic` 猜,按**币种**分:人民币算国内,美元算国际。
64
+
49
65
  - **排序固定**:国内按 腾讯 → 阿里 → 字节 → 智谱 → 小米 → MiniMax → Kimi 从上而下;国外按厂商名首字母排序。同一家的套餐放在同一个厂商栏里横向排开,不同厂商竖向排列。
50
- - **编程工具订阅只放限定本家软件使用的套餐**:腾讯 WorkBuddy(Pro / Team)、CodeBuddy(标准 / 高级)、阿里 Qoder(Lite / Pro / Pro+ / Ultra)、字节 Trae(Lite / Pro / Pro+ / Ultra),海外 Cursor(Plus / Premium / Super / Ultra)、Copilot(Pro / Pro+ / Max)、Devin(Pro / Max;Windsurf 已并入 Devin);能跨工具用的 coding plan(火山方舟 Coding Plan、Kimi Code)归到通用订阅。
51
- - 每个套餐一张卡:月付价、`额度:` 一行、3–5 条权益、核对日期、`去订阅 →`;本质是 Agent 套餐的(Devin、Manus、火山 Token Plan)会标「编程 Agent」/「通用 Agent」。
66
+ - **编程工具订阅只放限定本家软件使用的套餐**:Codex / Claude / Cursor / GitHub / Qoder / TRAE / WorkBuddy / Command Code / OpenCode 这些只在自己客户端里用的,归到编程工具订阅;能跨工具用的 token plan 归通用订阅。
67
+ - 每个套餐一张卡:月付价、`额度:` 一行、权益、核对日期、`去订阅 →`;本质是 Agent 套餐的会标「编程 Agent」/「通用 Agent」。
52
68
  - 价格按月付展示;年付折扣、按席位、税费另计,额度与权益以「去订阅」页面为准。
53
69
  - 标「汇总价」的几家(ChatGPT / Google)官网页拦自动访问,数字按 BenchLM 的 coding plans 汇总核对;其余直接读自官网 / 官方文档。
54
- - 顶部 **订阅价快照** 是人工核对日期;**最近核对** 是订阅页可访问性的检查时间。超过 45 天也会提醒。
55
- - 订阅数据在 `plans.js` 里(`PLAN_SNAPSHOT_AT` + `CODING_PLANS`,`category` 区分 `general` / `coding`,`kind: 'agent'` 标 Agent 套餐),加一个套餐、改一个价,保存后热重载就生效。
70
+ - 顶部一行写清当前用的是哪个源、数据日期、聚合缓存时长;聚合挂了会明确提示已回退。
71
+ - 想改本地兜底快照就改 `plans.js`(`PLAN_SNAPSHOT_AT` + `CODING_PLANS`);想改聚合映射规则就改 `codingplan.js` 里的 `mapPlan`。两者保存后热重载生效。
56
72
 
57
73
  ## 本机接入
58
74
 
package/client.js CHANGED
@@ -187,7 +187,12 @@ window.__ModuleLoader__.load({
187
187
  const statusOf = (source) => {
188
188
  if (source.reachable === true) return { key: 'ok', text: '能打开' }
189
189
  if (source.reachable === false) {
190
- if (source.httpStatus === 0) return { key: 'warn', text: '本机连不上' }
190
+ // 海外入口连不上多数是本机出不去的网,不是链接坏了 —— 说清楚,别让人误删
191
+ if (source.httpStatus === 0) {
192
+ return source.overseas === true
193
+ ? { key: 'warn', text: '需代理' }
194
+ : { key: 'warn', text: '本机连不上' }
195
+ }
191
196
  if (source.httpStatus === 403 || source.httpStatus === 401) return { key: 'warn', text: '拦了自动检查' }
192
197
  return { key: 'bad', text: 'HTTP ' + source.httpStatus }
193
198
  }
@@ -196,6 +201,26 @@ window.__ModuleLoader__.load({
196
201
 
197
202
  const currencySymbol = (currency) => (currency === 'CNY' ? '¥' : currency === 'USD' ? '$' : '')
198
203
 
204
+ /**
205
+ * 领取入口按「三种状态」分栏显示:绿点能打开 / 黄红点打不开或被拦 / 灰点待检查。
206
+ * 顺序固定,空的栏不显示 —— 旧版是混在一起按名字排,一堆死链夹在中间很难看。
207
+ */
208
+ const BUCKETS = [
209
+ { key: 'ok', label: '能打开', note: '' },
210
+ {
211
+ key: 'dead',
212
+ label: '打不开 / 被拦',
213
+ note: '点不开的可以删掉;删了会留档,之后联网再搜到同一条只标「存疑」,不会自己回来。标「需代理」的是海外入口,本机出不去而已,链接本身没问题',
214
+ },
215
+ { key: 'idle', label: '待检查', note: '这一条还没巡检过' },
216
+ ]
217
+
218
+ const bucketOfSource = (item) => {
219
+ if (item.reachable === true) return 'ok'
220
+ if (item.reachable === false) return 'dead'
221
+ return 'idle'
222
+ }
223
+
199
224
  const fmtPrice = (value, currency) => {
200
225
  if (typeof value !== 'number' || !Number.isFinite(value)) return '—'
201
226
  const text = Number.isInteger(value) ? String(value) : String(Math.round(value * 1000) / 1000)
@@ -301,6 +326,30 @@ window.__ModuleLoader__.load({
301
326
  .ac-group-title { font-size: 13px; font-weight: 600; }
302
327
  .ac-group-count { font-size: 11px; color: var(--dsw-alias-label-secondary, #8a8f98); }
303
328
  .ac-group-note { font-size: 10.5px; color: var(--dsw-alias-label-secondary, #8a8f98); }
329
+ .ac-bucket { margin-top: 14px; }
330
+ .ac-bucket-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
331
+ .ac-bucket-title { font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }
332
+ .ac-bucket-title[data-bucket="ok"] { color: var(--dsw-alias-state-success-primary, #22c55e); }
333
+ .ac-bucket-title[data-bucket="dead"] { color: var(--dsw-alias-state-warn-primary, #f59e0b); }
334
+ .ac-bucket-title[data-bucket="idle"] { color: var(--dsw-alias-label-secondary, #8a8f98); }
335
+ .ac-bucket-count { font-size: 10.5px; color: var(--dsw-alias-label-secondary, #8a8f98); }
336
+ .ac-del { flex: none; margin-left: auto; padding: 1px 5px; border-radius: 5px; cursor: pointer;
337
+ font-size: 11px; line-height: 1.5; border: 1px solid transparent; background: transparent;
338
+ color: var(--dsw-alias-label-secondary, #8a8f98); }
339
+ .ac-del:hover { color: var(--dsw-alias-state-error-primary, #ef4444);
340
+ border-color: var(--dsw-alias-state-error-primary, #ef4444); }
341
+ .ac-del:disabled { opacity: .45; cursor: default; }
342
+ .ac-removed { margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--dsw-alias-border-l1, rgba(128,128,128,.22)); }
343
+ .ac-removed-head { display: flex; align-items: baseline; gap: 8px; cursor: pointer; background: none;
344
+ border: none; padding: 0; font: inherit; color: var(--dsw-alias-label-primary, inherit); }
345
+ .ac-removed-title { font-size: 11.5px; font-weight: 600; }
346
+ .ac-removed-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 0;
347
+ border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.12)); }
348
+ .ac-removed-row:last-child { border-bottom: none; }
349
+ .ac-removed-name { flex: 1; min-width: 0; font-size: 11.5px; overflow: hidden;
350
+ text-overflow: ellipsis; white-space: nowrap; }
351
+ .ac-removed-meta { font-size: 10.5px; color: var(--dsw-alias-label-secondary, #8a8f98); white-space: nowrap; }
352
+ .ac-suspect { color: var(--dsw-alias-state-warn-primary, #f59e0b); }
304
353
  .ac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
305
354
  .ac-card { display: flex; flex-direction: column; gap: 8px; padding: 13px 14px; border-radius: 10px;
306
355
  border: 1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.20));
@@ -674,6 +723,64 @@ window.__ModuleLoader__.load({
674
723
  }
675
724
  }, [usageWindow])
676
725
 
726
+ /**
727
+ * 删掉一条入口。宿主会留档:种子不会被补回来,联网再搜到同一条只记「存疑」。
728
+ * 不弹确认框 —— 删错了下面「已删除」面板里一点就能恢复。
729
+ */
730
+ const removeEntry = React.useCallback(
731
+ async (item) => {
732
+ const key = item.url || item.id
733
+ setMutating(key)
734
+ setMutateError(null)
735
+ try {
736
+ const response = await fetch(API + '/remove', {
737
+ method: 'POST',
738
+ cache: 'no-store',
739
+ credentials: 'same-origin',
740
+ headers: { 'content-type': 'application/json' },
741
+ body: JSON.stringify({ id: item.id, url: item.url }),
742
+ })
743
+ const payload = await response.json().catch(() => null)
744
+ if (!response.ok || !payload || payload.ok === false) {
745
+ throw new Error((payload && payload.error) || 'HTTP ' + response.status)
746
+ }
747
+ await load()
748
+ } catch (failure) {
749
+ setMutateError('删不掉:' + String((failure && failure.message) || failure))
750
+ } finally {
751
+ setMutating(null)
752
+ }
753
+ },
754
+ [load],
755
+ )
756
+
757
+ const restoreEntry = React.useCallback(
758
+ async (entry) => {
759
+ const key = entry.url
760
+ setMutating(key)
761
+ setMutateError(null)
762
+ try {
763
+ const response = await fetch(API + '/restore', {
764
+ method: 'POST',
765
+ cache: 'no-store',
766
+ credentials: 'same-origin',
767
+ headers: { 'content-type': 'application/json' },
768
+ body: JSON.stringify({ url: entry.url }),
769
+ })
770
+ const payload = await response.json().catch(() => null)
771
+ if (!response.ok || !payload || payload.ok === false) {
772
+ throw new Error((payload && payload.error) || 'HTTP ' + response.status)
773
+ }
774
+ await load()
775
+ } catch (failure) {
776
+ setMutateError('恢复不了:' + String((failure && failure.message) || failure))
777
+ } finally {
778
+ setMutating(null)
779
+ }
780
+ },
781
+ [load],
782
+ )
783
+
677
784
  /**
678
785
  * 把选中的文件传给宿主,由它写进 $DSH_HOME/ai-credits/official-usage/。
679
786
  *
@@ -819,6 +926,12 @@ window.__ModuleLoader__.load({
819
926
  // 导入官方账单的进度:null | { busy, name } | { ok, written } | { error }
820
927
  const [importState, setImportState] = React.useState(null)
821
928
  const importInputRef = React.useRef(null)
929
+ // 正在删 / 恢复的那一条(按 url 记,卡片上按钮显示 … 并禁用)
930
+ const [mutating, setMutating] = React.useState(null)
931
+ // 删除 / 恢复失败时的提示,点别的就清掉
932
+ const [mutateError, setMutateError] = React.useState(null)
933
+ // 「已删除」面板展开状态
934
+ const [removedOpen, setRemovedOpen] = React.useState(false)
822
935
  const isSnapshot = data !== null && !fresh
823
936
 
824
937
  // 宿主在巡检 → 每 2.2 秒问一次,跑完自己就停
@@ -992,6 +1105,7 @@ window.__ModuleLoader__.load({
992
1105
 
993
1106
  const planData = data && data.plans ? data.plans : null
994
1107
  const planItems = planData && Array.isArray(planData.items) ? planData.items : []
1108
+ const planSource = planData && planData.source ? planData.source : null
995
1109
  const planCategory = view === 'coding' ? 'coding' : 'general'
996
1110
  const visiblePlans = planItems.filter((item) => planCategoryOf(item) === planCategory)
997
1111
 
@@ -1138,6 +1252,141 @@ window.__ModuleLoader__.load({
1138
1252
  ),
1139
1253
  )
1140
1254
 
1255
+ const removedData = (data && data.removed) || { count: 0, items: [] }
1256
+ const removedItems = Array.isArray(removedData.items) ? removedData.items : []
1257
+ const suspectCount = removedItems.filter((entry) => entry.hits > 0).length
1258
+
1259
+ const sourceCard = (item) => {
1260
+ const status = statusOf(item)
1261
+ const key = item.url || item.id
1262
+ const busy = mutating === key
1263
+ return h(
1264
+ 'article',
1265
+ { className: 'ac-card', key: item.id },
1266
+ h(
1267
+ 'div',
1268
+ { className: 'ac-card-head' },
1269
+ h('span', { className: 'ac-dot', 'data-state': status.key }),
1270
+ h('span', { className: 'ac-card-title', title: item.title }, item.title),
1271
+ h('span', { className: 'ac-status' }, status.text),
1272
+ h(
1273
+ 'button',
1274
+ {
1275
+ type: 'button',
1276
+ className: 'ac-del',
1277
+ disabled: busy,
1278
+ title: '删掉这条入口。会留档:种子不会补回来,之后联网再搜到只标「存疑」',
1279
+ onClick: () => removeEntry(item),
1280
+ },
1281
+ busy ? '…' : '✕',
1282
+ ),
1283
+ ),
1284
+ h('div', { className: 'ac-claim' }, item.claim),
1285
+ h(
1286
+ 'div',
1287
+ { className: 'ac-card-foot' },
1288
+ (item.tags || []).slice(0, 2).map((tag) =>
1289
+ h(
1290
+ 'span',
1291
+ { className: item.origin === 'web' ? 'ac-tag ac-tag-new' : 'ac-tag', key: tag },
1292
+ tag,
1293
+ ),
1294
+ ),
1295
+ item.overseas === true
1296
+ ? h(
1297
+ 'span',
1298
+ { className: 'ac-tag', title: '海外入口,本机需要能访问外网才能打开' },
1299
+ '海外',
1300
+ )
1301
+ : null,
1302
+ h('span', { className: 'ac-host' }, hostOf(item.url)),
1303
+ h(
1304
+ 'a',
1305
+ {
1306
+ className: 'ac-go',
1307
+ href: item.url,
1308
+ title: '打开 ' + item.url,
1309
+ target: '_blank',
1310
+ rel: 'noreferrer noopener',
1311
+ },
1312
+ '去领 →',
1313
+ ),
1314
+ ),
1315
+ )
1316
+ }
1317
+
1318
+ const removedPanel =
1319
+ removedItems.length === 0
1320
+ ? null
1321
+ : h(
1322
+ 'div',
1323
+ { className: 'ac-removed' },
1324
+ h(
1325
+ 'button',
1326
+ {
1327
+ type: 'button',
1328
+ className: 'ac-removed-head',
1329
+ onClick: () => setRemovedOpen((value) => !value),
1330
+ },
1331
+ h('span', { className: 'ac-removed-title' }, '已删除的入口'),
1332
+ h(
1333
+ 'span',
1334
+ { className: 'ac-removed-meta' },
1335
+ String(removedItems.length) + ' 条 · ' + (removedOpen ? '收起' : '展开'),
1336
+ ),
1337
+ suspectCount > 0
1338
+ ? h(
1339
+ 'span',
1340
+ { className: 'ac-removed-meta ac-suspect' },
1341
+ '其中 ' + String(suspectCount) + ' 条后来又搜到过(存疑)',
1342
+ )
1343
+ : null,
1344
+ ),
1345
+ removedOpen
1346
+ ? h(
1347
+ 'div',
1348
+ null,
1349
+ removedItems.map((entry) =>
1350
+ h(
1351
+ 'div',
1352
+ { className: 'ac-removed-row', key: entry.url },
1353
+ h('span', { className: 'ac-removed-name', title: entry.url }, entry.title),
1354
+ h('span', { className: 'ac-removed-meta' }, entry.host),
1355
+ entry.httpStatus !== null && entry.httpStatus !== undefined
1356
+ ? h(
1357
+ 'span',
1358
+ { className: 'ac-removed-meta' },
1359
+ entry.httpStatus === 0 ? '连不上' : 'HTTP ' + String(entry.httpStatus),
1360
+ )
1361
+ : null,
1362
+ entry.hits > 0
1363
+ ? h(
1364
+ 'span',
1365
+ {
1366
+ className: 'ac-removed-meta ac-suspect',
1367
+ title: '删掉之后联网又搜到过 ' + String(entry.hits) + ' 次,最后 ' + (fmtTime(entry.reseenAt) || ''),
1368
+ },
1369
+ '存疑 ×' + String(entry.hits),
1370
+ )
1371
+ : null,
1372
+ h('span', { className: 'ac-removed-meta' }, fmtTime(entry.at) || ''),
1373
+ h(
1374
+ 'button',
1375
+ {
1376
+ type: 'button',
1377
+ className: 'ac-del',
1378
+ disabled: mutating === entry.url,
1379
+ title: '把这条放回清单',
1380
+ onClick: () => restoreEntry(entry),
1381
+ },
1382
+ mutating === entry.url ? '…' : '恢复',
1383
+ ),
1384
+ ),
1385
+ ),
1386
+ )
1387
+ : null,
1388
+ )
1389
+
1141
1390
  const creditsBody = [
1142
1391
  data === null
1143
1392
  ? null
@@ -1193,8 +1442,12 @@ window.__ModuleLoader__.load({
1193
1442
  )
1194
1443
  : null,
1195
1444
 
1196
- groups.map((group) =>
1197
- h(
1445
+ groups.map((group) => {
1446
+ const buckets = BUCKETS.map((bucket) => ({
1447
+ ...bucket,
1448
+ rows: group.rows.filter((item) => bucketOfSource(item) === bucket.key),
1449
+ })).filter((bucket) => bucket.rows.length > 0)
1450
+ return h(
1198
1451
  'section',
1199
1452
  { className: 'ac-group', key: group.name },
1200
1453
  h(
@@ -1206,58 +1459,35 @@ window.__ModuleLoader__.load({
1206
1459
  ? h('div', { className: 'ac-group-note' }, '联网搜到的候选页,点开确认过再领')
1207
1460
  : null,
1208
1461
  ),
1209
- h(
1210
- 'div',
1211
- { className: 'ac-grid' },
1212
- group.rows.map((item) => {
1213
- const status = statusOf(item)
1214
- return h(
1215
- 'article',
1216
- { className: 'ac-card', key: item.id },
1217
- h(
1218
- 'div',
1219
- { className: 'ac-card-head' },
1220
- h('span', { className: 'ac-dot', 'data-state': status.key }),
1221
- h('span', { className: 'ac-card-title', title: item.title }, item.title),
1222
- h('span', { className: 'ac-status' }, status.text),
1223
- ),
1224
- h('div', { className: 'ac-claim' }, item.claim),
1462
+ buckets.map((bucket) =>
1463
+ h(
1464
+ 'div',
1465
+ { className: 'ac-bucket', key: bucket.key },
1466
+ h(
1467
+ 'div',
1468
+ { className: 'ac-bucket-head' },
1225
1469
  h(
1226
- 'div',
1227
- { className: 'ac-card-foot' },
1228
- (item.tags || []).slice(0, 2).map((tag) =>
1229
- h(
1230
- 'span',
1231
- {
1232
- className: item.origin === 'web' ? 'ac-tag ac-tag-new' : 'ac-tag',
1233
- key: tag,
1234
- },
1235
- tag,
1236
- ),
1237
- ),
1238
- h('span', { className: 'ac-host' }, hostOf(item.url)),
1239
- h(
1240
- 'a',
1241
- {
1242
- className: 'ac-go',
1243
- href: item.url,
1244
- title: '打开 ' + item.url,
1245
- target: '_blank',
1246
- rel: 'noreferrer noopener',
1247
- },
1248
- '去领 →',
1249
- ),
1470
+ 'span',
1471
+ { className: 'ac-bucket-title', 'data-bucket': bucket.key },
1472
+ bucket.label,
1250
1473
  ),
1251
- )
1252
- }),
1474
+ h('span', { className: 'ac-bucket-count' }, String(bucket.rows.length) + ' 个'),
1475
+ bucket.note ? h('span', { className: 'ac-bucket-count' }, bucket.note) : null,
1476
+ ),
1477
+ h('div', { className: 'ac-grid' }, bucket.rows.map(sourceCard)),
1478
+ ),
1253
1479
  ),
1254
- ),
1255
- ),
1480
+ )
1481
+ }),
1256
1482
 
1257
1483
  data !== null && groups.length === 0
1258
1484
  ? h('div', { className: 'ac-state' }, '没找到匹配的入口,换个关键词,或者把筛选切回「全部」。')
1259
1485
  : null,
1260
1486
 
1487
+ mutateError ? h('div', { className: 'ac-note' }, mutateError) : null,
1488
+
1489
+ data !== null ? removedPanel : null,
1490
+
1261
1491
  error !== null && data === null
1262
1492
  ? h(
1263
1493
  'div',
@@ -1533,6 +1763,23 @@ window.__ModuleLoader__.load({
1533
1763
  '汇总价',
1534
1764
  )
1535
1765
  : null,
1766
+ plan.source === 'aggregator'
1767
+ ? h(
1768
+ 'span',
1769
+ {
1770
+ className: 'ac-tag ac-tag-new',
1771
+ title: '数字取自 codingplan.fyi 聚合(该站逐条引用官方公告核对),以「去订阅」页面为准',
1772
+ },
1773
+ '聚合',
1774
+ )
1775
+ : null,
1776
+ plan.planStatus === 'restricted'
1777
+ ? h(
1778
+ 'span',
1779
+ { className: 'ac-tag', title: '该套餐目前限购 / 需申请资格' },
1780
+ '限购',
1781
+ )
1782
+ : null,
1536
1783
  plan.sourceDate ? h('span', { className: 'ac-host' }, '核对于 ' + plan.sourceDate) : null,
1537
1784
  h(
1538
1785
  'a',
@@ -1557,7 +1804,18 @@ window.__ModuleLoader__.load({
1557
1804
  : h(
1558
1805
  'div',
1559
1806
  { className: 'ac-meta' },
1560
- h('span', null, '订阅价快照 ', h('b', null, planData.snapshotAt || '未标注')),
1807
+ planSource !== null && planSource.mode === 'aggregator'
1808
+ ? h(
1809
+ 'span',
1810
+ null,
1811
+ '订阅价来自 ',
1812
+ h('b', null, planSource.label),
1813
+ ' 聚合(数据 ',
1814
+ h('b', null, planSource.dataDate || '未标注'),
1815
+ ')· ',
1816
+ String(planData.total) + ' 个套餐 / ' + String(planRegions.length) + ' 个地区',
1817
+ )
1818
+ : h('span', null, '订阅价快照 ', h('b', null, planData.snapshotAt || '未标注')),
1561
1819
  h(
1562
1820
  'span',
1563
1821
  null,
@@ -1567,12 +1825,34 @@ window.__ModuleLoader__.load({
1567
1825
  h(
1568
1826
  'span',
1569
1827
  null,
1570
- '订阅页可访问 ',
1828
+ planSource !== null && planSource.mode === 'aggregator' ? '聚合源可访问 ' : '订阅页可访问 ',
1571
1829
  h('b', null, String(planReachable) + ' / ' + String(visiblePlans.length)),
1572
1830
  ),
1573
- h('span', null, '每 ', h('b', null, '20 小时'), ' 自动核对一次'),
1831
+ h(
1832
+ 'span',
1833
+ null,
1834
+ '每 ',
1835
+ h('b', null, '20 小时'),
1836
+ ' 自动核对;聚合数据缓存 ',
1837
+ h('b', null, String(planSource && planSource.ttlHours ? planSource.ttlHours : 6) + ' 小时'),
1838
+ ),
1574
1839
  ),
1575
1840
 
1841
+ // 聚合源挂了 → 明确说清现在看的是本地快照,别让人以为数字是新的
1842
+ planSource !== null && planSource.mode !== 'aggregator'
1843
+ ? h(
1844
+ 'div',
1845
+ { className: 'ac-note' },
1846
+ '聚合源 ',
1847
+ h('b', null, 'codingplan.fyi'),
1848
+ ' 这次没取到',
1849
+ planSource.error ? '(' + planSource.error + ')' : '',
1850
+ ',下面显示的是本地快照 ',
1851
+ h('b', null, planData.snapshotAt || '未标注'),
1852
+ ',可能已经改价 —— 以「去订阅」页面为准。',
1853
+ )
1854
+ : null,
1855
+
1576
1856
  planData !== null && planStaleDays !== null && planStaleDays > 45
1577
1857
  ? h(
1578
1858
  'div',
@@ -2563,11 +2843,15 @@ window.__ModuleLoader__.load({
2563
2843
  '官方账单',
2564
2844
  fmtMoney(officialUsage.totals.cost, 'CNY'),
2565
2845
  '',
2566
- (officialUsage.range ? officialUsage.range.from.slice(5) + '~' + officialUsage.range.to.slice(5) : '') +
2567
- ' · ' +
2568
- officialUsage.byKey.length +
2569
- ' 个 key · 含搜索 ¥' +
2570
- (officialUsage.totals.fnCost || 0).toFixed(2),
2846
+ (officialUsage.range
2847
+ ? officialUsage.range.from.slice(5) + '~' + officialUsage.range.to.slice(5) +
2848
+ ' · ' + officialUsage.range.days + ' 天有数据'
2849
+ : '') +
2850
+ ' · ' + officialUsage.byKey.length + ' 个 key · 含搜索 ¥' +
2851
+ (officialUsage.totals.fnCost || 0).toFixed(2) +
2852
+ (officialUsage.totals.overcount > 0.01
2853
+ ? ' · 已去重(不去重会算 ¥' + officialUsage.totals.rawCost.toFixed(2) + ')'
2854
+ : ''),
2571
2855
  true,
2572
2856
  )
2573
2857
  : null,
@@ -2662,6 +2946,47 @@ window.__ModuleLoader__.load({
2662
2946
  ? '(注意:两个 CSV 的金额对不上,导出可能不完整)'
2663
2947
  : '',
2664
2948
  ),
2949
+ // 重复导入的说明:多次导出必然有交集,这里把去重的账算清楚
2950
+ officialUsage.dedupe && officialUsage.dedupe.overwritten > 0
2951
+ ? h(
2952
+ 'div',
2953
+ { className: 'ac-caveat', style: { marginTop: '8px' } },
2954
+ '导入过 ',
2955
+ h('b', null, String(officialUsage.dedupe.files)),
2956
+ ' 份 CSV,其中 ',
2957
+ h('b', null, String(officialUsage.dedupe.overwritten)),
2958
+ ' 行落在多份文件的交集里,已按「后导入的覆盖先导入的」去重 —— ',
2959
+ '直接累加会算成 ',
2960
+ h('b', null, '¥' + (officialUsage.totals.rawCost || 0).toFixed(2)),
2961
+ ',实际 ',
2962
+ h('b', null, '¥' + officialUsage.totals.cost.toFixed(2)),
2963
+ '。',
2964
+ officialUsage.dedupe.conflicts > 0
2965
+ ? '其中 ' + officialUsage.dedupe.conflicts + ' 行两次数值不同(导出时那天还没过完),取的是较新的那份。'
2966
+ : '',
2967
+ officialUsage.overlaps && officialUsage.overlaps.length > 0
2968
+ ? h(
2969
+ 'div',
2970
+ { style: { marginTop: '4px' } },
2971
+ '重叠区间:',
2972
+ officialUsage.overlaps
2973
+ .map((o) => o.from.slice(5) + '~' + o.to.slice(5) + '(' + o.days + ' 天)')
2974
+ .join('、'),
2975
+ )
2976
+ : null,
2977
+ officialUsage.range && officialUsage.range.missing && officialUsage.range.missing.length > 0
2978
+ ? h(
2979
+ 'div',
2980
+ { style: { marginTop: '4px' } },
2981
+ '区间内 ' + officialUsage.range.missing.length + ' 天没有用量记录(不是缺数据):',
2982
+ officialUsage.range.missing.slice(0, 8).map((d) => d.slice(5)).join('、'),
2983
+ officialUsage.range.missing.length > 8
2984
+ ? ' 等'
2985
+ : '',
2986
+ )
2987
+ : null,
2988
+ )
2989
+ : null,
2665
2990
  importPanel(true),
2666
2991
  h(
2667
2992
  'div',