ソースを参照

站点列表调整

mxs 5 ヶ月 前
コミット
abcff1229d

+ 2 - 0
src/front/claim.go

@@ -167,6 +167,7 @@ func (f *Front) ReturnCode() {
 				"important":        l["spiderimportant"],
 				"returnreason":     returnreason,
 				"claimrecovertype": 1,
+				"source":           "golua平台爬虫归还",
 			})
 		}
 		//更新爬虫信息
@@ -218,6 +219,7 @@ func UpdateCodeAndSaveLog(lua []map[string]interface{}, f *Front) {
 			"important":        spiderimportant,
 			"returnreason":     "",
 			"claimrecovertype": 1,
+			"source":           "golua平台爬虫认领",
 		})
 	}
 	//更新爬虫信息

+ 33 - 24
src/front/front.go

@@ -441,6 +441,7 @@ func saveLua(o map[string]interface{}) bool {
 				"important":        false,
 				"returnreason":     "",
 				"claimrecovertype": 0,
+				"source":           "爬虫指定维护人导入",
 			}
 		} else {
 			param["recovertime"] = int64(0)       //回收时间
@@ -764,6 +765,7 @@ func (f *Front) Assign() {
 						"important":        spiderimportant,
 						"returnreason":     "",
 						"claimrecovertype": 0,
+						"source":           "分配爬虫回收",
 					}
 					save = append(save, recovelog)
 				}
@@ -784,6 +786,7 @@ func (f *Front) Assign() {
 						"important":        spiderimportant,
 						"returnreason":     "",
 						"claimrecovertype": 0,
+						"source":           "分配爬虫认领",
 					}
 					save = append(save, claimlog)
 				} else if platform != "golua平台" && platform != "chrome" { //分配到其他平台改为历史爬虫
@@ -1016,12 +1019,17 @@ func (f *Front) UpdateESP() {
 		if val != "golua平台" && val != "chrome" {
 			b := u.MgoS.Update("spider_heart", map[string]interface{}{"code": code}, map[string]interface{}{"$set": map[string]interface{}{"del": true}}, false, true)
 			qu.Debug("Del Heart:", b)
-			b, err := spider.UpdateSpiderByCodeState(code, "6", qu.IntAll((*one)["event"])) //下架
-			if b && err == nil {
-				//历史节点下架为了避免线上运行爬虫待完成时改为7000采集历史,但是又转到其他平台,导致原线上运行节点爬虫并未下线,心跳异常
-				if incrementevent := (*one)["incrementevent"]; incrementevent != nil {
-					b, err = spider.UpdateSpiderByCodeState(code, "6", qu.IntAll(incrementevent))
+			var err error
+			if qu.ObjToString((*one)["platform"]) == "golua平台" {
+				b, err = spider.UpdateSpiderByCodeState(code, "6", qu.IntAll((*one)["event"])) //下架
+				if b && err == nil {
+					//历史节点下架为了避免线上运行爬虫待完成时改为7000采集历史,但是又转到其他平台,导致原线上运行节点爬虫并未下线,心跳异常
+					if incrementevent := (*one)["incrementevent"]; incrementevent != nil {
+						b, err = spider.UpdateSpiderByCodeState(code, "6", qu.IntAll(incrementevent))
+					}
 				}
+			}
+			if b && err == nil {
 				//关闭任务
 				u.MgoEB.Update("task", map[string]interface{}{"s_code": code, "i_state": map[string]interface{}{"$in": []int{0, 1, 2, 3, 5}}}, map[string]interface{}{"$set": map[string]interface{}{"i_state": 6}}, false, true)
 				if b && err == nil {
@@ -1043,26 +1051,27 @@ func (f *Front) UpdateESP() {
 				f.Write("n")
 				return
 			}
-			//lua转python,爬虫认领状态更新
-			UpdateLuaClaimtype(code)
-			//换平台爬虫回收,保存日志
-			recovelog := map[string]interface{}{
-				"site":             (*one)["site"],
-				"code":             (*one)["code"],
-				"channel":          (*one)["channel"],
-				"modifyuser":       (*one)["modifyuser"],
-				"priority":         (*one)["priority"],
-				"stype":            "回收",
-				"comeintime":       time.Now().Unix(),
-				"claimtime":        (*one)["claimtime"],
-				"recovertime":      (*one)["recovertime"],
-				"returntime":       int64(0),
-				"important":        (*one)["spiderimportant"],
-				"returnreason":     "转平台",
-				"claimrecovertype": 0,
-			}
-			u.MgoEB.Save("lua_logs_claim", recovelog)
 		}
+		//爬虫认领状态更新
+		UpdateLuaClaimtype(code)
+		//换平台爬虫回收,保存日志
+		recovelog := map[string]interface{}{
+			"site":             (*one)["site"],
+			"code":             (*one)["code"],
+			"channel":          (*one)["channel"],
+			"modifyuser":       (*one)["modifyuser"],
+			"priority":         (*one)["priority"],
+			"stype":            "回收",
+			"comeintime":       time.Now().Unix(),
+			"claimtime":        (*one)["claimtime"],
+			"recovertime":      (*one)["recovertime"],
+			"returntime":       int64(0),
+			"important":        (*one)["spiderimportant"],
+			"returnreason":     "转平台",
+			"claimrecovertype": 0,
+			"source":           "爬虫转平台回收",
+		}
+		u.MgoEB.Save("lua_logs_claim", recovelog)
 	} else if w == "priority" { //调整优先级
 		priority := qu.IntAll(val)
 		if priority < 0 {

+ 1 - 0
src/timetask/timetask.go

@@ -73,6 +73,7 @@ func RecoverCodes() {
 				"important":        l["spiderimportant"],
 				"returnreason":     "",
 				"claimrecovertype": 1,
+				"source":           "golua平台爬虫回收",
 			})
 		}
 		//更新爬虫信息

+ 4 - 2
src/web/templates/index.html

@@ -693,9 +693,10 @@
 				"<select id='platform' onchange='checkclick(this,\"\")' class='form-control input-sm'>"+
 				"<option value='-1'>全部</option>"+
 				"<option value='golua平台'>golua平台</option>"+
-					"<option value='chrome'>chrome</option>"+
+				"<option value='chrome'>chrome</option>"+
 				"<option value='python'>python</option>"+
-					"<option value='通用平台'>通用平台</option>"+
+				"<option value='通用平台'>通用平台</option>"+
+				"<option value='jschrome'>jschrome</option>"+
 				"</select></div>";
 			$("#spider_filter").prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
 			$("#spider_filter").prepend(platform);
@@ -1007,6 +1008,7 @@
 				"<option value='chrome'>chrome</option>"+
 				"<option value='python'>python</option>"+
 				"<option value='通用平台'>通用平台</option>"+
+				"<option value='jschrome'>jschrome</option>"+
 				"</select>";
 	};
 	function updateesp(val,w,s,c,id){

+ 1 - 0
src/web/templates/lualist.html

@@ -256,6 +256,7 @@
                     "<option value='chrome'>chrome</option>"+
                     "<option value='python'>python</option>"+
                     "<option value='通用平台'>通用平台</option>"+
+                    "<option value='jschrome'>jschrome</option>"+
                     "</select></div>"
                 $("#spider_filter").prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                 $("#spider_filter").prepend(platform);

+ 2 - 0
src/web/templates/mytask.html

@@ -241,6 +241,8 @@
 			platform+="<option value='golua平台'>golua平台</option>";
 			platform+="<option value='chrome'>chrome</option>";
 			platform+="<option value='python'>python</option>";
+			platform+="<option value='通用平台'>通用平台</option>";
+			platform+="<option value='jschrome'>jschrome</option>";
 			var selectPlatform="<div class='form-group'><label for='name'>平台:</label>"+
 					"<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
 					platform+

+ 2 - 0
src/web/templates/newtasklist.html

@@ -321,6 +321,8 @@
 			platform+="<option value='golua平台'>golua平台</option>";
 			platform+="<option value='chrome'>chrome</option>";
 			platform+="<option value='python'>python</option>";
+			platform+="<option value='通用平台'>通用平台</option>";
+			platform+="<option value='jschrome'>jschrome</option>";
 			var selectPlatform="<div class='form-group'><label for='name'>平台:</label>"+
 					"<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
 					platform+

+ 1 - 0
src/web/templates/sitelist.html

@@ -726,6 +726,7 @@ $(function(){
             "<option value='python'>python</option>"+
             "<option value='golua平台,python'>golua平台,python</option>"+
             "<option value='通用平台'>通用平台</option>"+
+            "<option value='jschrome'>jschrome</option>"+
             "</select></div>"
 		$("#sitelist_filter").prepend("&nbsp;&nbsp;");
 		$("#sitelist_filter").prepend(platform);

+ 2 - 0
src/web/templates/task.html

@@ -319,6 +319,8 @@
 			platform+="<option value='golua平台'>golua平台</option>";
 			platform+="<option value='chrome'>chrome</option>";
 			platform+="<option value='python'>python</option>";
+			platform+="<option value='通用平台'>通用平台</option>";
+			platform+="<option value='jschrome'>jschrome</option>";
 			var selectPlatform="<div class='form-group'><label for='name'>平台:</label>"+
 					"<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
 					platform+

+ 2 - 0
src/web/templates/user.html

@@ -296,6 +296,8 @@
 					"<option value='-1'>全部</option>"+
 					"<option value='golua平台'>golua平台</option>"+
 					"<option value='python'>python</option>"+
+					"<option value='通用平台'>通用平台</option>"+
+					"<option value='jschrome'>jschrome</option>"+
 					"</select></div>"
 			$("#user_filter").prepend("&nbsp;&nbsp;");
 			$("#user_filter").prepend(platform);