From 6bcd71f0e4e546ff525c8e84c1c6667cc581acc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 7 May 2021 19:21:50 +0800 Subject: [PATCH] Update Goods.php --- app/data/controller/shop/Goods.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/data/controller/shop/Goods.php b/app/data/controller/shop/Goods.php index d46f92538..9b1c3d64f 100644 --- a/app/data/controller/shop/Goods.php +++ b/app/data/controller/shop/Goods.php @@ -172,8 +172,8 @@ class Goods extends Controller [$data['price_market'], $data['price_selling']] = [0, 0]; [$count, $items] = [0, array_column(json_decode($data['data_items'], true), 0)]; foreach ($items as $item) if ($item['status'] > 0) { - if ($data['price_market'] > $item['market']) $data['price_market'] = $item['market']; - if ($data['price_selling'] > $item['selling']) $data['price_selling'] = $item['selling']; + if ($data['price_market'] === 0 || $data['price_market'] > $item['market']) $data['price_market'] = $item['market']; + if ($data['price_selling'] === 0 || $data['price_selling'] > $item['selling']) $data['price_selling'] = $item['selling']; $count++; } if (empty($count)) $this->error('无效的的商品价格信息!');