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) {