更新
This commit is contained in:
parent
1912c8f408
commit
ebec0c6f2a
2
assets/css/joe.census.min.css
vendored
2
assets/css/joe.census.min.css
vendored
@ -1 +1 @@
|
||||
.joe_census__basic{display:grid;grid-template-columns:repeat(4, 1fr);gap:15px;margin-bottom:15px}.joe_census__basic-item{display:flex;align-items:center;justify-content:space-between;background:var(--background);box-shadow:var(--box-shadow);border-radius:var(--radius-inner) var(--radius-wrap) var(--radius-wrap) var(--radius-inner);padding:12px 15px}.joe_census__basic-item .count h6{font-size:12px;margin-bottom:10px;color:var(--seat)}.joe_census__basic-item .count p{font-size:22px;font-weight:700}.joe_census__basic-item .icon{fill:var(--classA)}.joe_census__basic-item:nth-child(1){border-left:5px solid #1cc88a;color:#1cc88a}.joe_census__basic-item:nth-child(2){border-left:5px solid #36b9cc;color:#36b9cc}.joe_census__basic-item:nth-child(3){border-left:5px solid #2196f3;color:#2196f3}.joe_census__basic-item:nth-child(4){border-left:5px solid #9c27b0;color:#9c27b0}.joe_census__server{display:grid;grid-template-columns:repeat(2, 1fr);gap:15px}.joe_census__server-item{background:var(--background);box-shadow:var(--box-shadow);border-radius:var(--radius-wrap)}.joe_census__server-item .title{display:flex;align-items:center;height:45px;padding:0 12px;border-bottom:1px solid var(--classD);color:var(--main);justify-content:space-between;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_census__server-item .title .count{color:var(--minor);font-size:12px}.joe_census__server-item .title .count .split{margin:0 5px}.joe_census__server-item .content{padding:15px}.joe_census__server-item .content #work,.joe_census__server-item .content #flow{height:348px}
|
||||
.joe_census__basic{display:grid;grid-template-columns:repeat(2, 1fr);gap:15px;margin-bottom:15px}.joe_census__basic-item.list{display:grid;grid-template-columns:repeat(2, 1fr);gap:15px}.joe_census__basic-item.list .list{display:flex;align-items:center;justify-content:space-between;background:var(--background);box-shadow:var(--box-shadow);border-radius:var(--radius-inner) var(--radius-wrap) var(--radius-wrap) var(--radius-inner);padding:15px 15px 12px}.joe_census__basic-item.list .list .count{display:flex;flex-direction:column;justify-content:space-between;height:100%}.joe_census__basic-item.list .list .count h6{font-size:12px;margin-bottom:10px;color:var(--seat)}.joe_census__basic-item.list .list .count p{font-size:28px;font-weight:700}.joe_census__basic-item.list .list .icon{fill:var(--classA)}.joe_census__basic-item.list .list:nth-child(1){border-left:5px solid #1cc88a;color:#1cc88a}.joe_census__basic-item.list .list:nth-child(2){border-left:5px solid #36b9cc;color:#36b9cc}.joe_census__basic-item.list .list:nth-child(3){border-left:5px solid #2196f3;color:#2196f3}.joe_census__basic-item.list .list:nth-child(4){border-left:5px solid #9c27b0;color:#9c27b0}.joe_census__basic-item.category{background:var(--background);box-shadow:var(--box-shadow);border-radius:var(--radius-wrap)}.joe_census__basic-item.category #category{height:230px}.joe_census__lately{background:var(--background);margin-bottom:15px;border-radius:var(--radius-wrap);box-shadow:var(--box-shadow)}.joe_census__lately .title{display:flex;align-items:center;height:45px;padding:0 12px;border-bottom:1px solid var(--classC);color:var(--main);justify-content:space-between;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_census__lately #lately{height:320px}.joe_census__server{display:grid;grid-template-columns:repeat(2, 1fr);gap:15px}.joe_census__server-item{background:var(--background);box-shadow:var(--box-shadow);border-radius:var(--radius-wrap)}.joe_census__server-item .title{display:flex;align-items:center;height:45px;padding:0 12px;border-bottom:1px solid var(--classC);color:var(--main);justify-content:space-between;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_census__server-item .title .count{color:var(--minor);font-size:12px}.joe_census__server-item .title .count .split{margin:0 5px}.joe_census__server-item .content{padding:15px}.joe_census__server-item .content #work,.joe_census__server-item .content #flow{height:348px}
|
||||
|
@ -1,47 +1,85 @@
|
||||
.joe_census {
|
||||
&__basic {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 15px;
|
||||
margin-bottom: 15px;
|
||||
&-item {
|
||||
&.list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 15px;
|
||||
.list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: var(--background);
|
||||
box-shadow: var(--box-shadow);
|
||||
border-radius: var(--radius-inner) var(--radius-wrap) var(--radius-wrap) var(--radius-inner);
|
||||
padding: 15px 15px 12px;
|
||||
.count {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 100%;
|
||||
h6 {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
color: var(--seat);
|
||||
}
|
||||
p {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
fill: var(--classA);
|
||||
}
|
||||
&:nth-child(1) {
|
||||
border-left: 5px solid #1cc88a;
|
||||
color: #1cc88a;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
border-left: 5px solid #36b9cc;
|
||||
color: #36b9cc;
|
||||
}
|
||||
&:nth-child(3) {
|
||||
border-left: 5px solid #2196f3;
|
||||
color: #2196f3;
|
||||
}
|
||||
&:nth-child(4) {
|
||||
border-left: 5px solid #9c27b0;
|
||||
color: #9c27b0;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.category {
|
||||
background: var(--background);
|
||||
box-shadow: var(--box-shadow);
|
||||
border-radius: var(--radius-wrap);
|
||||
#category {
|
||||
height: 230px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&__lately {
|
||||
background: var(--background);
|
||||
margin-bottom: 15px;
|
||||
border-radius: var(--radius-wrap);
|
||||
box-shadow: var(--box-shadow);
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid var(--classC);
|
||||
color: var(--main);
|
||||
justify-content: space-between;
|
||||
background: var(--background);
|
||||
box-shadow: var(--box-shadow);
|
||||
border-radius: var(--radius-inner) var(--radius-wrap) var(--radius-wrap) var(--radius-inner);
|
||||
padding: 12px 15px;
|
||||
.count {
|
||||
h6 {
|
||||
font-size: 12px;
|
||||
margin-bottom: 10px;
|
||||
color: var(--seat);
|
||||
}
|
||||
p {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
fill: var(--classA);
|
||||
}
|
||||
&:nth-child(1) {
|
||||
border-left: 5px solid #1cc88a;
|
||||
color: #1cc88a;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
border-left: 5px solid #36b9cc;
|
||||
color: #36b9cc;
|
||||
}
|
||||
&:nth-child(3) {
|
||||
border-left: 5px solid #2196f3;
|
||||
color: #2196f3;
|
||||
}
|
||||
&:nth-child(4) {
|
||||
border-left: 5px solid #9c27b0;
|
||||
color: #9c27b0;
|
||||
}
|
||||
user-select: none;
|
||||
}
|
||||
#lately {
|
||||
height: 320px;
|
||||
}
|
||||
}
|
||||
&__server {
|
||||
@ -57,7 +95,7 @@
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid var(--classD);
|
||||
border-bottom: 1px solid var(--classC);
|
||||
color: var(--main);
|
||||
justify-content: space-between;
|
||||
user-select: none;
|
||||
|
@ -1,208 +1,296 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
/* 转换字节 */
|
||||
const bytesToSize = bytes => {
|
||||
const k = 1024,
|
||||
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
|
||||
};
|
||||
{
|
||||
/* 转换字节 */
|
||||
const bytesToSize = bytes => {
|
||||
const k = 1024,
|
||||
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
|
||||
};
|
||||
|
||||
const categories = [];
|
||||
const upSeries = [];
|
||||
const downSeries = [];
|
||||
const categories = [];
|
||||
const upSeries = [];
|
||||
const downSeries = [];
|
||||
|
||||
const flowDom = document.querySelector('#flow');
|
||||
const workDom = document.querySelector('#work');
|
||||
const flowChart = flowDom && echarts.init(flowDom);
|
||||
const workChart = workDom && echarts.init(workDom);
|
||||
if (flowDom && workDom) initChart();
|
||||
const flowDom = document.querySelector('#flow');
|
||||
const workDom = document.querySelector('#work');
|
||||
const flowChart = flowDom && echarts.init(flowDom);
|
||||
const workChart = workDom && echarts.init(workDom);
|
||||
if (flowDom && workDom) initChart();
|
||||
|
||||
function initChart() {
|
||||
function initChart() {
|
||||
$.ajax({
|
||||
url: Joe.BASE_API,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
routeType: 'server_status'
|
||||
},
|
||||
success(res) {
|
||||
{
|
||||
$('.joe_census__server-item .count .up').html(`总发送:${bytesToSize(res.upTotal)}`);
|
||||
$('.joe_census__server-item .count .down').html(`总接收:${bytesToSize(res.downTotal)}`);
|
||||
const stamp = new Date();
|
||||
const hours = String(stamp.getHours()).padStart(2, 0);
|
||||
const minutes = String(stamp.getMinutes()).padStart(2, 0);
|
||||
const seconds = String(stamp.getSeconds()).padStart(2, 0);
|
||||
const time = `${hours}:${minutes}:${seconds}`;
|
||||
categories.push(time);
|
||||
upSeries.push(res.up);
|
||||
downSeries.push(res.down);
|
||||
if (categories.length > 5) categories.shift();
|
||||
if (upSeries.length > 5) upSeries.shift();
|
||||
if (downSeries.length > 5) downSeries.shift();
|
||||
flowChart.setOption({
|
||||
title: {
|
||||
subtext: '单位 KB/s'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '0',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: categories
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'line',
|
||||
name: '上行',
|
||||
smooth: true,
|
||||
showSymbol: false,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#f39494',
|
||||
areaStyle: {
|
||||
color: '#f39494'
|
||||
},
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
color: '#f39494'
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: '总量',
|
||||
data: upSeries
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
name: '下行',
|
||||
smooth: true,
|
||||
showSymbol: false,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#9dd3e8',
|
||||
areaStyle: {
|
||||
color: '#9dd3e8'
|
||||
},
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
color: '#9dd3e8'
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: '总量',
|
||||
data: downSeries
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
{
|
||||
/* CPU占用 */
|
||||
const cpuUse = res.cpu[0];
|
||||
/* 内存占用 */
|
||||
const memoryRealUse = Math.round((res.memory.memRealUsed / res.memory.memTotal) * 1000) / 10;
|
||||
/* 内存缓冲 */
|
||||
const memoryCacheUse = Math.round((res.memory.memCached / res.memory.memTotal) * 1000) / 10;
|
||||
/* 系统缓冲 */
|
||||
const memoryBufferUse = Math.round((res.memory.memBuffers / res.memory.memTotal) * 1000) / 10;
|
||||
/* 系统负载 */
|
||||
const systemLoad = Math.round((res.load.one / res.load.max) * 100) > 100 ? 100 : Math.round((res.load.one / res.load.max) * 100);
|
||||
workChart.setOption({
|
||||
title: {
|
||||
subtext: '单位 百分比'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '3%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
data: ['CPU占用', '内存占用', '系统缓冲', '内存缓冲', '系统负载']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: {
|
||||
data: [
|
||||
{
|
||||
name: 'CPU占用',
|
||||
value: cpuUse,
|
||||
itemStyle: {
|
||||
color: '#b3c25a'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '内存占用',
|
||||
value: memoryRealUse,
|
||||
itemStyle: {
|
||||
color: '#67b580'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '系统缓冲',
|
||||
value: memoryBufferUse,
|
||||
itemStyle: {
|
||||
color: '#86ba71'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '内存缓冲',
|
||||
value: memoryCacheUse,
|
||||
itemStyle: {
|
||||
color: '#feb041'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '系统负载',
|
||||
value: systemLoad,
|
||||
itemStyle: {
|
||||
color: '#fd7e55'
|
||||
}
|
||||
}
|
||||
],
|
||||
type: 'bar',
|
||||
showBackground: true,
|
||||
label: {
|
||||
show: true,
|
||||
color: '#ffffff',
|
||||
formatter: params => `${params.data.value} %`
|
||||
},
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(initChart, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* 初始化统计 */
|
||||
{
|
||||
const categoryDom = document.querySelector('#category');
|
||||
const categoryChart = echarts.init(categoryDom);
|
||||
const seriesData = [];
|
||||
$('.joe_census__basic-item.category ul li').each((index, item) => {
|
||||
seriesData.push({
|
||||
name: item.getAttribute('data-name'),
|
||||
value: item.getAttribute('data-value')
|
||||
});
|
||||
});
|
||||
categoryChart.setOption({
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'pie',
|
||||
roseType: 'area',
|
||||
itemStyle: {
|
||||
borderRadius: 8
|
||||
},
|
||||
data: seriesData
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
/* 初始化评论统计 */
|
||||
{
|
||||
const latelyDom = document.querySelector('#lately');
|
||||
const latelyChart = echarts.init(latelyDom);
|
||||
$.ajax({
|
||||
url: Joe.BASE_API,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
routeType: 'server_status'
|
||||
routeType: 'comment_lately'
|
||||
},
|
||||
success(res) {
|
||||
{
|
||||
$('.joe_census__server-item .count .up').html(`总发送:${bytesToSize(res.upTotal)}`);
|
||||
$('.joe_census__server-item .count .down').html(`总接收:${bytesToSize(res.downTotal)}`);
|
||||
const stamp = new Date();
|
||||
const hours = String(stamp.getHours()).padStart(2, 0);
|
||||
const minutes = String(stamp.getMinutes()).padStart(2, 0);
|
||||
const seconds = String(stamp.getSeconds()).padStart(2, 0);
|
||||
const time = `${hours}:${minutes}:${seconds}`;
|
||||
categories.push(time);
|
||||
upSeries.push(res.up);
|
||||
downSeries.push(res.down);
|
||||
if (categories.length > 5) categories.shift();
|
||||
if (upSeries.length > 5) upSeries.shift();
|
||||
if (downSeries.length > 5) downSeries.shift();
|
||||
flowChart.setOption({
|
||||
title: {
|
||||
subtext: '单位 KB/s'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '0',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: categories
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'line',
|
||||
name: '上行',
|
||||
smooth: true,
|
||||
showSymbol: false,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#f39494',
|
||||
areaStyle: {
|
||||
color: '#f39494'
|
||||
},
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
color: '#f39494'
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: '总量',
|
||||
data: upSeries
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
name: '下行',
|
||||
smooth: true,
|
||||
showSymbol: false,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#9dd3e8',
|
||||
areaStyle: {
|
||||
color: '#9dd3e8'
|
||||
},
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
color: '#9dd3e8'
|
||||
}
|
||||
}
|
||||
},
|
||||
stack: '总量',
|
||||
data: downSeries
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
{
|
||||
/* CPU占用 */
|
||||
const cpuUse = res.cpu[0];
|
||||
/* 内存占用 */
|
||||
const memoryRealUse = Math.round((res.memory.memRealUsed / res.memory.memTotal) * 1000) / 10;
|
||||
/* 内存缓冲 */
|
||||
const memoryCacheUse = Math.round((res.memory.memCached / res.memory.memTotal) * 1000) / 10;
|
||||
/* 系统缓冲 */
|
||||
const memoryBufferUse = Math.round((res.memory.memBuffers / res.memory.memTotal) * 1000) / 10;
|
||||
/* 系统负载 */
|
||||
const systemLoad = Math.round((res.load.one / res.load.max) * 100) > 100 ? 100 : Math.round((res.load.one / res.load.max) * 100);
|
||||
workChart.setOption({
|
||||
title: {
|
||||
subtext: '单位 百分比'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '3%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
data: ['CPU占用', '内存占用', '系统缓冲', '内存缓冲', '系统负载']
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: {
|
||||
data: [
|
||||
{
|
||||
name: 'CPU占用',
|
||||
value: cpuUse,
|
||||
itemStyle: {
|
||||
color: '#b3c25a'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '内存占用',
|
||||
value: memoryRealUse,
|
||||
itemStyle: {
|
||||
color: '#67b580'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '系统缓冲',
|
||||
value: memoryBufferUse,
|
||||
itemStyle: {
|
||||
color: '#86ba71'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '内存缓冲',
|
||||
value: memoryCacheUse,
|
||||
itemStyle: {
|
||||
color: '#feb041'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '系统负载',
|
||||
value: systemLoad,
|
||||
itemStyle: {
|
||||
color: '#fd7e55'
|
||||
}
|
||||
}
|
||||
],
|
||||
type: 'bar',
|
||||
showBackground: true,
|
||||
latelyChart.setOption({
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
label: {
|
||||
show: true,
|
||||
color: '#ffffff',
|
||||
formatter: params => `${params.data.value} %`
|
||||
},
|
||||
backgroundStyle: {
|
||||
color: 'rgba(180, 180, 180, 0.2)'
|
||||
backgroundColor: '#6a7985'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
setTimeout(initChart, 2000);
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '3%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
data: res.categories
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: {
|
||||
name: '数量',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#91cc75',
|
||||
lineStyle: {
|
||||
width: 2,
|
||||
color: '#91cc75'
|
||||
}
|
||||
}
|
||||
},
|
||||
data: res.series,
|
||||
type: 'line',
|
||||
smooth: true
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
2
assets/js/joe.census.min.js
vendored
2
assets/js/joe.census.min.js
vendored
@ -1 +1 @@
|
||||
document.addEventListener("DOMContentLoaded",()=>{function e(){$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"server_status"},success(l){{$(".joe_census__server-item .count .up").html(`总发送:${t(l.upTotal)}`),$(".joe_census__server-item .count .down").html(`总接收:${t(l.downTotal)}`);const e=new Date,n=String(e.getHours()).padStart(2,0),i=String(e.getMinutes()).padStart(2,0),m=String(e.getSeconds()).padStart(2,0),d=`${n}:${i}:${m}`;o.push(d),a.push(l.up),r.push(l.down),o.length>5&&o.shift(),a.length>5&&a.shift(),r.length>5&&r.shift(),s.setOption({title:{subtext:"单位 KB/s"},grid:{left:"3%",right:"4%",bottom:"0",containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},xAxis:{axisTick:{show:!1},type:"category",boundaryGap:!1,data:o},yAxis:{type:"value"},series:[{type:"line",name:"上行",smooth:!0,showSymbol:!1,itemStyle:{normal:{color:"#f39494",areaStyle:{color:"#f39494"},lineStyle:{width:2,color:"#f39494"}}},stack:"总量",data:a},{type:"line",name:"下行",smooth:!0,showSymbol:!1,itemStyle:{normal:{color:"#9dd3e8",areaStyle:{color:"#9dd3e8"},lineStyle:{width:2,color:"#9dd3e8"}}},stack:"总量",data:r}]})}{const e=l.cpu[0],t=Math.round(l.memory.memRealUsed/l.memory.memTotal*1e3)/10,o=Math.round(l.memory.memCached/l.memory.memTotal*1e3)/10,a=Math.round(l.memory.memBuffers/l.memory.memTotal*1e3)/10,r=Math.round(l.load.one/l.load.max*100)>100?100:Math.round(l.load.one/l.load.max*100);i.setOption({title:{subtext:"单位 百分比"},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"3%",right:"3%",bottom:"3%",containLabel:!0},xAxis:{type:"category",axisTick:{show:!1},data:["CPU占用","内存占用","系统缓冲","内存缓冲","系统负载"]},yAxis:{type:"value"},series:{data:[{name:"CPU占用",value:e,itemStyle:{color:"#b3c25a"}},{name:"内存占用",value:t,itemStyle:{color:"#67b580"}},{name:"系统缓冲",value:a,itemStyle:{color:"#86ba71"}},{name:"内存缓冲",value:o,itemStyle:{color:"#feb041"}},{name:"系统负载",value:r,itemStyle:{color:"#fd7e55"}}],type:"bar",showBackground:!0,label:{show:!0,color:"#ffffff",formatter:e=>`${e.data.value} %`},backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}}})}setTimeout(e,2e3)}})}const t=e=>{const t=1024,o=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(e)/Math.log(t));return(e/Math.pow(t,a)).toPrecision(3)+" "+o[a]},o=[],a=[],r=[],l=document.querySelector("#flow"),n=document.querySelector("#work"),s=l&&echarts.init(l),i=n&&echarts.init(n);l&&n&&e()});
|
||||
document.addEventListener("DOMContentLoaded",()=>{{const t=e=>{const t=1024,o=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(e)/Math.log(t));return(e/Math.pow(t,a)).toPrecision(3)+" "+o[a]},o=[],a=[],r=[],l=document.querySelector("#flow"),i=document.querySelector("#work"),s=l&&echarts.init(l),n=i&&echarts.init(i);function e(){$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"server_status"},success(l){{$(".joe_census__server-item .count .up").html(`总发送:${t(l.upTotal)}`),$(".joe_census__server-item .count .down").html(`总接收:${t(l.downTotal)}`);const e=new Date,i=String(e.getHours()).padStart(2,0),n=String(e.getMinutes()).padStart(2,0),c=String(e.getSeconds()).padStart(2,0),m=`${i}:${n}:${c}`;o.push(m),a.push(l.up),r.push(l.down),o.length>5&&o.shift(),a.length>5&&a.shift(),r.length>5&&r.shift(),s.setOption({title:{subtext:"单位 KB/s"},grid:{left:"3%",right:"4%",bottom:"0",containLabel:!0},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},xAxis:{axisTick:{show:!1},type:"category",boundaryGap:!1,data:o},yAxis:{type:"value"},series:[{type:"line",name:"上行",smooth:!0,showSymbol:!1,itemStyle:{normal:{color:"#f39494",areaStyle:{color:"#f39494"},lineStyle:{width:2,color:"#f39494"}}},stack:"总量",data:a},{type:"line",name:"下行",smooth:!0,showSymbol:!1,itemStyle:{normal:{color:"#9dd3e8",areaStyle:{color:"#9dd3e8"},lineStyle:{width:2,color:"#9dd3e8"}}},stack:"总量",data:r}]})}{const e=l.cpu[0],t=Math.round(l.memory.memRealUsed/l.memory.memTotal*1e3)/10,o=Math.round(l.memory.memCached/l.memory.memTotal*1e3)/10,a=Math.round(l.memory.memBuffers/l.memory.memTotal*1e3)/10,r=Math.round(l.load.one/l.load.max*100)>100?100:Math.round(l.load.one/l.load.max*100);n.setOption({title:{subtext:"单位 百分比"},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},grid:{left:"3%",right:"3%",bottom:"3%",containLabel:!0},xAxis:{type:"category",axisTick:{show:!1},data:["CPU占用","内存占用","系统缓冲","内存缓冲","系统负载"]},yAxis:{type:"value"},series:{data:[{name:"CPU占用",value:e,itemStyle:{color:"#b3c25a"}},{name:"内存占用",value:t,itemStyle:{color:"#67b580"}},{name:"系统缓冲",value:a,itemStyle:{color:"#86ba71"}},{name:"内存缓冲",value:o,itemStyle:{color:"#feb041"}},{name:"系统负载",value:r,itemStyle:{color:"#fd7e55"}}],type:"bar",showBackground:!0,label:{show:!0,color:"#ffffff",formatter:e=>`${e.data.value} %`},backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}}})}setTimeout(e,2e3)}})}l&&i&&e()}{const e=document.querySelector("#category"),t=echarts.init(e),o=[];$(".joe_census__basic-item.category ul li").each((e,t)=>{o.push({name:t.getAttribute("data-name"),value:t.getAttribute("data-value")})}),t.setOption({tooltip:{trigger:"item"},series:[{type:"pie",roseType:"area",itemStyle:{borderRadius:8},data:o}]})}{const e=document.querySelector("#lately"),t=echarts.init(e);$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"comment_lately"},success(e){t.setOption({tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{left:"3%",right:"3%",bottom:"3%",containLabel:!0},xAxis:{type:"category",axisTick:{show:!1},data:e.categories},yAxis:{type:"value"},series:{name:"数量",itemStyle:{normal:{color:"#91cc75",lineStyle:{width:2,color:"#91cc75"}}},data:e.series,type:"line",smooth:!0}})}})}});
|
81
census.php
81
census.php
@ -27,44 +27,59 @@
|
||||
<?php Typecho_Widget::widget('Widget_Stat')->to($item); ?>
|
||||
<!-- 基础统计 -->
|
||||
<div class="joe_census__basic">
|
||||
<div class="joe_census__basic-item">
|
||||
<div class="count">
|
||||
<h6>文章数</h6>
|
||||
<p><?php echo number_format($item->publishedPostsNum); ?></p>
|
||||
<div class="joe_census__basic-item list">
|
||||
<div class="list">
|
||||
<div class="count">
|
||||
<h6>文章数</h6>
|
||||
<p><?php echo number_format($item->publishedPostsNum); ?></p>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="30" height="30">
|
||||
<path d="M947.2 298.667c0-34.134-12.8-68.267-38.4-89.6L814.933 115.2c-51.2-51.2-132.266-51.2-179.2 0l-512 516.267c-25.6 21.333-38.4 55.466-38.4 89.6v132.266c0 46.934 38.4 85.334 81.067 85.334h682.667c25.6 0 42.666-17.067 42.666-42.667s-17.066-42.667-42.666-42.667h-409.6L908.8 388.267c25.6-25.6 38.4-55.467 38.4-89.6zM170.667 853.333V721.067c0-12.8 4.266-21.334 12.8-29.867l413.866-418.133 153.6 153.6-413.866 413.866c-8.534 8.534-21.334 12.8-34.134 12.8H170.667zm678.4-524.8l-38.4 38.4-153.6-153.6 38.4-38.4c8.533-8.533 21.333-12.8 29.866-12.8 12.8 0 21.334 4.267 29.867 12.8l93.867 93.867c8.533 8.533 12.8 17.067 12.8 29.867s-4.267 21.333-12.8 29.866z" />
|
||||
</svg>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="30" height="30">
|
||||
<path d="M947.2 298.667c0-34.134-12.8-68.267-38.4-89.6L814.933 115.2c-51.2-51.2-132.266-51.2-179.2 0l-512 516.267c-25.6 21.333-38.4 55.466-38.4 89.6v132.266c0 46.934 38.4 85.334 81.067 85.334h682.667c25.6 0 42.666-17.067 42.666-42.667s-17.066-42.667-42.666-42.667h-409.6L908.8 388.267c25.6-25.6 38.4-55.467 38.4-89.6zM170.667 853.333V721.067c0-12.8 4.266-21.334 12.8-29.867l413.866-418.133 153.6 153.6-413.866 413.866c-8.534 8.534-21.334 12.8-34.134 12.8H170.667zm678.4-524.8l-38.4 38.4-153.6-153.6 38.4-38.4c8.533-8.533 21.333-12.8 29.866-12.8 12.8 0 21.334 4.267 29.867 12.8l93.867 93.867c8.533 8.533 12.8 17.067 12.8 29.867s-4.267 21.333-12.8 29.866z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="joe_census__basic-item">
|
||||
<div class="count">
|
||||
<h6>评论数</h6>
|
||||
<p><?php echo number_format($item->publishedCommentsNum); ?></p>
|
||||
<div class="list">
|
||||
<div class="count">
|
||||
<h6>评论数</h6>
|
||||
<p><?php echo number_format($item->publishedCommentsNum); ?></p>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
||||
<path d="M511.914 928.016c-8.257 0-16.341-3.096-22.706-9.46l-95.984-95.985c-12.557-12.557-12.557-32.682 0-45.24s32.683-12.556 45.24 0l73.45 73.45 73.45-73.45c6.02-6.02 14.105-9.46 22.706-9.46h223.962c17.718 0 31.995-14.277 31.995-31.995V223.962c0-17.545-14.277-31.994-31.995-31.994H192.14c-17.546 0-31.995 14.449-31.995 31.994v511.914c0 17.718 14.45 31.995 31.995 31.995h95.984c17.717 0 31.994 14.277 31.994 31.995s-14.277 31.994-31.994 31.994H192.14c-52.98 0-95.984-43.003-95.984-95.984V223.962c0-52.98 43.003-95.984 95.984-95.984h639.892c52.98 0 95.984 43.004 95.984 95.984v511.914c0 52.98-43.003 95.984-95.984 95.984H621.143l-86.523 86.695c-6.193 6.193-14.45 9.461-22.706 9.461z" />
|
||||
<path d="M335.944 511.914c-26.49 0-47.992-21.502-47.992-47.992s21.501-47.992 47.992-47.992 47.991 21.502 47.991 47.992-21.501 47.992-47.991 47.992zm191.967 0c-26.49 0-47.992-21.502-47.992-47.992s21.502-47.992 47.992-47.992 47.992 21.502 47.992 47.992-21.502 47.992-47.992 47.992zm192.14 0c-26.49 0-47.992-21.502-47.992-47.992s21.502-47.992 47.992-47.992 47.992 21.502 47.992 47.992-21.674 47.992-47.992 47.992z" />
|
||||
</svg>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
||||
<path d="M511.914 928.016c-8.257 0-16.341-3.096-22.706-9.46l-95.984-95.985c-12.557-12.557-12.557-32.682 0-45.24s32.683-12.556 45.24 0l73.45 73.45 73.45-73.45c6.02-6.02 14.105-9.46 22.706-9.46h223.962c17.718 0 31.995-14.277 31.995-31.995V223.962c0-17.545-14.277-31.994-31.995-31.994H192.14c-17.546 0-31.995 14.449-31.995 31.994v511.914c0 17.718 14.45 31.995 31.995 31.995h95.984c17.717 0 31.994 14.277 31.994 31.995s-14.277 31.994-31.994 31.994H192.14c-52.98 0-95.984-43.003-95.984-95.984V223.962c0-52.98 43.003-95.984 95.984-95.984h639.892c52.98 0 95.984 43.004 95.984 95.984v511.914c0 52.98-43.003 95.984-95.984 95.984H621.143l-86.523 86.695c-6.193 6.193-14.45 9.461-22.706 9.461z" />
|
||||
<path d="M335.944 511.914c-26.49 0-47.992-21.502-47.992-47.992s21.501-47.992 47.992-47.992 47.991 21.502 47.991 47.992-21.501 47.992-47.991 47.992zm191.967 0c-26.49 0-47.992-21.502-47.992-47.992s21.502-47.992 47.992-47.992 47.992 21.502 47.992 47.992-21.502 47.992-47.992 47.992zm192.14 0c-26.49 0-47.992-21.502-47.992-47.992s21.502-47.992 47.992-47.992 47.992 21.502 47.992 47.992-21.674 47.992-47.992 47.992z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="joe_census__basic-item">
|
||||
<div class="count">
|
||||
<h6>分类数</h6>
|
||||
<p><?php echo number_format($item->categoriesNum); ?></p>
|
||||
<div class="list">
|
||||
<div class="count">
|
||||
<h6>分类数</h6>
|
||||
<p><?php echo number_format($item->categoriesNum); ?></p>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="28" height="28">
|
||||
<path d="M166.79 123.639v778.578l311.724-133.273a86.303 86.303 0 0 1 64.857-1.208L857.21 888.279v-764.64H166.79zM145.215 58.91h733.57a43.151 43.151 0 0 1 43.152 43.152v817.608a43.151 43.151 0 0 1-58.62 40.282l-343.14-131.806a21.576 21.576 0 0 0-16.225.303L162.194 974.582a43.151 43.151 0 0 1-60.132-39.678V102.062a43.151 43.151 0 0 1 43.153-43.15z" />
|
||||
<path d="M329.816 411.307a32.363 32.363 0 1 1 0-64.727h364.368a32.363 32.363 0 1 1 0 64.727H329.816zm0 170.814a32.363 32.363 0 1 1 0-64.728h364.368a32.363 32.363 0 1 1 0 64.728H329.816z" />
|
||||
</svg>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="28" height="28">
|
||||
<path d="M166.79 123.639v778.578l311.724-133.273a86.303 86.303 0 0 1 64.857-1.208L857.21 888.279v-764.64H166.79zM145.215 58.91h733.57a43.151 43.151 0 0 1 43.152 43.152v817.608a43.151 43.151 0 0 1-58.62 40.282l-343.14-131.806a21.576 21.576 0 0 0-16.225.303L162.194 974.582a43.151 43.151 0 0 1-60.132-39.678V102.062a43.151 43.151 0 0 1 43.153-43.15z" />
|
||||
<path d="M329.816 411.307a32.363 32.363 0 1 1 0-64.727h364.368a32.363 32.363 0 1 1 0 64.727H329.816zm0 170.814a32.363 32.363 0 1 1 0-64.728h364.368a32.363 32.363 0 1 1 0 64.728H329.816z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="joe_census__basic-item">
|
||||
<div class="count">
|
||||
<h6>页面数</h6>
|
||||
<p><?php echo number_format($item->publishedPagesNum + $item->publishedPostsNum); ?></p>
|
||||
<div class="list">
|
||||
<div class="count">
|
||||
<h6>页面数</h6>
|
||||
<p><?php echo number_format($item->publishedPagesNum + $item->publishedPostsNum); ?></p>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="26" height="26">
|
||||
<path d="M653.824 32.256l264.96 264.704c20.48 20.48 32.256 48.384 32.256 77.568v539.648c0 60.672-49.152 109.824-109.824 109.824H182.784c-60.672 0-109.824-49.152-109.824-109.824V109.824C73.216 49.152 122.368 0 182.784 0h393.472c29.184 0 57.088 11.52 77.568 32.256zm-32 71.168v225.792H847.36L621.824 103.424zm-60.672-30.208H182.784c-20.224 0-36.608 16.384-36.608 36.608v804.608c0 20.224 16.384 36.608 36.608 36.608H840.96c20.224 0 36.608-16.384 36.608-36.608v-524.8 12.544h-256c-40.448 0-73.216-32.768-73.216-73.216v-256h12.8zm0 0" />
|
||||
</svg>
|
||||
</div>
|
||||
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="26" height="26">
|
||||
<path d="M653.824 32.256l264.96 264.704c20.48 20.48 32.256 48.384 32.256 77.568v539.648c0 60.672-49.152 109.824-109.824 109.824H182.784c-60.672 0-109.824-49.152-109.824-109.824V109.824C73.216 49.152 122.368 0 182.784 0h393.472c29.184 0 57.088 11.52 77.568 32.256zm-32 71.168v225.792H847.36L621.824 103.424zm-60.672-30.208H182.784c-20.224 0-36.608 16.384-36.608 36.608v804.608c0 20.224 16.384 36.608 36.608 36.608H840.96c20.224 0 36.608-16.384 36.608-36.608v-524.8 12.544h-256c-40.448 0-73.216-32.768-73.216-73.216v-256h12.8zm0 0" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="joe_census__basic-item category">
|
||||
<?php $this->widget('Widget_Metas_Category_List')->to($item); ?>
|
||||
<ul>
|
||||
<?php while ($item->next()) : ?>
|
||||
<li data-name="<?php $item->name() ?>" data-value="<?php $item->count() ?>"></li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<div id="category"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="joe_census__lately">
|
||||
<div class="title">最近评论</div>
|
||||
<div id="lately"></div>
|
||||
</div>
|
||||
<?php if ($this->options->JBTPanel && $this->options->JBTKey) : ?>
|
||||
<div class="joe_census__server">
|
||||
|
@ -64,6 +64,9 @@ function themeInit($self)
|
||||
case 'server_status':
|
||||
_getServerStatus($self);
|
||||
break;
|
||||
case 'comment_lately':
|
||||
_getCommentLately($self);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* 获取主题当前版本号 */
|
||||
function _getVersion()
|
||||
{
|
||||
return "7.0.3";
|
||||
return "7.0.4";
|
||||
};
|
||||
|
||||
/* 判断是否是手机 */
|
||||
|
@ -314,8 +314,8 @@ function _getServerStatus($self)
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $api_panel . '/system?action=GetNetWork');
|
||||
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 3000);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 3000);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 3000);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 3000);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, array("request_time" => $request_time, "request_token" => $request_token));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
@ -326,18 +326,43 @@ function _getServerStatus($self)
|
||||
curl_close($ch);
|
||||
$self->response->throwJson(array(
|
||||
/* 上行流量KB */
|
||||
"up" => $response["up"],
|
||||
"up" => $response["up"] ? $response["up"] : 0,
|
||||
/* 下行流量KB */
|
||||
"down" => $response["down"],
|
||||
"down" => $response["down"] ? $response["down"] : 0,
|
||||
/* 总发送(字节数) */
|
||||
"upTotal" => $response["upTotal"],
|
||||
"upTotal" => $response["upTotal"] ? $response["upTotal"] : 0,
|
||||
/* 总接收(字节数) */
|
||||
"downTotal" => $response["downTotal"],
|
||||
"downTotal" => $response["downTotal"] ? $response["downTotal"] : 0,
|
||||
/* 内存占用 */
|
||||
"memory" => $response["mem"],
|
||||
"memory" => $response["mem"] ? $response["mem"] : ["memBuffers" => 0, "memCached" => 0, "memFree" => 0, "memRealUsed" => 0, "memTotal" => 0],
|
||||
/* CPU */
|
||||
"cpu" => $response["cpu"],
|
||||
"cpu" => $response["cpu"] ? $response["cpu"] : [0, 0, [0], 0, 0, 0],
|
||||
/* 系统负载 */
|
||||
"load" => $response["load"],
|
||||
"load" => $response["load"] ? $response["load"] : ["fifteen" => 0, "five" => 0, "limit" => 0, "max" => 0, "one" => 0, "safe" => 0],
|
||||
));
|
||||
}
|
||||
|
||||
function _getCommentLately($self)
|
||||
{
|
||||
header("HTTP/1.1 200 OK");
|
||||
header('Access-Control-Allow-Origin:*');
|
||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
||||
$time = time();
|
||||
$num = 7;
|
||||
$categories = [];
|
||||
$series = [];
|
||||
$db = Typecho_Db::get();
|
||||
$prefix = $db->getPrefix();
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$date = date('Y/m/d', strtotime('+' . $i - ($num - 1) . ' days', $time));
|
||||
$sql = "SELECT coid FROM `{$prefix}comments` WHERE FROM_UNIXTIME(created, '%Y/%m/%d') = '{$date}' limit 100";
|
||||
$count = count($db->fetchAll($sql));
|
||||
$categories[] = $date;
|
||||
$series[] = $count;
|
||||
}
|
||||
/* 抛出JSON */
|
||||
$self->response->throwJson([
|
||||
"categories" => $categories,
|
||||
"series" => $series
|
||||
]);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typecho-joe-next",
|
||||
"version": "7.0.3",
|
||||
"version": "7.0.4",
|
||||
"description": "A Theme Of Typecho",
|
||||
"main": "index.php",
|
||||
"keywords": [
|
||||
|
Loading…
Reference in New Issue
Block a user