From 4ad245c913ad4ef4fc12a2572a20f59d8aecc448 Mon Sep 17 00:00:00 2001 From: wikiboss Date: Thu, 15 Oct 2026 12:16:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9AIndex=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E6=94=AF=E6=8C=81=E9=A1=B6=E5=B1=82=E5=AE=B9?= =?UTF-8?q?=E9=87=8F=E5=82=A8=E9=87=8F=E6=99=BA=E8=83=BD=E5=8F=8D=E5=A1=AB?= =?UTF-8?q?=E5=8F=8A=E7=83=AD=E7=82=B9=E5=9D=90=E6=A0=87=E5=8F=8C=E6=A8=A1?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Index.php | 43 ++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 808de3a..329d881 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -53,6 +53,15 @@ class Index extends Api $v['harvest_year'] = is_numeric($v['harvest_year']) ? date('Y-m-d', $v['harvest_year']) : $v['harvest_year']; $v['enter_time'] = is_numeric($v['enter_time']) ? date('Y-m-d', $v['enter_time']) : $v['enter_time']; $v['create_time'] = is_numeric($v['create_time']) ? date('Y-m-d', $v['create_time']) : $v['create_time']; + + // 顶层 capacity 与 storage_num 智能反填 + $content = is_string($v['content']) ? json_decode($v['content'], true) : $v['content']; + if (empty($v['capacity']) && !empty($content)) { + $v['capacity'] = isset($content['capacity']) ? $content['capacity'] : (isset($content['tankCapacity']) ? $content['tankCapacity'] : null); + } + if ((empty($v['storage_num']) || $v['storage_num'] == '0') && !empty($content['storageNum'])) { + $v['storage_num'] = $content['storageNum']; + } } } elseif ($site === 'xishui') { $list = $this->getXishuiDefaultList(); @@ -330,20 +339,20 @@ class Index extends Api { if ($site === 'xishui') { return [ - 'xishui_1' => ['top' => 45.2, 'left' => 19.8], - 'xishui_2' => ['top' => 48.0, 'left' => 26.5], - 'xishui_3' => ['top' => 51.5, 'left' => 33.2], - 'xishui_4' => ['top' => 54.8, 'left' => 40.0], - 'xishui_5' => ['top' => 43.5, 'left' => 47.8], - 'xishui_6' => ['top' => 46.5, 'left' => 54.5], - 'xishui_7' => ['top' => 49.5, 'left' => 61.2], - 'xishui_8' => ['top' => 52.8, 'left' => 68.0], - 'xishui_9' => ['top' => 34.0, 'left' => 36.5], - 'xishui_10' => ['top' => 33.0, 'left' => 50.0], - 'xishui_11' => ['top' => 32.0, 'left' => 63.5], + 'xishui_1' => ['top' => 45.2, 'left' => 19.8, 'x' => 19.8, 'y' => 45.2], + 'xishui_2' => ['top' => 48.0, 'left' => 26.5, 'x' => 26.5, 'y' => 48.0], + 'xishui_3' => ['top' => 51.5, 'left' => 33.2, 'x' => 33.2, 'y' => 51.5], + 'xishui_4' => ['top' => 54.8, 'left' => 40.0, 'x' => 40.0, 'y' => 54.8], + 'xishui_5' => ['top' => 43.5, 'left' => 47.8, 'x' => 47.8, 'y' => 43.5], + 'xishui_6' => ['top' => 46.5, 'left' => 54.5, 'x' => 54.5, 'y' => 46.5], + 'xishui_7' => ['top' => 49.5, 'left' => 61.2, 'x' => 61.2, 'y' => 49.5], + 'xishui_8' => ['top' => 52.8, 'left' => 68.0, 'x' => 68.0, 'y' => 52.8], + 'xishui_9' => ['top' => 34.0, 'left' => 36.5, 'x' => 36.5, 'y' => 34.0], + 'xishui_10' => ['top' => 33.0, 'left' => 50.0, 'x' => 50.0, 'y' => 33.0], + 'xishui_11' => ['top' => 32.0, 'left' => 63.5, 'x' => 63.5, 'y' => 32.0], ]; } - return [ + $rawCenter = [ 30 => ['top' => 60.5, 'left' => 12.5], 31 => ['top' => 58.2, 'left' => 18.0], 32 => ['top' => 56.0, 'left' => 23.5], @@ -366,6 +375,16 @@ class Index extends Api 17 => ['top' => 65.0, 'left' => 63.0], 18 => ['top' => 63.0, 'left' => 70.0], ]; + $result = []; + foreach ($rawCenter as $k => $c) { + $result[$k] = [ + 'top' => $c['top'], + 'left' => $c['left'], + 'x' => $c['left'], + 'y' => $c['top'] + ]; + } + return $result; } /**