|
@@ -522,7 +522,7 @@ OVER:
|
|
}
|
|
}
|
|
//上一轮任务执行完毕再走下一轮(上一轮任务执行完毕的标志是业主分类执行完)
|
|
//上一轮任务执行完毕再走下一轮(上一轮任务执行完毕的标志是业主分类执行完)
|
|
//util.Debug("ControlTaskRun---", tools.ControlTaskRun, "AllTaskFinish---", tools.AllTaskFinish)
|
|
//util.Debug("ControlTaskRun---", tools.ControlTaskRun, "AllTaskFinish---", tools.AllTaskFinish)
|
|
- if !tools.ControlTaskRun { //线下环境不控制定时任务
|
|
|
|
|
|
+ if !tools.ControlTaskRun || tt.S_querycon == "0" { //线下环境不控制定时任务;或者线上通过时间定时执行
|
|
newtaskrun(tt)
|
|
newtaskrun(tt)
|
|
} else if tools.ControlTaskRun && tools.AllTaskFinish { //线上控制
|
|
} else if tools.ControlTaskRun && tools.AllTaskFinish { //线上控制
|
|
tools.AllTaskFinish = false
|
|
tools.AllTaskFinish = false
|
|
@@ -586,7 +586,9 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
//有结果表有关联字段,在结果表上根据关联字段更新;有结果表没有关联字段,在结果表根据_id段更新
|
|
//有结果表有关联字段,在结果表上根据关联字段更新;有结果表没有关联字段,在结果表根据_id段更新
|
|
//没有结果表在查询表上更新
|
|
//没有结果表在查询表上更新
|
|
//log.Println("lastid:", tt.LastId, "查询方式:", tt.S_querycon, "时间:", tt.S_starttime, "条件:", tt.S_query, "table:", tt.S_table, "s_timefieldname:", tt.S_timefieldname)
|
|
//log.Println("lastid:", tt.LastId, "查询方式:", tt.S_querycon, "时间:", tt.S_starttime, "条件:", tt.S_query, "table:", tt.S_table, "s_timefieldname:", tt.S_timefieldname)
|
|
|
|
+ sort := ""
|
|
if !budp { //非udp查询条件
|
|
if !budp { //非udp查询条件
|
|
|
|
+ sort = "_id"
|
|
if tt.S_query != "" { //有查询条件
|
|
if tt.S_query != "" { //有查询条件
|
|
json.Unmarshal([]byte(strings.Replace(tt.S_query, "'", "\"", -1)), &q)
|
|
json.Unmarshal([]byte(strings.Replace(tt.S_query, "'", "\"", -1)), &q)
|
|
}
|
|
}
|
|
@@ -674,6 +676,7 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else { //udp查询条件
|
|
} else { //udp查询条件
|
|
|
|
+ sort = "-_id"
|
|
if tt.S_query != "" { //有查询条件
|
|
if tt.S_query != "" { //有查询条件
|
|
json.Unmarshal([]byte(strings.Replace(tt.S_query, "'", "\"", -1)), &q)
|
|
json.Unmarshal([]byte(strings.Replace(tt.S_query, "'", "\"", -1)), &q)
|
|
}
|
|
}
|
|
@@ -700,7 +703,7 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
log.Println("select:", tt.Task_QueryFieldMap, tt.Task_QueryFieldArr)
|
|
log.Println("select:", tt.Task_QueryFieldMap, tt.Task_QueryFieldArr)
|
|
}
|
|
}
|
|
|
|
|
|
- extractquery := tasksess.DB(tt.S_mgodb).C(tt.S_coll).Find(q).Select(tt.Task_QueryFieldMap).Sort("_id").Iter()
|
|
|
|
|
|
+ extractquery := tasksess.DB(tt.S_mgodb).C(tt.S_coll).Find(q).Select(tt.Task_QueryFieldMap).Sort(sort).Iter()
|
|
arr := [][]map[string]interface{}{}
|
|
arr := [][]map[string]interface{}{}
|
|
if tt.I_wordcount == 1 {
|
|
if tt.I_wordcount == 1 {
|
|
tt.WordCount = map[string]map[string]int{}
|
|
tt.WordCount = map[string]map[string]int{}
|
|
@@ -881,7 +884,7 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
//}
|
|
//}
|
|
}(tmp)
|
|
}(tmp)
|
|
ttid := u.BsonIdToSId(tid)
|
|
ttid := u.BsonIdToSId(tid)
|
|
- if ttid > tt.LastId {
|
|
|
|
|
|
+ if ttid > tt.LastId && !budp {
|
|
tt.LastId = ttid
|
|
tt.LastId = ttid
|
|
}
|
|
}
|
|
tmp = make(map[string]interface{})
|
|
tmp = make(map[string]interface{})
|