|
@@ -10,6 +10,39 @@ import (
|
|
|
"unicode/utf8"
|
|
|
)
|
|
|
|
|
|
+// 处理地域代码
|
|
|
+func CalculateRegionCode(area string, city string, district string) (area_code string, city_code string, district_code string) {
|
|
|
+ area_code, city_code, district_code = "000000", "", ""
|
|
|
+ if district != "" {
|
|
|
+ key := area + "~" + city + "~" + district + "~"
|
|
|
+ code := RegionCodeData[key]
|
|
|
+ if code != "" {
|
|
|
+ district_code = code
|
|
|
+ city_code = code[:4] + "00"
|
|
|
+ area_code = code[:2] + "0000"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if city != "" {
|
|
|
+ key := area + "~" + city + "~" + "" + "~"
|
|
|
+ code := RegionCodeData[key]
|
|
|
+ if code != "" {
|
|
|
+ city_code = code
|
|
|
+ area_code = city_code[:2] + "0000"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if area != "" {
|
|
|
+ key := area + "~" + "" + "~" + "" + "~"
|
|
|
+ code := RegionCodeData[key]
|
|
|
+ if code != "" {
|
|
|
+ area_code = code
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// 单位分割~去重 中标单位
|
|
|
func SegmentationEntName(name_1 string, name_2 string) ([]string, []bool) {
|
|
|
new_arr := []string{}
|
|
@@ -132,7 +165,7 @@ func cleanErrDateTime(datetime string) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-// 转二进制 用不到......
|
|
|
+// 转二进制.....
|
|
|
func Str2DEC(s string) (num int) {
|
|
|
l := len(s)
|
|
|
for i := l - 1; i >= 0; i-- {
|