From a4b3ee325c7354579d495bc74a777e494e5ec38c Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 06 Feb 2026 18:18:44 +0800
Subject: [PATCH] 商品可以价格面议 选择走访时显示输入走访企业名 分会添加活动时要总会审核 分类添加人数限制,添加活动选择了填写人数限制的分类时活动名额下显示该分类人数限制为15 同一个企业30天内只能走访一次,在30天内走访同一个企业时提示该企业已被走访xx天后才可以从新走访

---
 admin/app/common/model/user/UserAddress.php |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/admin/app/common/model/user/UserAddress.php b/admin/app/common/model/user/UserAddress.php
index ef3a5ab..fb69ab1 100644
--- a/admin/app/common/model/user/UserAddress.php
+++ b/admin/app/common/model/user/UserAddress.php
@@ -27,4 +27,47 @@
                 : Region::getNameById($data['region_id']),
         ];
     }
+
+    /**
+     * 整理地图选择的地址 by lyzflash
+     */
+    public function setLocationAddress($address)
+    {
+        $region = $this->checkPCA($address);
+        $short_address = str_replace($region['province'] . $region['city'] . $region['area'], '', $address);
+        if (in_array($region['province'], array('北京市', '天津市', '天津市', '天津市'))) {
+            $region['area'] = $region['city'];
+            $region['city'] = $region['province'];
+        }
+        $province_id = Region::getIdByName($region['province'], 1);
+        $city_id = Region::getIdByName($region['city'], 2, $province_id);
+        $region_id = Region::getIdByName($region['area'], 3, $city_id);
+        return ['cityCode'=> [$province_id, $city_id, $region_id], 'region' => [$region['province'], $region['city'], $region['area']], 'short_address' => $short_address];
+    }
+
+    /**
+     * 截取省市区 by lyzflash
+     */
+    private function checkPCA($address)  {
+        preg_match('/(.*?(省|自治区|北京市|天津市|上海市|重庆市))/', $address, $matches);
+        if (count($matches) > 1) {
+            $province = $matches[count($matches) - 2];
+            $address = str_replace($province, '', $address);
+        }
+        preg_match('/(.*?(市|自治州|地区|区划|县))/', $address, $matches);
+        if (count($matches) > 1) {
+            $city = $matches[count($matches) - 2];
+            $address = str_replace($city, '', $address);
+        }
+        preg_match('/(.*?(市|区|县))/', $address, $matches);
+        if (count($matches) > 1) {
+            $area = $matches[count($matches) - 2];
+            $address = str_replace($area, '', $address);
+        }
+        return [
+            'province' => isset($province) ? $province : '',
+            'city' => isset($city) ? $city : '',
+            'area' => isset($area) ? $area : '',
+        ];
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.2