|
@@ -852,7 +852,12 @@ class OrderService implements OrderServiceInterface
|
|
|
if (empty($shop)) {
|
|
|
return Result::error("不存在此条记录!(参数错误)");
|
|
|
}else{
|
|
|
- $result = ShoppingCart::where('shopping_id', $shop['shopping_id'])->where('user_id',$data['user_id'])->where('pid',$data['pid'])->delete();
|
|
|
+ $count = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id',$data['user_id'])->count();
|
|
|
+ if($count == 1){
|
|
|
+ $result = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id',$data['user_id'])->update(['pid' => null, 'website_id' => null]);;
|
|
|
+ }else{
|
|
|
+ $result = ShoppingCart::where('shopping_id', $shop['shopping_id'])->where('user_id',$data['user_id'])->where('pid',$data['pid'])->delete();
|
|
|
+ }
|
|
|
}
|
|
|
if(empty($result)){
|
|
|
return Result::error("删除失败");
|