修复:优化站点历史信息显示

This commit is contained in:
ngfchl
2023-01-19 21:06:19 +08:00
parent 75b6560318
commit d13a0ec4d5
2 changed files with 256 additions and 106 deletions

View File

@@ -809,9 +809,11 @@ def site_data_api(request):
'ratio': 0 if site_info.ratio == float('inf') else site_info.ratio,
'seedingSize': site_info.seed_vol,
'sp': site_info.my_sp,
'sp_hour': site_info.sp_hour,
'bonus': site_info.my_bonus,
'seeding': site_info.seed,
'leeching': site_info.leech,
'invitation': site_info.invitation,
'info_date': site_info.created_at.date()
}
site_status_list.append(my_site_status)

View File

@@ -1296,22 +1296,22 @@
})
let option = {
title: {
text: 'PT站点数据',
text: `PT站点数据 [共${siteList.length}个站点]`,
textStyle: {
color: 'orangered',
fontWeight: 'bold',
fontFamily: '黑体',
fontSize: '18',
lineHeight: 22,
fontSize: '16',
lineHeight: 20,
rich: ''
},
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`,
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: '14',
lineHeight: 18,
lineHeight: 16,
},
left: '5%',
top: '2%',
@@ -1345,15 +1345,15 @@
orient: 'vertical',
data: [],
},
toolbox: {
show: true,
feature: {
mark: {show: true},
//toolbox: {
// {#show: true,#}
// feature: {
{#mark: {show: true},#}
{#dataView: {show: true, readOnly: false},#}
{#restore: {show: true},#}
saveAsImage: {show: true}
}
},
// saveAsImage: {show: true}
// }
//},
series: [
{
name: '站点数据',
@@ -1420,7 +1420,7 @@
let option = {
backgroundColor: '#130f2c',
title: {
text: 'PT站点数据',
text: `PT站点数据`,
subtext: `上传量:${renderSize(ptData.total_data.uploaded)}\t做种量:${renderSize(ptData.total_data.seeding_size)}\t下载量:${renderSize(ptData.total_data.downloaded)}\t分享率:${ptData.total_data.ratio}`,
subtextStyle: {
color: '#969696',
@@ -1596,6 +1596,10 @@
let spList = []
let ratioList = []
let seedingSizeList = []
let seedingList = []
let leechingList = []
let invitationList = []
let spHourList = []
let dateList = []
dataList.sort((a, b) => {
return a.info_date - b.info_date
@@ -1609,6 +1613,10 @@
seedingSizeList.push(info.seedingSize)
downloadedList.push(info.downloaded)
spList.push(info.sp)
seedingList.push(info.seeding)
leechingList.push(info.leeching)
invitationList.push(info.invitation)
spHourList.push(info.sp_hour)
bonusList.push(info.bonus)
dateList.push(info.info_date)
if (index > 1 && index < dataList.length) {
@@ -1641,6 +1649,10 @@
tooltip: {
show: true,
trigger: 'axis',
alwaysShowContent: true,
textStyle: {
align: 'left',
},
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
@@ -1711,26 +1723,83 @@
}],
series: [
{
name: '做种量',
name: '邀请',
type: 'line',
yAxisIndex: 1,
smooth: true,
{#stack: 'Total',#}
data: invitationList,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
},
},
},
{
name: '正在做种',
type: 'line',
yAxisIndex: 1,
{#stack: 'Total',#}
data: seedingList,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
},
},
},
{
name: '正在下载',
type: 'line',
yAxisIndex: 1,
smooth: true,
{#stack: 'Total',#}
data: leechingList,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
},
},
},
{
name: '保种量',
type: 'line',
smooth: true,
yAxisIndex: 0,
{#stack: 'Total',#}
data: seedingSizeList
},
{
name: '上传量',
type: 'line',
yAxisIndex: 0,
{#stack: 'Total',#}
data: uploadedList
},
{
name: '下载量',
type: 'line',
yAxisIndex: 0,
smooth: true,
{#stack: 'Total',#}
data: downloadedList
},
{
name: '上传量',
type: 'line',
yAxisIndex: 0,
smooth: true,
{#stack: 'Total',#}
data: uploadedList
},
{
name: '上传增量',
type: 'bar',
@@ -1738,11 +1807,60 @@
barMaxWidth: '60%',
{#stack: 'Total',#}
data: diff
}, {
name: '上传增量',
type: 'line',
yAxisIndex: 0,
smooth: true,
barMaxWidth: '60%',
{#stack: 'Total',#}
data: diff,
tooltip: {
show: false,
}
},
{
name: '分享率',
type: 'line',
yAxisIndex: 1,
smooth: true,
{#stack: 'Total',#}
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
}
},
data: ratioList
},
{
name: '时魔',
type: 'line',
yAxisIndex: 1,
smooth: true,
{#stack: 'Total',#}
data: spHourList,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
},
},
},
{
name: '魔力值',
type: 'line',
yAxisIndex: 1,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
@@ -1756,78 +1874,14 @@
{#stack: 'Total',#}
data: spList
},
{
name: '积分',
type: 'line',
yAxisIndex: 1,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return numberFormat(value)
}
},
{#stack: 'Total',#}
data: bonusList
},
{
name: '分享率',
type: 'line',
yAxisIndex: 1,
{#stack: 'Total',#}
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
}
},
data: ratioList
}
]
};
this.showSiteChart = true
this.showAllHistory = false
setTimeout(() => {
this.chart = this.$refs.seeding_charts.chart
this.setChartOption(this.chart, option)
option.series = [{
name: '上传增量',
type: 'bar',
{#stack: 'Total',#}
barMaxWidth: '60%',
data: diff
}]
this.setChartOption(this.$refs.diff_charts.chart, option)
{#option.title.text = `${site.name} - 魔力积分`#}
option.series = [{
name: '魔力值',
type: 'line',
yAxisIndex: 0,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return numberFormat(value)
}
},
{#stack: 'Total',#}
data: spList
}, {
if (eval(bonusList.join("+")) > 0) {
option.series.push({
name: '积分',
type: 'line',
yAxisIndex: 0,
yAxisIndex: 1,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
@@ -1840,26 +1894,119 @@
},
{#stack: 'Total',#}
data: bonusList
}, {
name: '分享率',
type: 'line',
yAxisIndex: 1,
},)
}
this.showSiteChart = true
this.showAllHistory = false
setTimeout(() => {
this.chart = this.$refs.seeding_charts.chart
this.setChartOption(this.chart, option)
option.series = [{
name: '上传增量',
type: 'bar',
{#stack: 'Total',#}
data: ratioList,
barMaxWidth: '60%',
data: diff
}, {
name: '上传增量',
type: 'line',
yAxisIndex: 0,
barMaxWidth: '60%',
smooth: true,
{#stack: 'Total',#}
data: diff,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return numberFormat(value)
}
show: false,
},
}]
//option.tooltip.valueFormatter = function (value) {
// return numberFormat(value)
//}
smooth: true,
},]
this.setChartOption(this.$refs.diff_charts.chart, option)
{#option.title.text = `${site.name} - 魔力积分`#}
option.series = [
{
name: '时魔',
type: 'line',
yAxisIndex: 1,
{#stack: 'Total',#}
data: spHourList,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
},
},
},
{
name: '正在做种',
type: 'line',
yAxisIndex: 1,
{#stack: 'Total',#}
data: seedingList,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return value
},
},
},
{
name: '保种量',
type: 'line',
yAxisIndex: 1,
smooth: true,
{#stack: 'Total',#}
data: seedingSizeList
},
{
name: '魔力值',
type: 'line',
yAxisIndex: 0,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return numberFormat(value)
}
},
{#stack: 'Total',#}
data: spList
},]
if (eval(bonusList.join("+")) > 0) {
option.series.push({
name: '积分',
type: 'line',
yAxisIndex: 0,
smooth: true,
tooltip: {
show: true,
trigger: 'axis',
//formatter: function (params) {
// return params.name + '\t' + renderSize(params.data.value)
//},
valueFormatter: function (value) {
return numberFormat(value)
}
},
{#stack: 'Total',#}
data: bonusList
})
}
option.yAxis[0].axisLabel.formatter = function (value) {
return numberFormat(value)
}
@@ -1868,6 +2015,7 @@
option.series = [{
name: '分享率',
type: 'line',
smooth: true,
{#stack: 'Total',#}
data: ratioList
}]