热销榜单添加上商品返比文字

This commit is contained in:
wangxiaowei 2024-11-19 22:18:19 +08:00
parent e167a58789
commit a329fbbcb6

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