作者 何书鹏

购物车列表联查优化

@@ -15,11 +15,11 @@ class Cart extends Model @@ -15,11 +15,11 @@ class Cart extends Model
15 15
16 public function goods() 16 public function goods()
17 { 17 {
18 - return $this->belongsTo('Goods','goods_id','goods_id'); 18 + return $this->belongsTo('Goods', 'goods_id', 'goods_id', [], 'INNER')->setEagerlyType(0);
19 } 19 }
20 20
21 public function sku() 21 public function sku()
22 { 22 {
23 - return $this->belongsTo('GoodsSpec','sku_id','goods_spec_id'); 23 + return $this->belongsTo('GoodsSpec', 'sku_id', 'goods_spec_id', [], 'INNER')->setEagerlyType(0);
24 } 24 }
25 } 25 }