Kirin 3 years ago
parent
commit
1609550265
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/api/controller/user/UserController.php

+ 2 - 1
app/api/controller/user/UserController.php

@@ -254,7 +254,7 @@ class UserController
         if (!isset($addressInfo['address']['district'])) return app('json')->fail('收货地址格式错误!');
         if (!isset($addressInfo['address']['city_id']) && $addressInfo['type'] == 0) {
             return app('json')->fail('收货地址格式错误!请重新选择!');
-        } else if ($addressInfo['type'] == 1 && !$addressInfo['id']) {
+        } else if ($addressInfo['type'] == 1) {
             $city = $addressInfo['address']['city'];
             $cityId = SystemCity::where('name', $city)->where('parent_id', '<>', 0)->value('city_id');
             if ($cityId) {
@@ -263,6 +263,7 @@ class UserController
                 if (!($cityId = SystemCity::where('parent_id', '<>', 0)->where('name', 'like', "%$city%")->value('city_id'))) {
                     return app('json')->fail('收货地址格式错误!修改后请重新导入!');
                 }
+                $addressInfo['address']['city_id'] = $cityId;
             }
         }