feat: replace sum analysis with special trend line chart, zodiac/tail numbers use bar charts

This commit is contained in:
2026-04-22 00:13:09 +08:00
parent 074aa4d677
commit 79f1a1dc80
3 changed files with 70 additions and 39 deletions
+13 -11
View File
@@ -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)
];
}