diff --git a/auto_pt/views.py b/auto_pt/views.py index bff6ad4..b933247 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -514,7 +514,7 @@ def site_status_api(request): ids = request.GET.get('ids') try: if ids is None: - my_site_list = MySite.objects.all() + my_site_list = MySite.objects.order_by('time_join').all() else: my_site_list = MySite.objects.filter(pk__in=ids).all() uploaded = 0 @@ -527,6 +527,9 @@ def site_status_api(request): bonus = 0 status_list = [] now = datetime.now() + time_join = my_site_list.first().time_join + p_years = (now - time_join).days / 365 + logger.info(f'P龄:{round(p_years, 4)}年') for my_site in my_site_list: site_info_list = my_site.sitestatus_set.order_by('-pk').all() logger.info(f'{my_site.site.name}: {len(site_info_list)}') @@ -630,9 +633,10 @@ def site_status_api(request): 'sp_hour': sp_hour, 'bonus': bonus, 'ratio': round(uploaded / downloaded, 3), + 'p_years': round(p_years, 4), 'now': datetime.strftime( SiteStatus.objects.order_by('-updated_at').first().updated_at, - '%Y年%m月%d日%H:%M:%S'), + '%Y-%m-%d %H:%M:%S'), } # return render(request, 'auto_pt/status.html') userdata = { diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html index 010a61e..236b072 100644 --- a/templates/auto_pt/status.html +++ b/templates/auto_pt/status.html @@ -881,21 +881,22 @@ }) let option = { title: { - text: 'PT站点数据\nCopy By PTools', + text: 'PT站点数据', textStyle: { color: 'orangered', fontWeight: 'bold', fontFamily: '黑体', - fontSize: '22', - lineHeight: 32, + fontSize: '18', + lineHeight: 22, + rich: '' }, - subtext: `上传量:${renderSize(ptData.total_data.uploaded)}\n做种量:${renderSize(ptData.total_data.seeding_size)}\n下载量:${renderSize(ptData.total_data.downloaded)}\n分享率:${ptData.total_data.ratio}\n时间:${ptData.total_data.now}`, + subtext: `🔼${renderSize(ptData.total_data.uploaded)}\n🔽${renderSize(ptData.total_data.downloaded)}\n☁️${renderSize(ptData.total_data.seeding_size)}\n分享率${ptData.total_data.ratio}\nP 龄:${ptData.total_data.p_years}年\nCopy By PTools`, subtextStyle: { color: 'orange', fontWeight: 'bold', fontFamily: '黑体', - fontSize: '16', - lineHeight: 24, + fontSize: '14', + lineHeight: 18, }, left: '5%', top: '2%', @@ -1458,10 +1459,7 @@ option.tooltip.valueFormatter = null option.yAxis = {} this.setChartOption(this.$refs.ratio_charts.chart, option) - }, 50) - - }, getData() { axios.get(