diff --git a/package.json b/package.json index e118836..f3ecb75 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,12 @@ "name": "站点数据统计", "description": "自动统计和展示站点数据。", "labels": "站点,仪表板", - "version": "3.9.3", + "version": "4.0", "icon": "statistic.png", "author": "lightolly", "level": 2, "history": { + "v4.0": "修复插件数据页异常", "v3.9.3": "修复PTT的用户等级统计", "v3.9.2": "修复YemaPT的上传下载统计错误", "v3.9.1": "修复mteam域名地址", @@ -271,7 +272,7 @@ "author": "thsrite", "level": 1, "history": { - "v1.3":"去除已废弃的环境变量引用", + "v1.3": "去除已废弃的环境变量引用", "v1.2": "增强API安全性" } }, diff --git a/plugins/sitestatistic/__init__.py b/plugins/sitestatistic/__init__.py index 90b2218..2469e00 100644 --- a/plugins/sitestatistic/__init__.py +++ b/plugins/sitestatistic/__init__.py @@ -14,8 +14,7 @@ from ruamel.yaml import CommentedMap from app import schemas from app.core.config import settings -from app.core.event import Event -from app.core.event import eventmanager +from app.core.event import Event, eventmanager from app.db.models import PluginData from app.db.site_oper import SiteOper from app.helper.browser import PlaywrightHelper @@ -43,7 +42,7 @@ class SiteStatistic(_PluginBase): # 插件图标 plugin_icon = "statistic.png" # 插件版本 - plugin_version = "3.9.3" + plugin_version = "4.0" # 插件作者 plugin_author = "lightolly" # 作者主页 @@ -931,6 +930,12 @@ class SiteStatistic(_PluginBase): 拼装插件详情页面,需要返回页面配置,同时附带数据 """ + def format_bonus(bonus): + try: + return f'{float(bonus):,.1f}' + except ValueError: + return '0.0' + # 获取数据 today, stattistic_data, yesterday_sites_data = self.__get_data() if not stattistic_data: @@ -995,7 +1000,7 @@ class SiteStatistic(_PluginBase): }, { 'component': 'td', - 'text': '{:,.1f}'.format(data.get('bonus') or 0) + 'text': format_bonus(data.get('bonus') or 0) }, { 'component': 'td',