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; }