diff --git a/themes/beauty/controller/CommandController.php b/themes/beauty/controller/CommandController.php
index ffccdb9..2a37be1 100644
--- a/themes/beauty/controller/CommandController.php
+++ b/themes/beauty/controller/CommandController.php
@@ -269,6 +269,7 @@ eof;
if (empty($total)) {return false;}
$stats = array(
+ 'updatetime' => time(),
'currentDir' => $dirpath,
'total' => $total,
'current' => $index,
diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php
index 32661cd..c732aec 100644
--- a/themes/beauty/controller/SiteController.php
+++ b/themes/beauty/controller/SiteController.php
@@ -1044,4 +1044,46 @@ Class SiteController extends Controller {
return $this->render($viewName, $params, $pageTitle);
}
+ //获取MainBot扫描状态
+ public function actionBotstats() {
+ $code = 0;
+ $msg = 'OK';
+ $percent = 0;
+
+ $statsFile = __DIR__ . '/../../../runtime/cache/stats_scan.json';
+ if (!file_exists($statsFile)) {
+ $code = 0;
+ $msg = '还没执行过文件扫描任务';
+ }else {
+ try {
+ $code = 1;
+ $msg = "状态:未知";
+
+ $json = file_get_contents($statsFile);
+ $stats = json_decode($json, true);
+ if (!empty($stats['percent'])) {
+ $percent = $stats['percent'];
+ }
+
+ if (!empty($stats['status'])) {
+ $statusNames = [
+ 'running' => '执行中',
+ 'finished' => '已完成',
+ ];
+
+ $status = !empty($statusNames[$stats['status']]) ? $statusNames[$stats['status']] : '未知';
+ $msg = "状态:{$status}";
+ }
+
+ if (!empty($stats['updatetime'])) {
+ $msg .= ",更新时间:" . date('Y-m-d H:i:s', $stats['updatetime']);
+ }
+ }catch(Exception $e) {
+ $msg = '获取文件扫描状态失败:' . $e->getMessage();
+ }
+ }
+
+ return $this->renderJson(compact('code', 'percent', 'msg'));
+ }
+
}
diff --git a/themes/beauty/views/layout/main.php b/themes/beauty/views/layout/main.php
index 36c5a67..71dc077 100644
--- a/themes/beauty/views/layout/main.php
+++ b/themes/beauty/views/layout/main.php
@@ -101,6 +101,13 @@ require_once __DIR__ . '/../../../../plugins/Html.php';
你的浏览器不支持audio
标签
+
+
+
+