@cloud411716/fancy-webnovel 0.3.3 → 0.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -68,7 +68,7 @@ export async function apply(ctx) {
68
68
  : rawChoices;
69
69
 
70
70
  // 把 rankId 转换成 { channel, type } 并去重
71
- const rankEntries = rankIds.map(id => parseRankId(platform, id));
71
+ const rankEntries = rankIds.map(id => parseRankId(platform, resolveId(platform, id)));
72
72
  const unique = [];
73
73
  const seen = new Set();
74
74
  for (const e of rankEntries) {
@@ -144,6 +144,16 @@ export async function apply(ctx) {
144
144
  // 将 rankId 转换成 { channel, type } 参数
145
145
  // ---------------------------------------------------------------------------
146
146
 
147
+ // 将 label 或 id 统一成 id(UI 可能返回 label)
148
+ function resolveId(platform, raw) {
149
+ const opts = rankOptions(platform);
150
+ const byId = opts.find(o => o.id === raw);
151
+ if (byId) return byId.id;
152
+ const byLabel = opts.find(o => o.label === raw);
153
+ if (byLabel) return byLabel.id;
154
+ return raw; // 未知值直接透传
155
+ }
156
+
147
157
  function parseRankId(platform, id) {
148
158
  switch (platform) {
149
159
  case 'qimao': {