商品列表添加上商品返比文字

This commit is contained in:
wangxiaowei 2024-11-19 23:13:55 +08:00
parent afeed65736
commit fb5cfb4dd8

@ -4,6 +4,7 @@ namespace app\api\logic;
use app\common\basics\Logic;
use app\common\model\goods\Goods;
use app\common\model\goods\GoodsSubsidy;
use app\common\server\UrlServer;
use think\facade\Config;
use think\facade\Db;
@ -49,7 +50,10 @@ class MallNewsLogic extends Logic
if ($mall_type == 1) {
$mall_news = MallNewsShop::where(['id' => $id, 'delete_time' => 0])->find()->toArray();
if ($mall_news['shop_id'] > 0) {
$mall_news['shop'] = Goods::where(['id' => $mall_news['shop_id']])->field('name, image, min_price')->find()->toArray();
$mall_news['shop'] = Goods::where(['id' => $mall_news['shop_id']])->field('name, image, min_price, subsidy_id')->find()->toArray();
// 获取返补比例, subsidy_id为0的就传递一个ID为4的固定ID
$mall_news['subsidy'] = (new GoodsSubsidy())->getSubsidyById($mall_news['shop']['subsidy_id'] > 0 ? $mall_news['shop']['subsidy_id'] : 4);
$mall_news['subsidy_txt'] = '最高返' . $mall_news['subsidy']['subsidy'];
}
$file = MallNewsFile::where(['mall_news_shop_id' => $id])->field('mall_news_shop_id, src')->select()->toArray();
@ -65,6 +69,9 @@ class MallNewsLogic extends Logic
if ($mall_news['shop_id'] > 0) {
$mall_news['shop'] = Goods::where(['id' => $mall_news['shop_id']])->field('name, image, min_price')->find()->toArray();
// 获取返补比例, subsidy_id为0的就传递一个ID为4的固定ID
$mall_news['subsidy'] = (new GoodsSubsidy())->getSubsidyById($mall_news['shop']['subsidy_id'] > 0 ? $mall_news['shop']['subsidy_id'] : 4);
$mall_news['subsidy_txt'] = '最高返' . $mall_news['subsidy']['subsidy'];
}
if (isset($mall_news['files'])) {