From 0f44031473cc6dd7751a6ffd0d78d0a3dcd58eb8 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Fri, 18 Sep 2020 21:39:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=B4=A7=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/UserAddressService.php | 4 ++++ 1 file changed, 4 insertions(+) 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; }