diff --git a/app/Service/v3/Implementations/UserAddressService.php b/app/Service/v3/Implementations/UserAddressService.php index cc2b283..4d761f8 100644 --- a/app/Service/v3/Implementations/UserAddressService.php +++ b/app/Service/v3/Implementations/UserAddressService.php @@ -39,6 +39,10 @@ class UserAddressService implements UserAddressServiceInterface 'tel' => $tel, 'tags' => $tags ]); + if(empty($userAddressId)){ + UserAddress::query()->where(['user_id'=> $user_id,'is_default'=> 1])->update(['is_default' => 0]); + UserAddress::query()->where('id',$userAddressId)->update(['is_default' => 1]); + } return $userAddress; }