feat(phase-2): add trend chart analysis - grid view of number history

This commit is contained in:
2026-04-21 23:33:39 +08:00
parent f2b432a9f4
commit 616239392a
5 changed files with 203 additions and 1 deletions
+21 -1
View File
@@ -22,7 +22,7 @@ class History extends Backend
* 无需额外权限检查的方法(但仍在 admin 模块内,需要 admin 登录)
* @var array
*/
protected $noNeedRight = ['missingNum'];
protected $noNeedRight = ['missingNum', 'trendData'];
public function _initialize()
{
@@ -52,5 +52,25 @@ class History extends Backend
}
}
/**
* 获取走势图数据
* @return void
*/
public function trendData()
{
if ($this->request->isAjax()) {
$periods = $this->request->get('periods', 30, 'intval');
if ($periods < 10 || $periods > 100) {
$this->error('期数范围必须在 10-100 之间');
}
$type = $this->request->get('type', 'all');
if (!in_array($type, ['all', 'special'])) {
$this->error('查询类型不正确');
}
$result = $this->model->getTrendData($periods, $type);
$this->success('查询成功', null, $result);
}
}
}