|
@@ -67,7 +67,7 @@ func GetCustomerData() {
|
|
|
}
|
|
|
|
|
|
cus.GetTagRules() //获取客户打标签规则
|
|
|
- cus.GetDepartments() //获取客户信息
|
|
|
+ cus.GetDepartments("") //获取客户信息
|
|
|
//PrintLog(cus) //打印查看初始化的信息
|
|
|
qu.Debug("customer:", cus.ID, cus.Name, cus.PushModel, cus.AppId, cus.IsTagRule, cus.IsSearchHosp, cus.IsSearchEnps, len(cus.TagRules), len(cus.Departments))
|
|
|
cus.GetData() //获取数据
|
|
@@ -108,7 +108,7 @@ func (c *Customer) GetTagRules() {
|
|
|
}
|
|
|
|
|
|
//获取部门信息
|
|
|
-func (c *Customer) GetDepartments() {
|
|
|
+func (c *Customer) GetDepartments(stype string) {
|
|
|
log.Println("开始获取部门信息...")
|
|
|
defer qu.Catch()
|
|
|
departments, _ := MgoTag.Find("euserdepart", map[string]interface{}{"s_userid": c.ID, "i_isuse": 1, "b_delete": false}, nil, nil)
|
|
@@ -123,7 +123,7 @@ func (c *Customer) GetDepartments() {
|
|
|
DM.ID = id
|
|
|
DM.Name = name
|
|
|
DM.CustomerID = c.ID
|
|
|
- DM.GetSearchRules(c.ID, c.IdRange) //获取某个部门的所有规则
|
|
|
+ DM.GetSearchRules(c.ID, stype, c.IdRange) //获取某个部门的所有规则
|
|
|
c.Departments = append(c.Departments, DM)
|
|
|
//qu.Debug("Departments---", DM.ID, DM.Name, DM.CustomerID, len(DM.Rules))
|
|
|
}
|
|
@@ -146,9 +146,7 @@ func (c *Customer) GetData() {
|
|
|
ch := make(chan bool, 10)
|
|
|
wg := &sync.WaitGroup{}
|
|
|
escount := Es.Count(Index, Itype, sr.EsQuery)
|
|
|
- qu.Debug("---------", sr.EsQuery)
|
|
|
- return
|
|
|
- log.Println("查询总数:", escount, "规则ID:", sr.ID)
|
|
|
+ log.Println("查询总数:", escount, "规则ID:", sr.ID, "EsQuery:", sr.EsQuery)
|
|
|
if escount == 0 {
|
|
|
continue
|
|
|
}
|
|
@@ -428,7 +426,7 @@ func (c *Customer) AssembelAndSaveData() {
|
|
|
}
|
|
|
|
|
|
//获取用户所有规则
|
|
|
-func (d *Department) GetSearchRules(cid string, idRange bson.M) {
|
|
|
+func (d *Department) GetSearchRules(cid, stype string, idRange bson.M) {
|
|
|
|
|
|
defer qu.Catch()
|
|
|
searchRules, _ := MgoTag.Find("euserdepartrule", map[string]interface{}{"s_userid": cid, "s_departid": d.ID, "b_delete": false}, nil, nil)
|
|
@@ -449,7 +447,11 @@ func (d *Department) GetSearchRules(cid string, idRange bson.M) {
|
|
|
clearKeyMatch := qu.ObjToString(sr["s_globalclearkeymatch"])
|
|
|
|
|
|
//获取es
|
|
|
- SR.GetEs(d.Name, esquery, idRange)
|
|
|
+ if stype == "history" {
|
|
|
+ SR.EsQuery = esquery
|
|
|
+ }else {
|
|
|
+ SR.GetEs(d.Name, esquery, idRange)
|
|
|
+ }
|
|
|
//获取关键词和附加词
|
|
|
if o_rules, ok := sr["o_rules"].(primitive.A); ok && len(o_rules) > 0 {
|
|
|
SR.GetKeyAddWord(o_rules)
|