Ver código fonte

wip:字段异常处理

wangshan 1 ano atrás
pai
commit
1cc30ee46f
2 arquivos alterados com 44 adições e 37 exclusões
  1. 1 0
      jyBXCore/rpc/etc/db.yaml
  2. 43 37
      jyBXCore/rpc/util/search.go

+ 1 - 0
jyBXCore/rpc/etc/db.yaml

@@ -17,6 +17,7 @@ redis:
     addr:
         - other=192.168.3.149:1712
         - newother=192.168.3.149:1712
+        - poly=192.168.3.149:1712
 es:
     addr: http://192.168.3.241:9205,http://192.168.3.149:9200
     size: 50

+ 43 - 37
jyBXCore/rpc/util/search.go

@@ -267,54 +267,60 @@ func SearchListFormat(userid, subInformation, propertyForm, industry string, rep
 		if bidField == "BIProperty" {
 			searchList.FileExists = false
 			//物业数据处理
-			searchList.Bi.TagTopInformation = gconv.SliceStr(v["tag_topinformation"])
-			subinformationArr := gconv.SliceStr(v["tag_subinformation"])
-			if len(subinformationArr) > 0 {
-				if len(subInformation) > 0 {
-					fool := false
-					for _, s1 := range subinformationArr {
-						for _, s2 := range strings.Split(subInformation, ",") {
-							if s2 == s1 {
-								searchList.Bi.TagSubInformation = strings.Split(s1, "_")[1]
-								fool = true
+			if v["tag_topinformation"] != nil {
+				searchList.Bi.TagTopInformation = gconv.SliceStr(v["tag_topinformation"])
+			}
+			if v["tag_subinformation"] != nil {
+				subinformationArr := gconv.SliceStr(v["tag_subinformation"])
+				if len(subinformationArr) > 0 {
+					if len(subInformation) > 0 {
+						fool := false
+						for _, s1 := range subinformationArr {
+							for _, s2 := range strings.Split(subInformation, ",") {
+								if s2 == s1 {
+									searchList.Bi.TagSubInformation = strings.Split(s1, "_")[1]
+									fool = true
+									break
+								}
+							}
+							if fool {
 								break
 							}
 						}
-						if fool {
-							break
-						}
+					} else {
+						searchList.Bi.TagSubInformation = strings.Split(subinformationArr[0], "_")[1]
 					}
-				} else {
-					searchList.Bi.TagSubInformation = strings.Split(subinformationArr[0], "_")[1]
 				}
 			}
 			//是否有附件
-			tag := gconv.Map(v["tag_set"])
-			if tag != nil {
-				wuye := gconv.Map(tag["wuye"])
-				if tag != nil {
-					isFile := gconv.Int64(wuye["isfile"])
-					propertyFormStr := gconv.String(wuye["property_form"])
-					if isFile == 63 {
-						searchList.FileExists = true
-					}
-					if propertyFormStr != "" {
-						if propertyForm != "" {
-							fool := false
-							for _, s1 := range strings.Split(propertyFormStr, ",") {
-								for _, s2 := range strings.Split(propertyForm, ",") {
-									if s2 == s1 {
-										searchList.Bi.PropertyForm = s2
-										fool = true
+			if v["tag_set"] != nil {
+				tag := gconv.Map(v["tag_set"])
+				if tag != nil && tag["wuye"] != nil {
+					wuye := gconv.Map(tag["wuye"])
+					if wuye != nil {
+						isFile := gconv.Int64(wuye["isfile"])
+						propertyFormStr := gconv.String(wuye["property_form"])
+						if isFile == 63 {
+							searchList.FileExists = true
+						}
+						if propertyFormStr != "" {
+							if propertyForm != "" {
+								fool := false
+								for _, s1 := range strings.Split(propertyFormStr, ",") {
+									for _, s2 := range strings.Split(propertyForm, ",") {
+										if s2 == s1 {
+											searchList.Bi.PropertyForm = s2
+											fool = true
+											break
+										}
+									}
+									if fool {
 										break
 									}
 								}
-								if fool {
-									break
-								}
+							} else {
+								searchList.Bi.PropertyForm = strings.Split(propertyFormStr, ",")[0]
 							}
-						} else {
-							searchList.Bi.PropertyForm = strings.Split(propertyFormStr, ",")[0]
 						}
 					}
 				}