From ea03b1fc43bc1c2e13d2e6cb7be283bb4037c5b0 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 10 Nov 2021 09:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=88=A4=E6=96=AD=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E9=87=8D=E5=A4=8D=E6=B7=BB=E5=8A=A0=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/services/user/UserAddressServices.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crmeb/app/services/user/UserAddressServices.php b/crmeb/app/services/user/UserAddressServices.php index 4fac79358..c34303ba9 100644 --- a/crmeb/app/services/user/UserAddressServices.php +++ b/crmeb/app/services/user/UserAddressServices.php @@ -164,6 +164,21 @@ class UserAddressServices extends BaseServices */ public function editAddress(int $uid, array $addressInfo) { + if ($addressInfo['id'] == 0) { + if (isset($addressInfo['address']['city_id'])) { + $where['city_id'] = $addressInfo['address']['city_id']; + } else { + $where = []; + } + $res = $this->dao->getCount([ + ['uid', '=', $uid], + ['real_name', '=', $addressInfo['real_name']], + ['phone', '=', $addressInfo['phone']], + ['detail', '=', $addressInfo['detail']] + ] + $where); + if ($res) throw new ValidateException('地址已存在,请勿重复添加'); + } + if ($addressInfo['type'] == 1 && !$addressInfo['id']) { $city = $addressInfo['address']['city']; /** @var SystemCityServices $systemCity */