From 79f1a1dc80d8fb4a992db148f112db68ca1ba23a Mon Sep 17 00:00:00 2001 From: leon <916117771@qq.com> Date: Wed, 22 Apr 2026 00:13:09 +0800 Subject: [PATCH] feat: replace sum analysis with special trend line chart, zodiac/tail numbers use bar charts --- application/admin/controller/History.php | 8 +-- application/admin/model/History.php | 24 ++++---- public/assets/js/backend/dashboard.js | 77 ++++++++++++++++-------- 3 files changed, 70 insertions(+), 39 deletions(-) diff --git a/application/admin/controller/History.php b/application/admin/controller/History.php index dc1f0b0..5ff1533 100644 --- a/application/admin/controller/History.php +++ b/application/admin/controller/History.php @@ -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); } } diff --git a/application/admin/model/History.php b/application/admin/model/History.php index 6b2827a..305ec16 100644 --- a/application/admin/model/History.php +++ b/application/admin/model/History.php @@ -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) ]; } diff --git a/public/assets/js/backend/dashboard.js b/public/assets/js/backend/dashboard.js index 75d468e..b451ad2 100644 --- a/public/assets/js/backend/dashboard.js +++ b/public/assets/js/backend/dashboard.js @@ -39,7 +39,7 @@ define(['jquery'], function ($) { function render(data) { var hc = data.hotcold, cw = data.colorwave, zo = data.zodiac; - var oe = data.oddeven, bs = data.bigsmall, sm = data.sum, tn = data.tailnumbers; + var oe = data.oddeven, bs = data.bigsmall, sp = data.special, tn = data.tailnumbers; var html = ''; @@ -70,42 +70,71 @@ define(['jquery'], function ($) { html += ''; html += ''; - html += '