浏览代码

列表页异常任务流程修改

maxiaoshan 2 年之前
父节点
当前提交
cc75b6e7a4
共有 1 个文件被更改,包括 17 次插入5 次删除
  1. 17 5
      src/luatask/newtask.go

+ 17 - 5
src/luatask/newtask.go

@@ -58,6 +58,7 @@ type NewSpider struct {
 	Detail_DownloadSuccessNum int               `bson:"detail_downloadsuccessnum"`
 	Detail_DownloadFailNum    int               `bson:"detail_downloadfailnum"`
 	List_IsGetData            bool              `bson:"list_isgetdata"`
+	HeartTime                 int64             `bson:"heart_time"`
 	List_RunTimes             int               `bson:"list_runtimes"`
 	List_NoDataTimes          int               `bson:"list_nodatatimes"`
 	List_AllInTimes           int               `bson:"list_allintimes"`
@@ -400,6 +401,7 @@ func getSpiderHeart() {
 				//	limitDayNum = -1
 				//}
 				sp.List_IsGetData = findListHeart > util.GetTime(0)-int64(12*3600) //前一天12点
+				sp.HeartTime = findListHeart
 			}
 			lock.Unlock()
 		}(tmp)
@@ -745,7 +747,8 @@ func listErr(sp *NewSpider) {
 	if sp.Platform == "python" && !sp.Py_IsValid {
 		return
 	}
-	if !sp.List_IsGetData || sp.List_RunTimes == 0 {
+	//if !sp.List_IsGetData || sp.List_RunTimes == 0 {
+	if !sp.List_IsGetData {
 		errFlag := false
 		if sp.CodeTags != nil {
 			tagTime, _ := sp.CodeTags[NEWTASK_LISTERR].(int64) //用struct接收,会转为floa64
@@ -763,11 +766,20 @@ func listErr(sp *NewSpider) {
 			//}
 			sp.ErrType = qu.IntAll(NEWTASK_LISTERR)
 			sp.ErrTypeMap[qu.IntAll(NEWTASK_LISTERR)] = true
-			if !sp.List_IsGetData {
-				sp.ErrDescription += "列表页异常:\n	无最新心跳\n"
-			} else if sp.List_RunTimes == 0 {
-				sp.ErrDescription += "列表页异常:\n	列表页共采集" + fmt.Sprint(sp.List_RunTimes) + "轮,其中有" + fmt.Sprint(sp.List_NoDataTimes) + "轮无数据\n"
+			heartTime := ""
+			if sp.HeartTime != 0 {
+				heartTime = qu.FormatDateByInt64(&sp.HeartTime, qu.Date_Full_Layout)
 			}
+			sp.ErrDescription += "列表页异常:\n	无最新心跳:" + heartTime + "\n"
+			//if !sp.List_IsGetData {
+			//	heartTime := ""
+			//	if sp.HeartTime != 0 {
+			//		heartTime = qu.FormatDateByInt64(&sp.HeartTime, qu.Date_Full_Layout)
+			//	}
+			//	sp.ErrDescription += "列表页异常:\n	无最新心跳:" + heartTime + "\n"
+			//} else if sp.List_RunTimes == 0 {
+			//	sp.ErrDescription += "列表页异常:\n	列表页共采集" + fmt.Sprint(sp.List_RunTimes) + "轮,其中有" + fmt.Sprint(sp.List_NoDataTimes) + "轮无数据\n"
+			//}
 		}
 	}
 }