From 0741a3f9a086e46d38c793da9a8448ceb0c5a24a Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sun, 17 Nov 2024 14:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=94=9F=E6=B4=BB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=BF=94=E8=A1=A5=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LocalStoreGoodsLogic.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/api/logic/LocalStoreGoodsLogic.php b/app/api/logic/LocalStoreGoodsLogic.php index 029ea508..10afee68 100644 --- a/app/api/logic/LocalStoreGoodsLogic.php +++ b/app/api/logic/LocalStoreGoodsLogic.php @@ -388,12 +388,14 @@ class LocalStoreGoodsLogic extends Logic ->field('id, profit, discount, subsidy') ->select(); - foreach ($subsidy as &$v) { - $v['profit'] = $model::formatStr($v['profit']); - $v['discount'] = $model::formatStr($v['discount']); - $v['subsidy'] = $model::formatStr($v['subsidy']); + if (!empty($subsidy)) { + foreach ($subsidy as &$v) { + $v['profit'] = $model::formatStr($v['profit']); + $v['discount'] = $model::formatStr($v['discount']); + $v['subsidy'] = $model::formatStr($v['subsidy']); + } + return $subsidy; } - - return $subsidy; + return []; } } \ No newline at end of file