Files
amlhc/application/admin/controller/History.php
T

77 lines
1.9 KiB
PHP

<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
*
*
* @icon fa fa-circle-o
*/
class History extends Backend
{
/**
* History模型对象
* @var \app\admin\model\History
*/
protected $model = null;
/**
* 无需额外权限检查的方法(但仍在 admin 模块内,需要 admin 登录)
* @var array
*/
protected $noNeedRight = ['missingNum', 'trendData'];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\History;
}
/**
* 查询遗漏号码
* @return void
*/
public function missingNum()
{
if ($this->request->isAjax()) {
$periods = $this->request->get('periods', 10, 'intval');
if ($periods < 1 || $periods > 100) {
$this->error('期数范围必须在 1-100 之间');
}
$type = $this->request->get('type', 'all');
if (!in_array($type, ['all', 'special'])) {
$this->error('查询类型不正确');
}
$result = $this->model->getMissingNumbers($periods, $type);
$this->success('查询成功', null, $result);
}
}
/**
* 获取走势图数据
* @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);
}
}
}