wangchuanjin %!s(int64=2) %!d(string=hai) anos
pai
achega
bbba3a4671
Modificáronse 2 ficheiros con 16 adicións e 0 borrados
  1. 1 0
      p/constant.go
  2. 15 0
      p/public.go

+ 1 - 0
p/constant.go

@@ -54,4 +54,5 @@ var (
 	KeyFilterReg     = regexp.MustCompile("^(项目|中标|公告)$")
 	KeyRetainReg     = regexp.MustCompile("[\\p{Han}a-zA-Z0-9]")
 	SaveBiddingField = []string{"_id", "area", "city", "buyerclass", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "buyer", "bidamount", "budget", "projectname", "projectcode", "s_winner", "agency", "bidopentime", "attachment_count"}
+	SpaceReg         = regexp.MustCompile("\\s+")
 )

+ 15 - 0
p/public.go

@@ -221,6 +221,21 @@ func GetKeySets(a_key interface{}) ([]*KeySet, error) {
 	if err == nil {
 		err = json.Unmarshal(_bs, &keySets)
 	}
+	for _, v := range keySets {
+		keys, appendKeys, notKeys := []string{}, []string{}, []string{}
+		for _, vv := range v.Keys {
+			keys = append(keys, SpaceReg.Split(strings.TrimSpace(vv), -1)...)
+		}
+		for _, vv := range v.AppendKeys {
+			appendKeys = append(appendKeys, SpaceReg.Split(strings.TrimSpace(vv), -1)...)
+		}
+		for _, vv := range v.NotKeys {
+			notKeys = append(notKeys, SpaceReg.Split(strings.TrimSpace(vv), -1)...)
+		}
+		v.Keys = keys
+		v.AppendKeys = appendKeys
+		v.NotKeys = notKeys
+	}
 	return keySets, err
 }