|
@@ -789,8 +789,12 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
da := dataa[0]
|
|
da := dataa[0]
|
|
if len(util.ObjToString(da)) > 0 {
|
|
if len(util.ObjToString(da)) > 0 {
|
|
cs := strings.Split(util.ObjToString(da), "-")
|
|
cs := strings.Split(util.ObjToString(da), "-")
|
|
- SMap.Map["toptype"] = cs[0]
|
|
|
|
- SMap.Map["subtype"] = cs[1]
|
|
|
|
|
|
+ if cs[0] != "" {
|
|
|
|
+ SMap.Map["toptype"] = cs[0]
|
|
|
|
+ }
|
|
|
|
+ if cs[1] != "" {
|
|
|
|
+ SMap.Map["subtype"] = cs[1]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -803,7 +807,11 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
resa := ReSub(tt, tmp, "结果")
|
|
resa := ReSub(tt, tmp, "结果")
|
|
subtype := resa.Map["subtype"]
|
|
subtype := resa.Map["subtype"]
|
|
delete(SMap.Map, "subtype")
|
|
delete(SMap.Map, "subtype")
|
|
- SMap.Map["subtype"] = subtype
|
|
|
|
|
|
+ if util.ObjToString(subtype) != "" {
|
|
|
|
+ SMap.Map["subtype"] = subtype
|
|
|
|
+ } else {
|
|
|
|
+ SMap.Map["subtype"] = "其它"
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -821,7 +829,7 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
}
|
|
}
|
|
//一级分类成功,但是二级没有分类成功,并且原值里有subtype
|
|
//一级分类成功,但是二级没有分类成功,并且原值里有subtype
|
|
if _, ok := SMap.Map["toptype"]; ok {
|
|
if _, ok := SMap.Map["toptype"]; ok {
|
|
- if _, ok2 := SMap.Map["subtype"]; !ok2 {
|
|
|
|
|
|
+ if subtype, ok2 := SMap.Map["subtype"]; !ok2 || util.ObjToString(subtype) == "" {
|
|
//没有二级分类,直接设置为 其它
|
|
//没有二级分类,直接设置为 其它
|
|
SMap.Map["subtype"] = "其它"
|
|
SMap.Map["subtype"] = "其它"
|
|
}
|
|
}
|
|
@@ -1219,8 +1227,12 @@ func UdpTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}, stype s
|
|
}
|
|
}
|
|
}
|
|
}
|
|
newTops, newSubs := u.ProcessTopscopeclass(resultTobs, resultSubs)
|
|
newTops, newSubs := u.ProcessTopscopeclass(resultTobs, resultSubs)
|
|
- SMap.Map["topscopeclass"] = newTops
|
|
|
|
- SMap.Map["subscopeclass"] = newSubs
|
|
|
|
|
|
+ if len(newTops) > 0 {
|
|
|
|
+ SMap.Map["topscopeclass"] = newTops
|
|
|
|
+ }
|
|
|
|
+ if len(newSubs) > 0 {
|
|
|
|
+ SMap.Map["subscopeclass"] = newSubs
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
SMap.Map["topscopeclass"] = []string{"其它"}
|
|
SMap.Map["topscopeclass"] = []string{"其它"}
|
|
SMap.Map["subscopeclass"] = []string{"其它"}
|
|
SMap.Map["subscopeclass"] = []string{"其它"}
|
|
@@ -1407,20 +1419,39 @@ func FindId_back(coll string) (gtid, lteid string) {
|
|
}
|
|
}
|
|
|
|
|
|
func FindId(coll string) (gtid, lteid string) {
|
|
func FindId(coll string) (gtid, lteid string) {
|
|
- data, _ := tools.MgoClass.Find(coll, map[string]interface{}{"dataprocess": 0}, `{"_id":1}`, nil, false, -1, -1)
|
|
|
|
- for _, d := range *data {
|
|
|
|
- gtid = d["gtid"].(string)
|
|
|
|
- lteid = d["lteid"].(string)
|
|
|
|
- set := map[string]interface{}{
|
|
|
|
- "$set": map[string]interface{}{
|
|
|
|
- "dataprocess": 2,
|
|
|
|
- "updatetime": time.Now().Unix(),
|
|
|
|
- },
|
|
|
|
|
|
+ // 使用老表更新dataprocess 时
|
|
|
|
+ if util.ObjToString(tools.Config["dbname_old"]) != "" {
|
|
|
|
+ data, _ := tools.MgoClassOld.Find(coll, map[string]interface{}{"dataprocess_ai": 0}, `{"_id":1}`, nil, false, -1, -1)
|
|
|
|
+ for _, d := range *data {
|
|
|
|
+ gtid = d["gtid"].(string)
|
|
|
|
+ lteid = d["lteid"].(string)
|
|
|
|
+ set := map[string]interface{}{
|
|
|
|
+ "$set": map[string]interface{}{
|
|
|
|
+ "dataprocess_ai": 2,
|
|
|
|
+ "updatetime": time.Now().Unix(),
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ tools.MgoClassOld.Update(coll, map[string]interface{}{"_id": d["_id"]}, set, false, false)
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ return gtid, lteid
|
|
|
|
+ } else {
|
|
|
|
+ data, _ := tools.MgoClass.Find(coll, map[string]interface{}{"dataprocess": 0}, `{"_id":1}`, nil, false, -1, -1)
|
|
|
|
+ for _, d := range *data {
|
|
|
|
+ gtid = d["gtid"].(string)
|
|
|
|
+ lteid = d["lteid"].(string)
|
|
|
|
+ set := map[string]interface{}{
|
|
|
|
+ "$set": map[string]interface{}{
|
|
|
|
+ "dataprocess": 2,
|
|
|
|
+ "updatetime": time.Now().Unix(),
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ tools.MgoClass.Update(coll, map[string]interface{}{"_id": d["_id"]}, set, false, false)
|
|
|
|
+ break
|
|
}
|
|
}
|
|
- tools.MgoClass.Update(coll, map[string]interface{}{"_id": d["_id"]}, set, false, false)
|
|
|
|
- break
|
|
|
|
|
|
+ return gtid, lteid
|
|
}
|
|
}
|
|
- return gtid, lteid
|
|
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
// NewLoadTestTask 测试任务
|
|
// NewLoadTestTask 测试任务
|
|
@@ -1626,12 +1657,23 @@ func InitTimeTask() *TTask {
|
|
func StartTask(t *TTask) {
|
|
func StartTask(t *TTask) {
|
|
defer util.Catch()
|
|
defer util.Catch()
|
|
logger.Debug("开始执行定时任务")
|
|
logger.Debug("开始执行定时任务")
|
|
- query := map[string]interface{}{
|
|
|
|
- "_id": map[string]interface{}{
|
|
|
|
- "$gt": u.StringTOBsonId(tools.IdCollSid),
|
|
|
|
- },
|
|
|
|
- "dataprocess": 8,
|
|
|
|
|
|
+ query := make(map[string]interface{})
|
|
|
|
+ if util.ObjToString(tools.Config["dbname_old"]) != "" {
|
|
|
|
+ query = map[string]interface{}{
|
|
|
|
+ "_id": map[string]interface{}{
|
|
|
|
+ "$gt": u.StringTOBsonId(tools.IdCollSid),
|
|
|
|
+ },
|
|
|
|
+ "dataprocess_ai": 8,
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ query = map[string]interface{}{
|
|
|
|
+ "_id": map[string]interface{}{
|
|
|
|
+ "$gt": u.StringTOBsonId(tools.IdCollSid),
|
|
|
|
+ },
|
|
|
|
+ "dataprocess": 8,
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
order := map[string]interface{}{"_id": -1}
|
|
order := map[string]interface{}{"_id": -1}
|
|
logger.Debug("query:", query)
|
|
logger.Debug("query:", query)
|
|
list, _ := tools.MgoClass.Find(t.S_idcoll, query, order, nil, false, -1, -1)
|
|
list, _ := tools.MgoClass.Find(t.S_idcoll, query, order, nil, false, -1, -1)
|