批量更新

This commit is contained in:
云泽网
2025-05-19 21:51:21 +08:00
parent 7bd072add9
commit 07b3bd5eff
86 changed files with 1768 additions and 18426 deletions
@@ -1,4 +1,4 @@
<?php /*a:3:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\index\welcome.php";i:1747583088;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
<?php /*a:3:{s:51:"E:\Demo\PHP\yunzer\app\admin\view\index\welcome.php";i:1747658497;s:51:"E:\Demo\PHP\yunzer\app\admin\view\public\header.php";i:1746890051;s:49:"E:\Demo\PHP\yunzer\app\admin\view\public\tail.php";i:1745855804;}*/ ?>
<!DOCTYPE html>
<html>
<head>
@@ -255,8 +255,7 @@
}
.activity-title {
font-weight: 500;
color: #1e293b;
margin-bottom: 4px;
color: #9b9b9b;
}
.activity-time {
font-size: 12px;
@@ -352,10 +351,9 @@
<div class="activity-list">
<?php if(is_array($recentActivities) || $recentActivities instanceof \think\Collection || $recentActivities instanceof \think\Paginator): $i = 0; $__LIST__ = $recentActivities;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$activity): $mod = ($i % 2 );++$i;?>
<div class="activity-item">
<div class="activity-icon"><?php echo htmlentities((string) $activity['icon']); ?></div>
<div class="activity-icon"><?php echo htmlentities((string) (isset($activity['icon']) && ($activity['icon'] !== '')?$activity['icon']:'📌')); ?></div>
<div class="activity-content">
<div class="activity-title"><?php echo htmlentities((string) $activity['title']); ?></div>
<div class="activity-time"><?php echo htmlentities((string) $activity['time']); ?></div>
<div class="activity-title"><?php echo htmlentities((string) $activity['content']); ?></div>
</div>
</div>
<?php endforeach; endif; else: echo "" ;endif; ?>
@@ -408,21 +406,75 @@ function updateTime() {
document.getElementById('current-time').innerHTML = timeString;
}
// 获取用户统计数据
function getUserCounts() {
fetch('<?php echo url("users/counts"); ?>')
.then(response => response.json())
.then(res => {
console.log('用户统计接口返回数据:', res);
if (res.code === 0 && res.data) {
// 更新用户总数
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = res.data.total.toLocaleString();
// 更新用户增长图表
if (window.userChart) {
window.userChart.setOption({
xAxis: {
data: res.data.dates
},
series: [{
name: '新增用户',
data: res.data.counts
}, {
name: '总用户数',
data: res.data.totalCounts
}]
});
}
} else {
console.warn('用户统计接口返回异常:', res);
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = '0';
}
})
.catch(error => {
console.error('获取用户统计失败:', error);
document.querySelector('.stat-card:nth-child(1) .stat-value').textContent = '0';
});
}
// 获取文章统计数据
function getArticleCounts() {
fetch('<?php echo url("article/counts"); ?>')
fetch('<?php echo url("articles/counts"); ?>')
.then(response => response.json())
.then(res => {
console.log('文章统计接口返回数据:', res);
if (res.code === 0 && res.data) {
// 更新文章总数
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = res.data.total.toLocaleString();
// 更新文章统计图表
if (window.articleChart) {
window.articleChart.setOption({
xAxis: {
data: res.data.dates
},
series: [{
name: '新增文章',
data: res.data.counts
}, {
name: '总文章数',
data: res.data.totalCounts
}]
});
}
} else {
console.warn('文章统计接口返回异常:', res);
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = '0';
}
})
.catch(error => {
console.error('获取文章统计失败:', error);
document.querySelector('.stat-card:nth-child(3) .stat-value').textContent = '0';
});
}
@@ -435,12 +487,30 @@ function getResourcesCounts() {
if (res.code === 0 && res.data) {
// 更新资源总数
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = res.data.total.toLocaleString();
// 更新资源统计图表
if (window.resourceChart) {
window.resourceChart.setOption({
xAxis: {
data: res.data.dates
},
series: [{
name: '新增资源',
data: res.data.counts
}, {
name: '总资源数',
data: res.data.totalCounts
}]
});
}
} else {
console.warn('资源统计接口返回异常:', res);
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = '0';
}
})
.catch(error => {
console.error('获取资源统计失败:', error);
document.querySelector('.stat-card:nth-child(4) .stat-value').textContent = '0';
});
}
@@ -449,6 +519,7 @@ setInterval(updateTime, 1000);
// 页面加载完成后获取统计数据
document.addEventListener('DOMContentLoaded', function() {
getUserCounts();
getArticleCounts();
getResourcesCounts();
});
@@ -527,6 +598,7 @@ function initVisitTrend() {
// 用户增长图表
function initUserGrowth() {
var chart = echarts.init(document.getElementById('userGrowth'));
window.userChart = chart;
var option = {
tooltip: {
trigger: 'axis',
@@ -549,7 +621,7 @@ function initUserGrowth() {
xAxis: {
type: 'category',
boundaryGap: false,
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['dates'])); ?>
data: []
},
yAxis: {
type: 'value'
@@ -558,7 +630,7 @@ function initUserGrowth() {
{
name: '新增用户',
type: 'bar',
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['newUsers'])); ?>,
data: [],
itemStyle: {
color: '#3881fd'
}
@@ -567,9 +639,12 @@ function initUserGrowth() {
name: '总用户数',
type: 'line',
smooth: true,
data: <?php echo htmlentities((string) json_encode($chartData['userGrowth']['totalUsers'])); ?>,
data: [],
itemStyle: {
color: '#10b981'
},
lineStyle: {
width: 3
}
}
]
@@ -580,6 +655,7 @@ function initUserGrowth() {
// 资源统计图表
function initResourceStats() {
var chart = echarts.init(document.getElementById('resourceStats'));
window.resourceChart = chart;
var option = {
tooltip: {
trigger: 'axis',
@@ -591,7 +667,7 @@ function initResourceStats() {
}
},
legend: {
data: ['新增资源', '下载量']
data: ['新增资源', '总资源数']
},
grid: {
left: '3%',
@@ -602,7 +678,7 @@ function initResourceStats() {
xAxis: {
type: 'category',
boundaryGap: false,
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['dates'])); ?>
data: []
},
yAxis: {
type: 'value'
@@ -611,18 +687,21 @@ function initResourceStats() {
{
name: '新增资源',
type: 'bar',
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['resources'])); ?>,
data: [],
itemStyle: {
color: '#3881fd'
}
},
{
name: '下载量',
name: '总资源数',
type: 'line',
smooth: true,
data: <?php echo htmlentities((string) json_encode($chartData['resourceStats']['downloads'])); ?>,
data: [],
itemStyle: {
color: '#10b981'
},
lineStyle: {
width: 3
}
}
]
@@ -633,6 +712,7 @@ function initResourceStats() {
// 文章统计图表
function initArticleStats() {
var chart = echarts.init(document.getElementById('articleStats'));
window.articleChart = chart;
var option = {
tooltip: {
trigger: 'axis',
@@ -644,7 +724,7 @@ function initArticleStats() {
}
},
legend: {
data: ['新增文章', '访问量']
data: ['新增文章', '总文章数']
},
grid: {
left: '3%',
@@ -655,7 +735,7 @@ function initArticleStats() {
xAxis: {
type: 'category',
boundaryGap: false,
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['dates'])); ?>
data: []
},
yAxis: {
type: 'value'
@@ -664,18 +744,21 @@ function initArticleStats() {
{
name: '新增文章',
type: 'bar',
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['articles'])); ?>,
data: [],
itemStyle: {
color: '#3881fd'
}
},
{
name: '访问量',
name: '总文章数',
type: 'line',
smooth: true,
data: <?php echo htmlentities((string) json_encode($chartData['articleStats']['views'])); ?>,
data: [],
itemStyle: {
color: '#10b981'
},
lineStyle: {
width: 3
}
}
]