From a329fbbcb6d2dba2bc8265a7bb638d16242fc877 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 19 Nov 2024 22:18:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=AD=E9=94=80=E6=A6=9C=E5=8D=95=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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/api/logic/IndexLogic.php b/app/api/logic/IndexLogic.php index 118fc4d9..d1c3fc37 100755 --- a/app/api/logic/IndexLogic.php +++ b/app/api/logic/IndexLogic.php @@ -10,6 +10,7 @@ use app\common\model\content\Article; use app\common\model\DevRegion; use app\common\model\goods\Goods; use app\common\enum\GoodsEnum; +use app\common\model\goods\GoodsSubsidy; use app\common\model\procurement\Procurementset; use app\common\model\shop\Shop; use app\common\model\goods\GoodsCategory; @@ -1037,12 +1038,18 @@ class IndexLogic extends Logic ->join('goods g', 'hl.goods_id = g.id') ->where($onSaleWhere) ->where('delete_time', 0) - ->field('hl.*, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price') + ->field('hl.*, g.id as gid, g.name, g.image, g.issuing_price, g.market_price, g.min_price, g.purchase_price, g.wholesale_price, g.subsidy_id') ->order('sort desc') ->limit(6) ->select() ->toArray(); + foreach ($hot_list as &$v) { + // 获取返补比例, subsidy_id为0的就传递一个ID为4的固定ID + $hot_list['subsidy'] = (new GoodsSubsidy())->getSubsidyById($hot_list['subsidy_id'] > 0 ? $hot_list['subsidy_id'] : 4); + $hot_list['subsidy_txt'] = '最高返' . $hot_list['subsidy']['subsidy']; + } + $count = count($hot_list); if ($count < 6) {