From 0c256f54ee953b148d4ce3fd641ef28253ef849f Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 19 Nov 2024 22:58:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=95=86=E5=93=81=E8=BF=94=E6=AF=94=E6=96=87?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/IndexLogic.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/api/logic/IndexLogic.php b/app/api/logic/IndexLogic.php index 3c4358e6..6f3919f9 100755 --- a/app/api/logic/IndexLogic.php +++ b/app/api/logic/IndexLogic.php @@ -650,7 +650,7 @@ class IndexLogic extends Logic $where1[] = ['purchase_price|issuing_price|wholesale_price', '>', 0]; } } - $lists = Goods::field('id,name,image,min_price,market_price,wholesale_price,purchase_price,issuing_price,sales_actual,(sales_actual + sales_virtual) as sales_total') + $lists = Goods::field('id,name,image,min_price,market_price,wholesale_price,purchase_price,issuing_price,sales_actual,(sales_actual + sales_virtual) as sales_total, subsidy_id') ->where($where) ->where($where1) ->order($order) @@ -698,6 +698,13 @@ class IndexLogic extends Logic } } } + + foreach ($lists as $k => $v) { + // 获取返补比例, subsidy_id为0的就传递一个ID为4的固定ID + $lists[$k]['subsidy'] = (new GoodsSubsidy())->getSubsidyById($v['subsidy_id'] > 0 ? $v['subsidy_id'] : 4); + $lists[$k]['subsidy_txt'] = '最高返' . $lists[$k]['subsidy']['subsidy']; + } + $lists['set_price_type'] = $set_price_type; return $lists; } @@ -794,6 +801,13 @@ class IndexLogic extends Logic } } } + + foreach ($lists as $k => $v) { + // 获取返补比例, subsidy_id为0的就传递一个ID为4的固定ID + $lists[$k]['subsidy'] = (new GoodsSubsidy())->getSubsidyById($v['subsidy_id'] > 0 ? $v['subsidy_id'] : 4); + $lists[$k]['subsidy_txt'] = '最高返' . $lists[$k]['subsidy']['subsidy']; + } + return $lists; }