Browse Source

备份······

zhengkun 1 năm trước cách đây
mục cha
commit
988d9320ab
3 tập tin đã thay đổi với 36 bổ sung37 xóa
  1. 0 34
      ent_util/code.go
  2. 34 1
      ent_util/global.go
  3. 2 2
      ent_util/init.go

+ 0 - 34
ent_util/code.go

@@ -1,34 +0,0 @@
-package ent_util
-
-// 处理地域代码
-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
-}

+ 34 - 1
ent_util/global.go

@@ -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-- {

+ 2 - 2
ent_util/init.go

@@ -36,9 +36,9 @@ const (
 func InitGlobalVar() {
 	IsLocal = true
 	initMgo()
-	initMysql()
+	//initMysql()
 	//initVCode()
-	initClickHouse()
+	//initClickHouse()
 	//initEs()
 }