Просмотр исходного кода

爬虫分配及站点修改功能修改

mxs 4 месяцев назад
Родитель
Сommit
ad86d61e92

+ 3 - 2
src/front/claim.go

@@ -61,7 +61,7 @@ func (f *Front) ClaimCode() {
 			"$in": []int{0, 2}, //待完成、未通过
 		},
 		"platform": map[string]interface{}{
-			"$nin": []string{"通用平台", "python"},
+			"$in": []string{"golua平台", "chrome"},
 		},
 	}
 	num := MgoEB.Count("luaconfig", q)
@@ -73,8 +73,9 @@ func (f *Front) ClaimCode() {
 	q = map[string]interface{}{
 		"claimtype": CLAIMTYPEUNCLAIMED, //待认领
 		"platform": map[string]interface{}{
-			"$nin": []string{"通用平台", "python"},
+			"$in": []string{"golua平台", "chrome"},
 		},
+		"state": Sp_state_0,
 	}
 
 	s := 1

+ 7 - 8
src/front/front.go

@@ -739,9 +739,9 @@ func (f *Front) Assign() {
 			//recovertime := CreateRecovertime(spiderimportant, priority)
 			recovertime := time.Now().Add(24 * 5 * time.Hour).Unix()
 			set = map[string]interface{}{
-				//"claimtype":       CLAIMTYPECLAIMED,
-				//"claimtime":       now,
-				//"recovertime":     recovertime,
+				"claimtype":       CLAIMTYPECLAIMED,
+				"claimtime":       now,
+				"recovertime":     recovertime,
 				"createuseremail": (*user)["s_email"],
 				"createuser":      name,
 				"createuserid":    userid,
@@ -795,7 +795,6 @@ func (f *Front) Assign() {
 			}
 			update = append(update, up)
 		}
-		qu.Debug(query)
 		//更新爬虫信息
 		b := u.MgoEB.UpdateBulk("luaconfig", update...)
 		//保存认领日志
@@ -859,8 +858,8 @@ func (f *Front) SpiderUpdatePlatform() {
 		//更新状态
 		set["state"] = 0
 		//爬虫认领状态更新
-		set["claimtype"] = CLAIMTYPECLAIMED
-		set["claimtime"] = time.Now().Unix()
+		set["claimtype"] = CLAIMTYPEUNCLAIMED
+		set["claimtime"] = int64(0)
 		set["recovertime"] = int64(0)
 		//换平台爬虫回收,保存日志
 		recovelog := map[string]interface{}{
@@ -1103,8 +1102,8 @@ func (f *Front) UpdateESP() {
 		//更新状态
 		set["state"] = 0
 		//爬虫认领状态更新
-		set["claimtype"] = CLAIMTYPECLAIMED
-		set["claimtime"] = time.Now().Unix()
+		set["claimtype"] = CLAIMTYPEUNCLAIMED
+		set["claimtime"] = int64(0)
 		set["recovertime"] = int64(0)
 		//换平台爬虫回收,保存日志
 		recovelog := map[string]interface{}{

+ 4 - 2
src/timetask/timetask.go

@@ -156,11 +156,13 @@ func UpdateCodeHeart() {
 	query := map[string]interface{}{
 		"$or": []interface{}{
 			map[string]interface{}{
-				"platform": "python",
+				"platform": map[string]interface{}{
+					"$in": []string{"python", "jschrome"},
+				},
 			},
 			map[string]interface{}{
 				"state": map[string]interface{}{
-					"$in": []int{4, 6, 7, 8, 9, 10, 11},
+					"$in": []int{4, 6, 7, 8, 9, 10},
 				},
 			},
 		},

+ 10 - 31
src/web/templates/mytask.html

@@ -18,6 +18,7 @@
 								<th>爬虫代码</th>
 								<th>网站名称</th>
 								<th>栏目名称</th>
+								<th>平台</th>
 								<th>节点</th>
 								<th>任务状态</th>
                 				<th>类型</th>
@@ -51,37 +52,9 @@
 				
        		 },
 			"columnDefs": [
-			    { "orderable": false, "targets": [0,1,2,3,4,5,10,11] },
-				//爬虫挂起
-				// {"targets":[11], createdCell: function (cell, cellData, rowData, rowIndex, colIndex) {
-				// 		var aInput;
-				// 		$(cell).click(function () {
-				// 			if( rowData.i_state == "关闭"||rowData.i_pendstate ==1 ){//任务不能由挂起转为非挂起状态;关闭任务不能挂起操作
-				// 				return
-				// 			}
-				// 			$(this).html(createComboxPendState(rowData.s_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 = 1
-				// 			}
-				// 			mytask.cell(cell).data(text);
-				// 			cellData = text;
-				// 		});
-				// 	}}
-			],	
-      		"order": [[10,"desc"]], //默认排序列
+			    { "orderable": false, "targets": [0,1,2,3,4,5,6,12] },
+			],
+      		"order": [[11,"desc"]], //默认排序列
 			"lengthChange":false,
 			"serverSide": true,
 			"searching": true,
@@ -92,6 +65,12 @@
 				{"data":"s_code"},
 	      		{"data": "s_site"},
 				{"data": "s_channel"},
+				{"data": "s_platform",render:function(val,a,row){
+					if (val == null || val == undefined){
+						return "golua平台"
+					}
+					return val
+					}},
 				{"data": "i_event"},
 				{"data": "i_state","width":"5%",render:function(val,a,row){
 						if (val == 0){

+ 1 - 1
src/web/templates/mytaskedit.html

@@ -30,7 +30,7 @@
 								</div>
 							</div>
 							<div class="form-group">
-								<label for="channel" class="col-sm-4 control-label nameStyle">站点名称:</label>
+								<label for="channel" class="col-sm-4 control-label nameStyle">栏目名称:</label>
 								<div class="col-sm-8">
 									<input type="text" class="form-control" readonly=true name="channel" value="{{.T.task.s_channel}}" id="channel">
 								</div>

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

@@ -69,6 +69,7 @@
 								<th>网站名称</th>
 								<th>栏目名称</th>
 								<th>爬虫代码</th>
+								<th>平台</th>
 								<th>状态</th>
                					<th>类型</th>
 								<th>维护人</th>
@@ -108,9 +109,9 @@
        		 },
 			"columnDefs": [
 				{ "targets": 0 ,"bVisible": false}, //隐藏列
-				{ "orderable": false, "targets": [0,1,2,3,4,5,6,7,8,9,14] } //设置列不可排序
+				{ "orderable": false, "targets": [0,1,2,3,4,5,6,7,8,9,10,15] } //设置列不可排序
 			],
-			"order": [[13,"desc"]], //默认排序列
+			"order": [[14,"desc"]], //默认排序列
 			"lengthChange":false,
 			"serverSide": true,
 			"searching": true,
@@ -141,6 +142,7 @@
 					// return "<a href='"+href+"' target='_blank' title='"+val+"'>"+val+"</a>"
 						return val;
 				}},
+				{"data": "s_platform"},
 				{"data": "i_state","width":"5%",render:function(val,a,row){
 					if (val == 0){
 						return "待确认"

+ 1 - 1
src/web/templates/taskedit.html

@@ -34,7 +34,7 @@
 								</div>
 							</div>
 							<div class="form-group">
-								<label for="channel" class="col-sm-4 control-label nameStyle">站点名称:</label>
+								<label for="channel" class="col-sm-4 control-label nameStyle">栏目名称:</label>
 								<div class="col-sm-8">
 				           			<input type="text" class="form-control" readonly=true name="channel" value="{{.T.task.s_channel}}" id="channel">
 								</div>