diff --git a/app/console/service/VehicleNewSkusService.php b/app/console/service/VehicleNewSkusService.php index 2ee9fcb..dddb61f 100644 --- a/app/console/service/VehicleNewSkusService.php +++ b/app/console/service/VehicleNewSkusService.php @@ -149,6 +149,11 @@ class VehicleNewSkusService extends BaseService foreach ($skuAttributes as $skuAttribute) { $skuAttribute['sku_id'] = $id; + $attribute_id = array_column($skuAttributes, 'attribute_id'); + if(count($attribute_id) !== count(array_unique($attribute_id))){ + Db::rollBack(); + throw new BusinessException('属性不能重复'); + } if(!empty($skuAttribute['id'])){ $skuAttributeId = $skuAttribute['id']; $skuAttributesId[] = $skuAttributeId;