From ff60ad76ec0655c2a2e8a72d374ac060131bc420 Mon Sep 17 00:00:00 2001 From: "zhangf@suq.cn" Date: Thu, 10 Sep 2026 09:27:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(stock):=20=E4=BF=AE=E5=A4=8D=E8=82=A1?= =?UTF-8?q?=E7=A5=A8=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=92=8C=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复价格为0时显示前收盘价而不是破折号 - 修复涨跌额和涨跌幅为0时显示0.00而不是破折号 - 移除股票价格颜色的CSS变量设置 - 设置默认颜色值为#2e353a确保正确显示 --- app/common.php | 6 +++--- app/controller/frontend/StockController.php | 2 +- public/themes/dist_static/static/css/investment.css | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common.php b/app/common.php index 7bd1a86..7470603 100644 --- a/app/common.php +++ b/app/common.php @@ -1855,9 +1855,9 @@ if (!function_exists('fetchStockFromSina')) { return [ 'code' => $stockCode, 'name' => $name, - 'price' => $price > 0 ? number_format($price, 2) : '--', - 'change' => $price > 0 ? (($change >= 0 ? '+' : '') . number_format($change, 2)) : '--', - 'changePercent' => $price > 0 ? (($changePercent >= 0 ? '+' : '') . number_format($changePercent, 2) . '%') : '--', + 'price' => $price > 0 ? number_format($price, 2) : number_format($prevClose, 2), + 'change' => $price > 0 ? (($change > 0 ? '+' : '') . number_format($change, 2)) : '0.00', + 'changePercent' => $price > 0 ? (($changePercent > 0 ? '+' : '') . number_format($changePercent, 2) . '%') : '0.00%', 'high' => floatval($fields[4]) > 0 ? number_format(floatval($fields[4]), 2) : '--', 'low' => floatval($fields[5]) > 0 ? number_format(floatval($fields[5]), 2) : '--', 'volume' => floatval($fields[8]) > 0 ? round(floatval($fields[8]) / 1000000, 2) : '--', diff --git a/app/controller/frontend/StockController.php b/app/controller/frontend/StockController.php index 83a226c..2513f67 100644 --- a/app/controller/frontend/StockController.php +++ b/app/controller/frontend/StockController.php @@ -23,7 +23,7 @@ class StockController extends BaseController } } $change = (string)($stock['change'] ?? '--'); - $color = ''; + $color = '#2e353a'; if ($change !== '--' && $change !== '') { if ($change[0] === '+') { $color = '#ef4335'; diff --git a/public/themes/dist_static/static/css/investment.css b/public/themes/dist_static/static/css/investment.css index 0be6105..8351179 100644 --- a/public/themes/dist_static/static/css/investment.css +++ b/public/themes/dist_static/static/css/investment.css @@ -212,7 +212,7 @@ display: flex; align-items: baseline; margin-bottom: 5rem; - color: var(--color-primary); + /*color: var(--color-primary);*/ } .iv-stock__price { font-family: "D-DIN-PRO", "MiSans VF", sans-serif;