From 95b952c27f468648da8bc4f831866d65c2804d48 Mon Sep 17 00:00:00 2001 From: YuHoYe Date: Mon, 9 Feb 2026 17:14:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat(DailySummary):=20=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E5=B1=95=E7=A4=BA=E6=A8=A1=E5=9D=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=92=8C=E5=8F=91=E9=80=81=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/dailysummary/__init__.py | 66 ++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/plugins.v2/dailysummary/__init__.py b/plugins.v2/dailysummary/__init__.py index 1133833..75a82f5 100644 --- a/plugins.v2/dailysummary/__init__.py +++ b/plugins.v2/dailysummary/__init__.py @@ -342,22 +342,33 @@ class DailySummary(_PluginBase): def get_page(self) -> List[dict]: history = self.get_data("history") or [] + # 模块配置摘要 + def _module_names(modules): + return "、".join(MODULES.get(m, m) for m in (modules or [])) + + config_cards = [ + self._config_card('📊 日报模块', _module_names(self._daily_modules), self._daily_cron), + self._config_card('📈 周报模块', _module_names(self._weekly_modules), self._weekly_cron), + self._config_card('📅 月报模块', _module_names(self._monthly_modules), self._monthly_cron), + ] + if not history: return [ + { + 'component': 'VRow', + 'content': config_cards, + }, { 'component': 'div', - 'text': '暂无数据', - 'props': { - 'class': 'text-center', - } - } + 'text': '暂无发送记录', + 'props': {'class': 'text-center mt-4'}, + }, ] daily_count = sum(1 for r in history if r.get("type") == "daily") weekly_count = sum(1 for r in history if r.get("type") == "weekly") monthly_count = sum(1 for r in history if r.get("type") == "monthly") - # 表格数据 items = [ { 'time': r.get('time', ''), @@ -371,11 +382,11 @@ class DailySummary(_PluginBase): return [ { 'component': 'VRow', - 'content': [ - # 统计卡片 - self._stat_card('📊 日报', f'{daily_count} 份'), - self._stat_card('📈 周报', f'{weekly_count} 份'), - self._stat_card('📅 月报', f'{monthly_count} 份'), + 'content': config_cards + [ + # 发送统计 + self._stat_card('日报', f'{daily_count} 份'), + self._stat_card('周报', f'{weekly_count} 份'), + self._stat_card('月报', f'{monthly_count} 份'), # 历史记录表格 { 'component': 'VCol', @@ -406,24 +417,37 @@ class DailySummary(_PluginBase): ] @staticmethod - def _stat_card(title: str, value: str) -> dict: + def _config_card(title: str, modules_text: str, cron: str) -> dict: return { 'component': 'VCol', - 'props': {'cols': 6, 'md': 4}, + 'props': {'cols': 12, 'md': 4}, 'content': [{ 'component': 'VCard', 'props': {'variant': 'tonal'}, 'content': [{ 'component': 'VCardText', - 'props': {'class': 'd-flex align-center'}, 'content': [ - { - 'component': 'div', - 'content': [ - {'component': 'span', 'props': {'class': 'text-subtitle-2'}, 'text': title}, - {'component': 'div', 'props': {'class': 'text-h6'}, 'text': value}, - ], - }, + {'component': 'div', 'props': {'class': 'text-subtitle-2 mb-1'}, 'text': f'{title} ⏰ {cron}'}, + {'component': 'span', 'props': {'class': 'text-caption'}, 'text': modules_text}, + ], + }], + }], + } + + @staticmethod + def _stat_card(title: str, value: str) -> dict: + return { + 'component': 'VCol', + 'props': {'cols': 4, 'md': 4}, + 'content': [{ + 'component': 'VCard', + 'props': {'variant': 'tonal'}, + 'content': [{ + 'component': 'VCardText', + 'props': {'class': 'text-center pa-2'}, + 'content': [ + {'component': 'div', 'props': {'class': 'text-caption'}, 'text': title}, + {'component': 'div', 'props': {'class': 'text-h6'}, 'text': value}, ], }], }], From 6fa42abc17ebdd2ac32e7a31a043b9ea1b45e77c Mon Sep 17 00:00:00 2001 From: YuHoYe Date: Mon, 9 Feb 2026 17:34:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(DailySummary):=20=E6=97=A7=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8D=87=E7=BA=A7=E6=97=B6=E5=9B=9E=E5=86=99=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=A8=A1=E5=9D=97=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/dailysummary/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins.v2/dailysummary/__init__.py b/plugins.v2/dailysummary/__init__.py index 75a82f5..a890bbb 100644 --- a/plugins.v2/dailysummary/__init__.py +++ b/plugins.v2/dailysummary/__init__.py @@ -108,6 +108,9 @@ class DailySummary(_PluginBase): self._signin_plugin_id = config.get("signin_plugin_id", "AutoSignIn") self._brush_plugin_ids = config.get("brush_plugin_ids", "BrushFlow") self._storage_paths = config.get("storage_paths", "") + # 旧版本配置缺少新字段时,回写完整配置让前端能读到默认值 + if "daily_modules" not in config: + self._save_config() else: self._daily_modules = DEFAULT_DAILY_MODULES self._weekly_modules = DEFAULT_WEEKLY_MODULES From bb1f1591982c57f3cb67f799b34db73b54d2adf7 Mon Sep 17 00:00:00 2001 From: YuHoYe Date: Mon, 9 Feb 2026 19:54:51 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat(DailySummary):=20Cron=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=94=B9=E7=94=A8=20VCronField=20GUI=20=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.v2/dailysummary/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins.v2/dailysummary/__init__.py b/plugins.v2/dailysummary/__init__.py index a890bbb..e3e50fd 100644 --- a/plugins.v2/dailysummary/__init__.py +++ b/plugins.v2/dailysummary/__init__.py @@ -250,11 +250,11 @@ class DailySummary(_PluginBase): "component": "VRow", "content": [ {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VTextField", "props": {"model": "daily_cron", "label": "每日 Cron"}}]}, + "content": [{"component": "VCronField", "props": {"model": "daily_cron", "label": "每日周期"}}]}, {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VTextField", "props": {"model": "weekly_cron", "label": "每周 Cron"}}]}, + "content": [{"component": "VCronField", "props": {"model": "weekly_cron", "label": "每周周期"}}]}, {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VTextField", "props": {"model": "monthly_cron", "label": "每月 Cron"}}]}, + "content": [{"component": "VCronField", "props": {"model": "monthly_cron", "label": "每月周期"}}]}, {"component": "VCol", "props": {"cols": 12, "md": 3}, "content": [{"component": "VSelect", "props": {"model": "test_type", "label": "测试类型", "items": test_options}}]}, ], From 028103b900a75e409ae9b98bf489f84e86a5ae47 Mon Sep 17 00:00:00 2001 From: YuHoYe Date: Mon, 9 Feb 2026 23:23:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(DailySummary):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2=20+=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=A0=87=E9=A2=98=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除高级设置 tab(signin_plugin_id / brush_plugin_ids / storage_paths) 这些内部实现细节不该暴露给用户,改为代码内硬编码默认值 存储路径改为纯自动检测 MP 的 LIBRARY_PATH / DOWNLOAD_PATH - 去掉 VTabs,报告模块选择器直接平铺 - Cron 字段和开关移到 VTabs 外面,避免弹出菜单被裁剪 - 修复通知标题重复:text 中不再拼接 header,由 post_message 的 title 参数单独传递 --- plugins.v2/dailysummary/__init__.py | 181 ++++++++-------------------- 1 file changed, 51 insertions(+), 130 deletions(-) diff --git a/plugins.v2/dailysummary/__init__.py b/plugins.v2/dailysummary/__init__.py index e3e50fd..83f3c03 100644 --- a/plugins.v2/dailysummary/__init__.py +++ b/plugins.v2/dailysummary/__init__.py @@ -89,10 +89,6 @@ class DailySummary(_PluginBase): _weekly_modules: list = None _monthly_modules: list = None - _signin_plugin_id: str = "AutoSignIn" - _brush_plugin_ids: str = "BrushFlow" - _storage_paths: str = "" - def init_plugin(self, config: dict = None): if config: self._enabled = config.get("enabled", False) @@ -105,12 +101,6 @@ class DailySummary(_PluginBase): self._daily_modules = config.get("daily_modules") or DEFAULT_DAILY_MODULES self._weekly_modules = config.get("weekly_modules") or DEFAULT_WEEKLY_MODULES self._monthly_modules = config.get("monthly_modules") or DEFAULT_MONTHLY_MODULES - self._signin_plugin_id = config.get("signin_plugin_id", "AutoSignIn") - self._brush_plugin_ids = config.get("brush_plugin_ids", "BrushFlow") - self._storage_paths = config.get("storage_paths", "") - # 旧版本配置缺少新字段时,回写完整配置让前端能读到默认值 - if "daily_modules" not in config: - self._save_config() else: self._daily_modules = DEFAULT_DAILY_MODULES self._weekly_modules = DEFAULT_WEEKLY_MODULES @@ -146,9 +136,6 @@ class DailySummary(_PluginBase): "daily_modules": self._daily_modules, "weekly_modules": self._weekly_modules, "monthly_modules": self._monthly_modules, - "signin_plugin_id": self._signin_plugin_id, - "brush_plugin_ids": self._brush_plugin_ids, - "storage_paths": self._storage_paths, }) def get_state(self) -> bool: @@ -217,109 +204,58 @@ class DailySummary(_PluginBase): { "component": "VForm", "content": [ + # ── 基本设置(VTabs 外面,避免弹出菜单被裁剪) ── { - "component": "VTabs", - "props": {"model": "_tab", "style": "margin-top: -18px; margin-bottom: 12px;"}, - "content": [ - {"component": "VTab", "props": {"value": "basic"}, "text": "基本设置"}, - {"component": "VTab", "props": {"value": "modules"}, "text": "报告内容"}, - {"component": "VTab", "props": {"value": "advanced"}, "text": "高级设置"}, + 'component': 'VRow', + 'content': [ + {'component': 'VCol', 'props': {'cols': 12, 'md': 3}, + 'content': [{'component': 'VSwitch', 'props': {'model': 'enabled', 'label': '启用插件'}}]}, + {'component': 'VCol', 'props': {'cols': 12, 'md': 3}, + 'content': [{'component': 'VSwitch', 'props': {'model': 'notify', 'label': '发送通知'}}]}, + {'component': 'VCol', 'props': {'cols': 12, 'md': 3}, + 'content': [{'component': 'VSwitch', 'props': {'model': 'onlyonce', 'label': '立即测试一次'}}]}, + {'component': 'VCol', 'props': {'cols': 12, 'md': 3}, + 'content': [{'component': 'VSelect', 'props': {'model': 'test_type', 'label': '测试类型', 'items': test_options}}]}, ], }, { - "component": "VWindow", - "props": {"model": "_tab"}, + 'component': 'VRow', + 'content': [ + {'component': 'VCol', 'props': {'cols': 12, 'md': 4}, + 'content': [{'component': 'VCronField', 'props': {'model': 'daily_cron', 'label': '每日周期', 'placeholder': '5位cron表达式'}}]}, + {'component': 'VCol', 'props': {'cols': 12, 'md': 4}, + 'content': [{'component': 'VCronField', 'props': {'model': 'weekly_cron', 'label': '每周周期', 'placeholder': '5位cron表达式'}}]}, + {'component': 'VCol', 'props': {'cols': 12, 'md': 4}, + 'content': [{'component': 'VCronField', 'props': {'model': 'monthly_cron', 'label': '每月周期', 'placeholder': '5位cron表达式'}}]}, + ], + }, + # ── 报告内容 ── + { + "component": "VRow", + "props": {"style": "margin-top: 8px;"}, "content": [ - # ── Tab 1: 基本设置 ── - { - "component": "VWindowItem", - "props": {"value": "basic"}, - "content": [ - { - "component": "VRow", - "content": [ - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VSwitch", "props": {"model": "enabled", "label": "启用插件"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VSwitch", "props": {"model": "notify", "label": "发送通知"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VSwitch", "props": {"model": "onlyonce", "label": "立即测试一次"}}]}, - ], - }, - { - "component": "VRow", - "content": [ - {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VCronField", "props": {"model": "daily_cron", "label": "每日周期"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VCronField", "props": {"model": "weekly_cron", "label": "每周周期"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VCronField", "props": {"model": "monthly_cron", "label": "每月周期"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 3}, - "content": [{"component": "VSelect", "props": {"model": "test_type", "label": "测试类型", "items": test_options}}]}, - ], - }, - ], - }, - # ── Tab 2: 报告内容 ── - { - "component": "VWindowItem", - "props": {"value": "modules"}, - "content": [ - { - "component": "VRow", - "content": [ - {"component": "VCol", "props": {"cols": 12}, - "content": [{"component": "VAlert", "props": {"type": "info", "variant": "tonal", "text": "选择各报告中包含的信息模块,模块按选择顺序显示在报告中"}}]}, - ], - }, - { - "component": "VRow", - "content": [ - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VSelect", "props": { - "model": "daily_modules", "label": "日报模块", - "items": MODULE_OPTIONS, "multiple": True, "chips": True, "closable-chips": True, - }}]}, - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VSelect", "props": { - "model": "weekly_modules", "label": "周报模块", - "items": MODULE_OPTIONS, "multiple": True, "chips": True, "closable-chips": True, - }}]}, - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VSelect", "props": { - "model": "monthly_modules", "label": "月报模块", - "items": MODULE_OPTIONS, "multiple": True, "chips": True, "closable-chips": True, - }}]}, - ], - }, - ], - }, - # ── Tab 3: 高级设置 ── - { - "component": "VWindowItem", - "props": {"value": "advanced"}, - "content": [ - { - "component": "VRow", - "content": [ - {"component": "VCol", "props": {"cols": 12}, - "content": [{"component": "VAlert", "props": {"type": "info", "variant": "tonal", "text": "以下为高级配置,一般无需修改"}}]}, - ], - }, - { - "component": "VRow", - "content": [ - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VTextField", "props": {"model": "signin_plugin_id", "label": "签到插件 ID", "placeholder": "AutoSignIn"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VTextField", "props": {"model": "brush_plugin_ids", "label": "刷流插件 ID", "placeholder": "BrushFlow", "hint": "多个用逗号分隔"}}]}, - {"component": "VCol", "props": {"cols": 12, "md": 4}, - "content": [{"component": "VTextField", "props": {"model": "storage_paths", "label": "存储监控路径", "placeholder": "留空自动检测", "hint": "格式: /media:媒体盘,/downloads:下载盘"}}]}, - ], - }, - ], - }, + {"component": "VCol", "props": {"cols": 12}, + "content": [{"component": "VAlert", "props": {"type": "info", "variant": "tonal", "text": "选择各报告中包含的信息模块,模块按选择顺序显示在报告中"}}]}, + ], + }, + { + "component": "VRow", + "content": [ + {"component": "VCol", "props": {"cols": 12, "md": 4}, + "content": [{"component": "VSelect", "props": { + "model": "daily_modules", "label": "日报模块", + "items": MODULE_OPTIONS, "multiple": True, "chips": True, "closable-chips": True, + }}]}, + {"component": "VCol", "props": {"cols": 12, "md": 4}, + "content": [{"component": "VSelect", "props": { + "model": "weekly_modules", "label": "周报模块", + "items": MODULE_OPTIONS, "multiple": True, "chips": True, "closable-chips": True, + }}]}, + {"component": "VCol", "props": {"cols": 12, "md": 4}, + "content": [{"component": "VSelect", "props": { + "model": "monthly_modules", "label": "月报模块", + "items": MODULE_OPTIONS, "multiple": True, "chips": True, "closable-chips": True, + }}]}, ], }, ], @@ -335,9 +271,6 @@ class DailySummary(_PluginBase): "daily_modules": DEFAULT_DAILY_MODULES, "weekly_modules": DEFAULT_WEEKLY_MODULES, "monthly_modules": DEFAULT_MONTHLY_MODULES, - "signin_plugin_id": "AutoSignIn", - "brush_plugin_ids": "BrushFlow", - "storage_paths": "", } # ─── 历史记录页面 ─── @@ -504,7 +437,7 @@ class DailySummary(_PluginBase): sections.append(result) header = self._make_header(report_type, tr) - text = header + "\n\n" + "\n\n".join(sections) if sections else header + "\n\n无数据" + text = "\n\n".join(sections) if sections else "无数据" return header, text def _calc_time_range(self, report_type: str) -> TimeRange: @@ -608,7 +541,7 @@ class DailySummary(_PluginBase): def _section_signin(self, tr: TimeRange) -> str: pdo = PluginDataOper() - plugin_id = self._signin_plugin_id or "AutoSignIn" + plugin_id = "AutoSignIn" now = tr.end key = f"{now.month}月{now.day}日" data = pdo.get_data(plugin_id, key) @@ -628,7 +561,7 @@ class DailySummary(_PluginBase): def _section_brush(self, tr: TimeRange) -> str: pdo = PluginDataOper() - plugin_ids = [pid.strip() for pid in (self._brush_plugin_ids or "BrushFlow").split(",") if pid.strip()] + plugin_ids = ["BrushFlow"] total_uploaded = 0 total_downloaded = 0 @@ -768,19 +701,7 @@ class DailySummary(_PluginBase): return "\n".join(lines) if has_data else None def _parse_storage_paths(self) -> List[Tuple[str, str]]: - """解析用户配置的存储路径,或自动检测 MP 的 LIBRARY_PATH / DOWNLOAD_PATH""" - if self._storage_paths: - result = [] - for item in self._storage_paths.split(","): - item = item.strip() - if ":" in item: - path, label = item.split(":", 1) - result.append((path.strip(), label.strip())) - elif item: - result.append((item, item)) - return result - - # 自动检测 + """自动检测 MP 的 LIBRARY_PATH / DOWNLOAD_PATH""" paths = [] if hasattr(settings, "LIBRARY_PATH") and settings.LIBRARY_PATH: paths.append((settings.LIBRARY_PATH, "媒体库"))