|
@@ -41,6 +41,15 @@ class ShopGoodsLogic extends BaseLogic
|
|
|
{
|
|
{
|
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
|
try {
|
|
try {
|
|
|
|
|
+ if(isset($params['custom_attribute_items']) && !empty($params['custom_attribute_items'])){
|
|
|
|
|
+ foreach($params['custom_attribute_items'] as &$item){
|
|
|
|
|
+ if(intval($item['img_type']) === 0){
|
|
|
|
|
+ foreach($item['spec_items'] as $k => $v){
|
|
|
|
|
+ unset($item['spec_items'][$k]['spec_img']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$params['goods_category_id'] = end($params['goods_category_ids']);
|
|
$params['goods_category_id'] = end($params['goods_category_ids']);
|
|
|
$model = ShopGoods::create([
|
|
$model = ShopGoods::create([
|
|
|
'delivery_type' => $params['delivery_type'],
|
|
'delivery_type' => $params['delivery_type'],
|
|
@@ -94,7 +103,15 @@ class ShopGoodsLogic extends BaseLogic
|
|
|
{
|
|
{
|
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
|
try {
|
|
try {
|
|
|
- // dd($params);
|
|
|
|
|
|
|
+ if(isset($params['custom_attribute_items']) && !empty($params['custom_attribute_items'])){
|
|
|
|
|
+ foreach($params['custom_attribute_items'] as &$item){
|
|
|
|
|
+ if(intval($item['img_type']) === 0){
|
|
|
|
|
+ foreach($item['spec_items'] as $k => $v){
|
|
|
|
|
+ unset($item['spec_items'][$k]['spec_img']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
ShopGoods::where('id', $params['id'])->update([
|
|
ShopGoods::where('id', $params['id'])->update([
|
|
|
'delivery_type' => $params['delivery_type'],
|
|
'delivery_type' => $params['delivery_type'],
|
|
|
'shop_goods_type' => $params['shop_goods_type'],
|
|
'shop_goods_type' => $params['shop_goods_type'],
|
|
@@ -154,6 +171,7 @@ class ShopGoodsLogic extends BaseLogic
|
|
|
*/
|
|
*/
|
|
|
public static function delete(array $params): bool
|
|
public static function delete(array $params): bool
|
|
|
{
|
|
{
|
|
|
|
|
+ ShopGoodSpecsInventory::where('shop_goods_id',$params['id'])->delete();
|
|
|
return ShopGoods::destroy($params['id']);
|
|
return ShopGoods::destroy($params['id']);
|
|
|
}
|
|
}
|
|
|
|
|
|