|
@@ -353,12 +353,13 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
// }
|
|
|
startIndex := 0
|
|
|
prevKey := ""
|
|
|
- index, notmatchCount, allMatchCount := 0, 0, 0
|
|
|
+ index, tmpindex, notmatchCount, allMatchCount := 0, 0, 0, 0
|
|
|
weightMap := map[string]map[string]interface{}{} //权重
|
|
|
mapIndexInKvs := map[string]map[string]interface{}{} //map在数组总的索引位置
|
|
|
kvsTemp := make([]*Kv, len(*kvs))
|
|
|
copy(kvsTemp, *kvs)
|
|
|
//again := 0
|
|
|
+ ishad := false
|
|
|
for kv_index, kv := range *kvs {
|
|
|
isBreak := true
|
|
|
v := strings.TrimSpace(kv.Value)
|
|
@@ -415,6 +416,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
}
|
|
|
} else if ascFind {
|
|
|
for _, ct_k := range HasOrderContactType(k) {
|
|
|
+ ishad = false
|
|
|
//again++
|
|
|
if k_length < 3 || k_length > 15 {
|
|
|
isBreak = false
|
|
@@ -482,6 +484,8 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
}
|
|
|
allMatchCount++
|
|
|
if IsMapHasValue(ct_k, indexMap) {
|
|
|
+ ishad = true
|
|
|
+ tmpindex = GetIndex(ct_k, indexMap)
|
|
|
isContinue = true
|
|
|
continue
|
|
|
}
|
|
@@ -543,11 +547,15 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
// } else if index < 2 {
|
|
|
// index++
|
|
|
// }
|
|
|
- if prevKey != k {
|
|
|
- prevKey = k
|
|
|
- index = 1
|
|
|
- } else if prevKey == k {
|
|
|
- index++
|
|
|
+ if ishad {
|
|
|
+ index = tmpindex
|
|
|
+ } else {
|
|
|
+ if prevKey != k {
|
|
|
+ prevKey = k
|
|
|
+ index = 1
|
|
|
+ } else if prevKey == k {
|
|
|
+ index++
|
|
|
+ }
|
|
|
}
|
|
|
// if startIndex == 0 || startIndex%2 == 1 || index == 0 {
|
|
|
// index = 1
|
|
@@ -908,3 +916,12 @@ func GetMoneyUnit(key, val string) string {
|
|
|
}
|
|
|
return ""
|
|
|
}
|
|
|
+
|
|
|
+func GetIndex(ct_k string, indexMap map[int]string) int {
|
|
|
+ for k, v := range indexMap {
|
|
|
+ if ct_k == v {
|
|
|
+ return k
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 1
|
|
|
+}
|