|
@@ -3,6 +3,7 @@ package history
|
|
import (
|
|
import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "regexp"
|
|
|
|
|
|
"log"
|
|
"log"
|
|
mongoutil "qfw/mongodb"
|
|
mongoutil "qfw/mongodb"
|
|
@@ -380,25 +381,41 @@ func (this *HistoryData) DataTest(id string) {
|
|
customer, _ := Mgo.Find("cuserdepartrule", map[string]interface{}{"_id": mongoutil.StringTOBsonId(id)}, nil, nil, false, -1, -1)
|
|
customer, _ := Mgo.Find("cuserdepartrule", map[string]interface{}{"_id": mongoutil.StringTOBsonId(id)}, nil, nil, false, -1, -1)
|
|
if len(*customer) == 1 {
|
|
if len(*customer) == 1 {
|
|
c := (*customer)[0]
|
|
c := (*customer)[0]
|
|
- //tmps := Es.GetByIdField(Index, Itype, dataId, "")
|
|
|
|
- //
|
|
|
|
- //tmp := map[string]interface{}{}
|
|
|
|
- //if tmps != nil {
|
|
|
|
- // tmp = *tmps
|
|
|
|
- //}
|
|
|
|
- //if len(tmp) == 0 {
|
|
|
|
- // this.ServeJson(map[string]interface{}{
|
|
|
|
- // "result": false,
|
|
|
|
- // "info": "没有查到此数据",
|
|
|
|
- // })
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
|
|
+
|
|
s_globaladdkey := qu.ObjToString(c["s_globaladdkey"])
|
|
s_globaladdkey := qu.ObjToString(c["s_globaladdkey"])
|
|
s_globaladdkeymatch := qu.ObjToString(c["s_globaladdkeymatch"])
|
|
s_globaladdkeymatch := qu.ObjToString(c["s_globaladdkeymatch"])
|
|
s_globalnotkey := qu.ObjToString(c["s_globalnotkey"])
|
|
s_globalnotkey := qu.ObjToString(c["s_globalnotkey"])
|
|
s_globalnotkeymatch := qu.ObjToString(c["s_globalnotkeymatch"])
|
|
s_globalnotkeymatch := qu.ObjToString(c["s_globalnotkeymatch"])
|
|
- // s_globalclearkey := qu.ObjToString(c["s_globalclearkey"])
|
|
|
|
- // s_globalclearkeymatch := qu.ObjToString(c["s_globalclearkeymatch"])
|
|
|
|
|
|
+ s_globalclearkey := qu.ObjToString(c["s_globalclearkey"])
|
|
|
|
+ s_globalclearkeymatch := qu.ObjToString(c["s_globalclearkeymatch"])
|
|
|
|
+
|
|
|
|
+ //清理词匹配方式
|
|
|
|
+ cwmArr := []string{}
|
|
|
|
+ for _, mv := range strings.Split(s_globalclearkeymatch, ",") {
|
|
|
|
+ if field := qu.ObjToString(MatchType[mv]); field != "" {
|
|
|
|
+ cwmArr = append(cwmArr, field)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //清理词正则
|
|
|
|
+ cwkArr := []*regexp.Regexp{}
|
|
|
|
+ for _, kv := range strings.Split(s_globalclearkey, ",") {
|
|
|
|
+ if LetterCase.MatchString(kv) { //字母转大写
|
|
|
|
+ kv = strings.ToUpper(kv)
|
|
|
|
+ }
|
|
|
|
+ reg := regexp.MustCompile(kv)
|
|
|
|
+ cwkArr = append(cwkArr, reg)
|
|
|
|
+ }
|
|
|
|
+ //清理清理词
|
|
|
|
+ for _, cwm := range cwmArr {
|
|
|
|
+ if text := qu.ObjToString(article[cwm]); text != "" {
|
|
|
|
+ for _, gcw_reg := range cwkArr{
|
|
|
|
+ text = gcw_reg.ReplaceAllString(text, "")
|
|
|
|
+ }
|
|
|
|
+ article[cwm] = text
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
o_rule, ok := c["o_rules"].([]interface{})
|
|
o_rule, ok := c["o_rules"].([]interface{})
|
|
if !ok {
|
|
if !ok {
|
|
o_rule = []interface{}{}
|
|
o_rule = []interface{}{}
|
|
@@ -465,16 +482,6 @@ func (this *HistoryData) DataTest(id string) {
|
|
tempData["data"] = nKey
|
|
tempData["data"] = nKey
|
|
resultList = append(resultList,tempData)
|
|
resultList = append(resultList,tempData)
|
|
continue
|
|
continue
|
|
- //this.ServeJson(map[string]interface{}{
|
|
|
|
- // "status":true,
|
|
|
|
- // "data":map[string]interface{}{
|
|
|
|
- // "result": false,
|
|
|
|
- // "data": nKey,
|
|
|
|
- // "info":"被排除词排除",
|
|
|
|
- // },
|
|
|
|
- // "message":"测试成功",
|
|
|
|
- //})
|
|
|
|
- //return
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if key != "" {
|
|
if key != "" {
|