Browse Source

7000新增爬虫维护限制,公共方法新增,保存校验

maxiaoshan 2 years ago
parent
commit
fe52a044b6
4 changed files with 34 additions and 4 deletions
  1. 10 0
      src/front/spider.go
  2. 0 2
      src/spider/script.go
  3. 6 2
      src/task/task.go
  4. 18 0
      src/web/templates/newtask.html

+ 10 - 0
src/front/spider.go

@@ -568,6 +568,16 @@ func LuaTextCheck(list, detail string, type_list, infoformat int, model map[stri
 		}
 	}
 	if type_list == 1 {
+		//校验列表页area、city、distric
+		if !strings.Contains(list, "area") {
+			msg += `模板item["area"]不存在`
+		}
+		if !strings.Contains(list, "city") {
+			msg += `模板item["city"]不存在`
+		}
+		if !strings.Contains(list, "district") {
+			msg += `模板item["district"]不存在`
+		}
 		area := qu.ObjToString(model["area"])
 		city := qu.ObjToString(model["city"])
 		district := qu.ObjToString(model["district"])

+ 0 - 2
src/spider/script.go

@@ -631,7 +631,6 @@ func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
 		S.Push(lua.LString(decimalNum.String()))
 		return 1
 	}))
-
 	//获取验证码
 	s.L.SetGlobal("getCodeByPath", s.L.NewFunction(func(S *lua.LState) int {
 		cookie := S.ToString(-1)
@@ -666,7 +665,6 @@ func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
 		S.Push(lua.LString(result))
 		return 1
 	}))
-
 	s.L.SetGlobal("newDownloadFile", s.L.NewFunction(func(S *lua.LState) int {
 		cookie := S.ToString(-1)
 		head := S.ToTable(-2)

+ 6 - 2
src/task/task.go

@@ -24,6 +24,7 @@ func (t *Task) TaskList() {
 	taskState, _ := t.GetInteger("taskState") //任务状态
 	event, _ := t.GetInteger("taskEvent")     //节点
 	stype, _ := t.GetInteger("taskStype")     //任务类型
+	platform := t.GetString("platform")       //任务类型
 	userid := t.GetString("userid")
 	searchStr := t.GetString("search[value]")
 	//search := strings.Replace(searchStr, " ", "", -1)
@@ -42,7 +43,7 @@ func (t *Task) TaskList() {
 			t.T["modifyusers"] = getModifyUsers()
 			t.Render("newtask.html", &t.T)
 		} else {
-			query := queryCriteria(userid, taskState, event, stype)
+			query := queryCriteria(userid, platform, taskState, event, stype)
 			if search != "" {
 				query["$or"] = []interface{}{
 					map[string]interface{}{"s_code": map[string]interface{}{"$regex": search}},
@@ -151,11 +152,14 @@ func getModifyUsers() []map[string]interface{} {
 	return *user
 }
 
-func queryCriteria(userid string, taskState, event, stype int) (query map[string]interface{}) {
+func queryCriteria(userid, platform string, taskState, event, stype int) (query map[string]interface{}) {
 	query = map[string]interface{}{}
 	if userid != "" && userid != "-1" {
 		query["s_modifyid"] = userid
 	}
+	if platform != "" && platform != "-1" {
+		query["s_platform"] = platform
+	}
 	if taskState >= 0 {
 		query["i_state"] = taskState
 	}

+ 18 - 0
src/web/templates/newtask.html

@@ -225,6 +225,7 @@
 				var taskEvent = $("#task_event").val();
 				var taskStype = $("#task_stype").val();
 				var userid = $("#modifyuser").val();
+				var platform = $("#platform").val();
 				//任务状态
 				if(taskState){
 					e.taskState = taskState;
@@ -249,6 +250,12 @@
 				}else{
 					e.userid="-1";
 				}
+				//平台
+				if(platform){
+					e.platform = platform;
+				}else{
+					e.platform="-1";
+				}
       		}
 	  	});
 		common.setActive("index_newrwgl");
@@ -305,6 +312,17 @@
 			"</select></div>"
 			$("#task_filter").prepend("&nbsp;&nbsp;");
 			$("#task_filter").prepend(selectModifyuser);
+
+			//平台
+			var platform="<option value='-1'>全部</option>"
+			platform+="<option value='golua平台'>golua平台</option>";
+			platform+="<option value='python'>python</option>";
+			var selectPlatform="<div class='form-group'><label for='name'>平台:</label>"+
+					"<select id='platform' onchange='checkclick(this.value)' class='form-control input-sm'>"+
+					platform+
+					"</select></div>"
+			$("#task_filter").prepend("&nbsp;&nbsp;");
+			$("#task_filter").prepend(selectPlatform);
 			//修改样式
 			$("#task_wrapper .col-sm-6").css({width:"100%"});
 		});