diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php index 13e4411..5e07991 100644 --- a/app/Model/v3/Goods.php +++ b/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'); + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php index 25bf28c..8105130 100644 --- a/app/Service/v3/Implementations/GoodsService.php +++ b/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; }