diff --git a/package.json b/package.json index 65d6fe4..685b824 100644 --- a/package.json +++ b/package.json @@ -571,11 +571,14 @@ "name": "PushPlus消息推送", "description": "支持使用PushPlus发送消息通知。", "labels": "消息通知", - "version": "1.0", + "version": "1.2", "icon": "Pushplus_A.png", "author": "cheng", "level": 1, - "v2": true + "v2": true, + "history": { + "v1.2": "增加群组编码,支持发送群组消息" + } }, "DownloadSiteTag": { "name": "下载任务分类与标签", diff --git a/plugins/pushplusmsg/__init__.py b/plugins/pushplusmsg/__init__.py index b5e287b..630df48 100644 --- a/plugins/pushplusmsg/__init__.py +++ b/plugins/pushplusmsg/__init__.py @@ -15,7 +15,7 @@ class PushPlusMsg(_PluginBase): # 插件图标 plugin_icon = "Pushplus_A.png" # 插件版本 - plugin_version = "1.1" + plugin_version = "1.2" # 插件作者 plugin_author = "cheng" # 作者主页 @@ -31,12 +31,14 @@ class PushPlusMsg(_PluginBase): _enabled = False _token = None _msgtypes = [] + _topic = None # 新增topic字段 def init_plugin(self, config: dict = None): if config: self._enabled = config.get("enabled") self._token = config.get("token") self._msgtypes = config.get("msgtypes") or [] + self._topic = config.get("topic") # 新增topic字段 def get_state(self) -> bool: return self._enabled and (True if self._token else False) @@ -105,6 +107,27 @@ class PushPlusMsg(_PluginBase): } ] }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12 + }, + 'content': [ + { + 'component': 'VTextField', + 'props': { + 'model': 'topic', + 'label': '群组编码', + 'placeholder': '输入群组编码(可选)', + } + } + ] + } + ] + }, { 'component': 'VRow', 'content': [ @@ -154,6 +177,7 @@ class PushPlusMsg(_PluginBase): ], { "enabled": False, 'token': '', + 'topic': '', 'msgtypes': [] } @@ -199,8 +223,12 @@ class PushPlusMsg(_PluginBase): "title": title, "content": text, "template": "txt", - "channel": "wechat" + "channel": "wechat", } + # 如果配置了topic,添加到请求参数 + if self._topic: + event_info["topic"] = self._topic + res = RequestUtils(content_type="application/json").post_res(sc_url, json=event_info) if res and res.status_code == 200: ret_json = res.json() @@ -221,4 +249,4 @@ class PushPlusMsg(_PluginBase): """ 退出插件 """ - pass + pass \ No newline at end of file