diff --git a/app/Service/ShopCarService.php b/app/Service/ShopCarService.php index a739846..dab1ef9 100644 --- a/app/Service/ShopCarService.php +++ b/app/Service/ShopCarService.php @@ -27,6 +27,20 @@ class ShopCarService implements ShopCarServiceInterface ]; return $error; } + //一个订单只能添加一个特价商品 + if($params['money'] == 0.01){ + $goods_exists = ShopCar::where([ + ['money','=',0.01], + ['user_id','=',$params['user_id']] + ]) + ->exists(); + if($goods_exists){ + $error = [ + 'error' => '一个订单只能添加一个特价商品' + ]; + return $error; + } + } //获取主表商品表信息 $goods = Goods::where([ ['id','=',$params['good_id']],