maxiaoshan 3 years ago
parent
commit
be0f082c21
2 changed files with 111 additions and 100 deletions
  1. 10 1
      src/front/front.go
  2. 101 99
      src/web/templates/index.html

+ 10 - 1
src/front/front.go

@@ -841,8 +841,17 @@ func (f *Front) UpdateESP() {
 	update := map[string]interface{}{
 		"$set": set,
 	}
-	if w == "state" { //修改状态为待完成
+	if w == "state" { //无效爬虫改为待完成
+		one, _ := u.MgoE.FindById("luaconfig", id, map[string]interface{}{"historyevent": 1, "event": 1})
+		tmpEvent := qu.IntAll((*one)["event"])
+		if one != nil && len(*one) > 0 {
+			if (*one)["historyevent"] == nil && tmpEvent != 7000 { //除7000节点外没有historyevent的要重新设置
+				set["historyevent"] = tmpEvent
+			}
+		}
 		set["state"] = 0
+		set["event"] = 7000
+		set["spidertype"] = "history"
 	} else if w == "platform" {
 		set["platform"] = val
 		if val != "golua平台" { //由lua平台切换到其他平台,删除心跳;爬虫下架;修改爬虫状态

+ 101 - 99
src/web/templates/index.html

@@ -159,105 +159,107 @@ $(function(){
               "url": "/js/dataTables.chinese.lang"
           },
 		"columnDefs": [
-		    { "orderable": false, "targets": [0,10,11] },
-			{"targets":[6], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
-			  {{if gt (session "auth") 2}}
-			  var aInput;
-			  $(cell).click(function () {
-				$(this).html(createComboxEvent(rowData._id,rowData.state,rowData.code));
-				var aInput = $(this).find(":input");
-				aInput.focus().val(cellData);
-			  });
-			  $(cell).on("click", ":input", function (e) {
-				e.stopPropagation();
-			  });
-			  $(cell).on("change", ":input", function () {
-				$(this).blur();
-			  });
-			  $(cell).on("blur", ":input", function () {
-				var text = $(this).find("option:selected").text();
-				ttable.cell(cell).data(text);
-				cellData = text;
-			  });
-			  {{end}}
-			}},
-			{"targets":[9], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
-			  {{if gt (session "auth") 2}}
-			  var aInput;
-			  $(cell).click(function () {
-				if(cellData!=4&&cellData!=7&&cellData!=8&&cellData!=9&&cellData!=10){
-				  return
-				}
-				$(this).html(createComboxState(rowData._id));
-				var aInput = $(this).find(":input");
-				aInput.focus().val(cellData);
-			  });
-			  $(cell).on("click", ":input", function (e) {
-				e.stopPropagation();
-			  });
-			  $(cell).on("change", ":input", function () {
-				$(this).blur();
-			  });
-			  $(cell).on("blur", ":input", function () {
-				var text = $(this).find("option:selected").text();
-				if(text=="待完成"){
-				  text = 0
-				}else if (text=="已作废"){
-				  text = 4
-				}else if (text=="无发布"){
-				  text = 7
-				}else if (text=="需登录"){
-				  text = 8
-				}else if (text=="无法处理"){
-				  text = 9
-				}else if (text=="已删除"){
-				  text = 10
-				}else if (text=="已上线"){
-				  text = 11
-				}
-				ttable.cell(cell).data(text);
-				cellData = text;
-			  });
-			  {{end}}
-			}},
-        	{"targets":[10], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
-			  {{if gt (session "auth") 2}}
-			  var aInput;
-			  $(cell).click(function () {
-				$(this).html(createComboxPlatform(rowData.code,rowData._id));
-				var aInput = $(this).find(":input");
-				aInput.focus().val(cellData);
-			  });
-			  $(cell).on("click", ":input", function (e) {
-				e.stopPropagation();
-			  });
-			  $(cell).on("change", ":input", function () {
-				$(this).blur();
-			  });
-			  $(cell).on("blur", ":input", function () {
-				var text = $(this).find("option:selected").text();
-				if(text=="待完成"){
-				  text = 0
-				}else if (text=="已作废"){
-				  text = 4
-				}else if (text=="无发布"){
-				  text = 7
-				}else if (text=="需登录"){
-				  text = 8
-				}else if (text=="无法处理"){
-				  text = 9
-				}else if (text=="已删除"){
-				  text = 10
-				}else if (text=="已上线"){
-				  text = 11
-				}
-
-				ttable.cell(cell).data(text);
-				cellData = text;
-			  });
-			  {{end}}
-			}}
-		],
+	    { "orderable": false, "targets": [0,10,11] },
+      //更新节点
+		  {"targets":[6], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
+  			  {{if gt (session "auth") 2}}
+  			    var aInput;
+  			    $(cell).click(function () {
+  				  $(this).html(createComboxEvent(rowData._id,rowData.state,rowData.code));
+  				  var aInput = $(this).find(":input");
+  				    aInput.focus().val(cellData);
+  			    });
+  			    $(cell).on("click", ":input", function (e) {
+  				    e.stopPropagation();
+  			    });
+  			    $(cell).on("change", ":input", function () {
+  				    $(this).blur();
+  			    });
+  			    $(cell).on("blur", ":input", function () {
+  				    var text = $(this).find("option:selected").text();
+  				    ttable.cell(cell).data(text);
+  				    cellData = text;
+  			    });
+		    {{end}}
+		  }},
+		  //更新状态
+      {"targets":[9], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
+		    {{if gt (session "auth") 2}}
+		      var aInput;
+		      $(cell).click(function () {
+			    if(cellData!=4&&cellData!=7&&cellData!=8&&cellData!=9&&cellData!=10){
+			      return
+			    }
+			    $(this).html(createComboxState(rowData._id));
+			    var aInput = $(this).find(":input");
+			      aInput.focus().val(cellData);
+		      });
+		      $(cell).on("click", ":input", function (e) {
+			      e.stopPropagation();
+		      });
+		      $(cell).on("change", ":input", function () {
+			      $(this).blur();
+		      });
+		      $(cell).on("blur", ":input", function () {
+			    var text = $(this).find("option:selected").text();
+      			if(text=="待完成"){
+      			  text = 0
+      			}else if (text=="已作废"){
+      			  text = 4
+      			}else if (text=="无发布"){
+      			  text = 7
+      			}else if (text=="需登录"){
+      			  text = 8
+      			}else if (text=="无法处理"){
+      			  text = 9
+      			}else if (text=="已删除"){
+      			  text = 10
+      			}else if (text=="已上线"){
+      			  text = 11
+      			}
+			    ttable.cell(cell).data(text);
+			      cellData = text;
+		      });
+		    {{end}}
+		  }},
+      //更新平台
+      	{"targets":[10], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
+		    {{if gt (session "auth") 2}}
+		      var aInput;
+		      $(cell).click(function () {
+			    $(this).html(createComboxPlatform(rowData.code,rowData._id));
+			    var aInput = $(this).find(":input");
+			      aInput.focus().val(cellData);
+		      });
+		      $(cell).on("click", ":input", function (e) {
+			      e.stopPropagation();
+		      });
+		      $(cell).on("change", ":input", function () {
+			      $(this).blur();
+		      });
+		      $(cell).on("blur", ":input", function () {
+			    var text = $(this).find("option:selected").text();
+      			if(text=="待完成"){
+      			  text = 0
+      			}else if (text=="已作废"){
+      			  text = 4
+      			}else if (text=="无发布"){
+      			  text = 7
+      			}else if (text=="需登录"){
+      			  text = 8
+      			}else if (text=="无法处理"){
+      			  text = 9
+      			}else if (text=="已删除"){
+      			  text = 10
+      			}else if (text=="已上线"){
+      			  text = 11
+      			}
+			    ttable.cell(cell).data(text);
+			      cellData = text;
+		      });
+		    {{end}}
+		  }}
+	  ],
 		"order": [[1,"desc"]],
 		"processing":true,
 		"serverSide": true,