feat: replace sum analysis with special trend line chart, zodiac/tail numbers use bar charts
This commit is contained in:
@@ -22,7 +22,7 @@ class History extends Backend
|
||||
* 无需额外权限检查的方法(但仍在 admin 模块内,需要 admin 登录)
|
||||
* @var array
|
||||
*/
|
||||
protected $noNeedRight = ['missingNum', 'trendData', 'hotColdNumbers', 'colorWaveAnalysis', 'zodiacAnalysis', 'oddEvenAnalysis', 'bigSmallAnalysis', 'sumAnalysis', 'consecutiveNumbers', 'tailNumbers', 'dashboard'];
|
||||
protected $noNeedRight = ['missingNum', 'trendData', 'hotColdNumbers', 'colorWaveAnalysis', 'zodiacAnalysis', 'oddEvenAnalysis', 'bigSmallAnalysis', 'specialTrend', 'consecutiveNumbers', 'tailNumbers', 'dashboard'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
@@ -169,16 +169,16 @@ class History extends Backend
|
||||
}
|
||||
|
||||
/**
|
||||
* 和值分析
|
||||
* 特码走势
|
||||
*/
|
||||
public function sumAnalysis()
|
||||
public function specialTrend()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$periods = $this->request->get('periods', 30, 'intval');
|
||||
if ($periods < 10 || $periods > 100) {
|
||||
$this->error('期数范围必须在 10-100 之间');
|
||||
}
|
||||
$result = $this->model->getSumAnalysis($periods);
|
||||
$result = $this->model->getSpecialTrend($periods);
|
||||
$this->success('查询成功', null, $result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,22 +366,24 @@ class History extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 和值分析
|
||||
* 特码走势
|
||||
*/
|
||||
public function getSumAnalysis($periods = 30)
|
||||
public function getSpecialTrend($periods = 30)
|
||||
{
|
||||
$history = $this->field('expect,num1,num2,num3,num4,num5,num6,num7')->order('openTime', 'asc')->limit($periods)->select();
|
||||
if (empty($history)) return ['expects' => [], 'sums' => []];
|
||||
$history = $this->field('expect,num7')->order('openTime', 'asc')->limit($periods)->select();
|
||||
if (empty($history)) return ['expects' => [], 'specials' => [], 'colors' => []];
|
||||
|
||||
$expects = []; $sums = [];
|
||||
$num_model = new Num();
|
||||
$colorMap = $num_model->column('color', 'num');
|
||||
|
||||
$expects = []; $specials = []; $colors = [];
|
||||
foreach ($history as $row) {
|
||||
$expects[] = (string)$row['expect'];
|
||||
$sum = (int)$row['num1'] + (int)$row['num2'] + (int)$row['num3'] + (int)$row['num4'] + (int)$row['num5'] + (int)$row['num6'] + (int)$row['num7'];
|
||||
$sums[] = $sum;
|
||||
$num = (int)$row['num7'];
|
||||
$specials[] = $num;
|
||||
$colors[] = $colorMap[$num] ?? '';
|
||||
}
|
||||
$avg = round(array_sum($sums) / count($sums), 1);
|
||||
$max = max($sums); $min = min($sums);
|
||||
return ['expects' => $expects, 'sums' => $sums, 'avg' => $avg, 'max' => $max, 'min' => $min];
|
||||
return ['expects' => $expects, 'specials' => $specials, 'colors' => $colors];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -457,7 +459,7 @@ class History extends Model
|
||||
'zodiac' => $this->getZodiacAnalysis($periods, $type),
|
||||
'oddeven' => $this->getOddEvenAnalysis($periods, $type),
|
||||
'bigsmall' => $this->getBigSmallAnalysis($periods, $type),
|
||||
'sum' => $this->getSumAnalysis($periods),
|
||||
'special' => $this->getSpecialTrend($periods),
|
||||
'tailnumbers' => $this->getTailNumbers($periods, $type)
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user