Browse Source

商品详情 返回banner信息

master
Lemon 5 years ago
parent
commit
a901444fd9
  1. 5
      app/Model/v3/Goods.php
  2. 2
      app/Service/v3/Implementations/GoodsService.php

5
app/Model/v3/Goods.php

@ -173,4 +173,9 @@ class Goods extends Model
{
$this->attributes['spec'] = json_encode(json_decode($value, true));
}
public function banner()
{
return $this->hasMany(GoodsBanner::class, 'goods_id','id');
}
}

2
app/Service/v3/Implementations/GoodsService.php

@ -187,7 +187,7 @@ class GoodsService implements GoodsServiceInterface
public function info($goodsId)
{
$res = Goods::query()->withoutGlobalScope('normal')->where('id',$goodsId)->first();
$res = Goods::query()->withoutGlobalScope('normal')->where('id',$goodsId)->with('banner')->first();
return $res;
}

Loading…
Cancel
Save