浏览代码

调整任务中异常数据搜索功能

maxiaoshan 2 年之前
父节点
当前提交
1cd20a16ff
共有 2 个文件被更改,包括 27 次插入11 次删除
  1. 11 5
      src/taskManager/taskManager.go
  2. 16 6
      src/web/templates/head.html

+ 11 - 5
src/taskManager/taskManager.go

@@ -1138,13 +1138,19 @@ func (t *TaskM) SearchDataInfo() {
 			coll = "spider_listdata"
 		}
 	}
-	qu.Debug(coll, stype, event)
+	qu.Debug(coll, stype, event, href)
 	data, _ := u.MgoS.FindOne(coll, map[string]interface{}{"href": href})
 	if data != nil && len(*data) > 0 {
-		info := (*data)["data"].(map[string]interface{})
-		publishtime := qu.Int64All(info["publishtime"])
-		str := "publishtime:" + fmt.Sprint(publishtime) + "\ntitle:" + qu.ObjToString((*data)["title"]) + ";\ndetail:" + qu.ObjToString(info["detail"])
-		t.ServeJson(str)
+		text := ""
+		if coll == "spider_warn" {
+			info := (*data)["data"].(map[string]interface{})
+			publishtime := qu.Int64All(info["publishtime"])
+			text = "publishtime:" + fmt.Sprint(publishtime) + "\ntitle:" + qu.ObjToString((*data)["title"]) + ";\ndetail:" + qu.ObjToString(info["detail"])
+		} else {
+			text = "publishtime:" + fmt.Sprint((*data)["publishtime"]) + "\ntitle:" + qu.ObjToString((*data)["title"]) + "; "
+		}
+
+		t.ServeJson(text)
 	} else {
 		t.ServeJson("无信息")
 	}

+ 16 - 6
src/web/templates/head.html

@@ -638,15 +638,25 @@
   //搜索错误日志
   function searchdatainfo(){
     var href = $("#datahref").val();
-	var stype = {{.T.task.s_type}}
-	var event = {{.T.task.i_event}}
+	var stype = {{.T.task.s_type}};
+	var event = {{.T.task.i_event}};
+	console.log(href,stype,event)
     if(href==""){
       return
     }
-    $.post("/center/task/searchDataInfo",{"href":href,"stype":stype,"event":event},function(r){
-      $("#datainfo").val(r);
-      $("#datainfoarea").removeClass("hide");
-    })
+	  $.ajax({
+		  url:"/center/task/searchDataInfo",
+		  type:"post",
+		  data:{
+			  "href":href,
+			  "event":event,
+			  "stype":stype
+		  },
+		  success:function(r){
+			  $("#datainfo").val(r);
+			  $("#datainfoarea").removeClass("hide");
+		  }
+	  })
   }
 </script>