From 06b6ab04d46ab8cb4b007d0bf87edaca12910b00 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Mon, 22 Sep 2025 23:17:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E8=BF=BD=E5=89=A7=E6=97=A5=E5=8E=86?= =?UTF-8?q?=E7=9A=84=E6=B5=B7=E6=8A=A5=E8=A7=86=E5=9B=BE=E5=92=8C=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E8=A7=86=E5=9B=BE=E5=A2=9E=E5=8A=A0=E6=8B=BC=E9=9F=B3?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 getEpisodesByDate 中对当日节目结果进行拼音升序排序 - 合并集开启时先合并同节目多集,再按节目名拼音排序 - 与内容管理视图排序规则一致,提升一致性与可预期性 - 增加 try-catch 保护,异常时回退原顺序,保证稳定性 --- app/templates/index.html | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index 7fc52c0..ac91831 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -4777,11 +4777,23 @@ }); // 如果启用了合并集功能,则进行合并处理 - if (this.calendar.mergeEpisodes) { - return this.mergeEpisodesByShow(filteredEpisodes); - } - - return filteredEpisodes; + let result = this.calendar.mergeEpisodes + ? this.mergeEpisodesByShow(filteredEpisodes) + : filteredEpisodes; + + // 统一对同一天节目按节目名称拼音排序(与内容管理一致) + try { + result = result.slice().sort((a, b) => { + const an = (a && a.show_name) ? String(a.show_name) : ''; + const bn = (b && b.show_name) ? String(b.show_name) : ''; + const ak = pinyinPro.pinyin(an, { toneType: 'none', type: 'string' }).toLowerCase(); + const bk = pinyinPro.pinyin(bn, { toneType: 'none', type: 'string' }).toLowerCase(); + if (ak === bk) return 0; + return ak > bk ? 1 : -1; + }); + } catch (e) {} + + return result; }, // 根据剧集名称查找对应的任务