Browse Source

订单商品表spec处理

master
weigang 5 years ago
parent
commit
23d70b425d
  1. 15
      app/Model/v3/Goods.php
  2. 14
      app/Model/v3/GoodsActivity.php
  3. 10
      app/Model/v3/OrderGoods.php
  4. 2
      app/Service/v3/Implementations/OrderOnlineService.php

15
app/Model/v3/Goods.php

@ -133,19 +133,4 @@ class Goods extends Model
return $this->morphMany(ShoppingCart::class, 'goods');
}
public function setSpecAttribute($value)
{
$this->attributes['spec'] = json_encode($value);
}
public function setTagsAttribute($value)
{
$this->attributes['tags'] = json_encode($value);
}
public function setDetailsImgsAttribute($value)
{
$this->attributes['details_imgs'] = json_encode($value);
}
}

14
app/Model/v3/GoodsActivity.php

@ -100,18 +100,4 @@ class GoodsActivity extends Model
return $this->morphMany(ShoppingCart::class, 'goods');
}
public function setSpecAttribute($value)
{
$this->attributes['spec'] = json_encode($value);
}
public function setTagsAttribute($value)
{
$this->attributes['tags'] = json_encode($value);
}
public function setDetailsImgsAttribute($value)
{
$this->attributes['details_imgs'] = json_encode($value);
}
}

10
app/Model/v3/OrderGoods.php

@ -52,14 +52,4 @@ class OrderGoods extends Model
{
return Goods::query()->where(['id' => $this->attributes['goods_id']])->value('tags');
}
public function setSpecAttribute($value)
{
$this->attributes['spec'] = json_encode($value);
}
public function setTagsAttribute($value)
{
$this->attributes['tags'] = json_encode($value);
}
}

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

@ -207,7 +207,7 @@ class OrderOnlineService implements OrderOnlineServiceInterface
'name' => $goods->name,
'goods_unit' => $goods->goods_unit,
'cover_img' => $goods->cover_img,
'spec' => $goods->spec,
'spec' => json_encode($goods->spec),
];
}

Loading…
Cancel
Save