Merge pull request #435 from InfinityPacer/main

This commit is contained in:
jxxghp
2024-08-05 06:57:11 +08:00
committed by GitHub
2 changed files with 12 additions and 6 deletions

View File

@@ -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安全性"
}
},

View File

@@ -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',