ソースを参照

整体测试修改

maxiaoshan 2 年 前
コミット
6c502c6e19

+ 16 - 15
src/front/front.go

@@ -47,21 +47,22 @@ type Front struct {
 	updatePendState xweb.Mapper `xweb:"/center/spider/updatePendState"` //更新爬虫挂起状态
 	tagCode         xweb.Mapper `xweb:"/center/spider/tagcode"`         //标记爬虫
 
-	spiderModel  xweb.Mapper `xweb:"/center/model"`           //获取补充模型
-	runStep      xweb.Mapper `xweb:"/center/run"`             //方法测试
-	spiderPass   xweb.Mapper `xweb:"/center/spider/pass"`     //整体测试
-	runPinYin    xweb.Mapper `xweb:"/center/runpy"`           //获取拼音
-	saveStep     xweb.Mapper `xweb:"/center/save"`            //爬虫保存
-	saveChannels xweb.Mapper `xweb:"/center/save/channels"`   //保存子栏目
-	saveJs       xweb.Mapper `xweb:"/center/save/js"`         //保存js
-	loadModel    xweb.Mapper `xweb:"/center/gmodel/(.*)"`     //加载模型
-	importdata   xweb.Mapper `xweb:"/center/importdata"`      //导入脚本
-	importfile   xweb.Mapper `xweb:"/center/importfile"`      //批量导入爬虫
-	oldedit      xweb.Mapper `xweb:"/center/oldedit"`         //老文件编辑
-	findName     xweb.Mapper `xweb:"/center/findname"`        //即时查询名称
-	checkrepeat  xweb.Mapper `xweb:"/center/spider/isrepeat"` //脚本代码判重
-	heart        xweb.Mapper `xweb:"/center/heart"`           //心跳监控
-	spiderCopy   xweb.Mapper `xweb:"/center/spider/copy"`     //复制爬虫
+	spiderModel    xweb.Mapper `xweb:"/center/model"`           //获取补充模型
+	runStep        xweb.Mapper `xweb:"/center/run"`             //方法测试
+	spiderPass     xweb.Mapper `xweb:"/center/spider/pass"`     //整体测试
+	runPinYin      xweb.Mapper `xweb:"/center/runpy"`           //获取拼音
+	saveStep       xweb.Mapper `xweb:"/center/save"`            //爬虫保存
+	saveChannels   xweb.Mapper `xweb:"/center/save/channels"`   //保存子栏目
+	saveJs         xweb.Mapper `xweb:"/center/save/js"`         //保存js
+	loadModel      xweb.Mapper `xweb:"/center/gmodel/(.*)"`     //加载模型
+	importdata     xweb.Mapper `xweb:"/center/importdata"`      //导入脚本
+	importfile     xweb.Mapper `xweb:"/center/importfile"`      //批量导入爬虫
+	oldedit        xweb.Mapper `xweb:"/center/oldedit"`         //老文件编辑
+	findName       xweb.Mapper `xweb:"/center/findname"`        //即时查询名称
+	checkrepeat    xweb.Mapper `xweb:"/center/spider/isrepeat"` //脚本代码判重
+	heart          xweb.Mapper `xweb:"/center/heart"`           //心跳监控
+	spiderCopy     xweb.Mapper `xweb:"/center/spider/copy"`     //复制爬虫
+	spiderCloseErr xweb.Mapper `xweb:"/center/spider/closeerr"` //删除错误爬虫
 
 	Base      Base
 	OtherBase OtherBase

+ 110 - 65
src/front/spider.go

@@ -538,17 +538,22 @@ func LuaTextCheck(list, detail string, type_list int) (b bool, msg string) {
 		b = true
 		msg = `三级页缺少data["delete"]="true"`
 	}
-	reg1 := regexp.MustCompile("sendListNum")
-	slIndexArr := reg1.FindAllStringIndex(list, -1)
-	if type_list != 0 && len(slIndexArr) == 0 { //列表页专家模式且不含sendListNum
+	sln_reg := regexp.MustCompile(`sendListNum\(k,list\)`)
+	slnIndexArr := sln_reg.FindAllStringIndex(list, -1)
+	if type_list != 0 && len(slnIndexArr) == 0 { //列表页专家模式且不含sendListNum
 		b = true
-		msg = "代码中缺少sendListNum方法;" + msg
-	} else if type_list == 1 && len(slIndexArr) > 0 { //判断sendListNum方法的位置
-		reg2 := regexp.MustCompile("insert")
-		tsIndexArr := reg2.FindAllStringIndex(list, -1)
-		slIndex := slIndexArr[len(slIndexArr)-1]
-		tsIndex := tsIndexArr[len(tsIndexArr)-1]
-		if slIndex[1] < tsIndex[1] { //sendListNum方法必须在table.inset方法后
+		msg = "代码中缺少sendListNum(k,list)方法;" + msg
+	} else if type_list == 1 && len(slnIndexArr) > 0 { //判断sendListNum方法的位置
+		trim_reg := regexp.MustCompile("trim")
+		insert_reg := regexp.MustCompile("insert")
+
+		trIndexArr := trim_reg.FindAllStringIndex(list, -1)
+		irIndexArr := insert_reg.FindAllStringIndex(list, -1)
+		slIndex := slnIndexArr[len(slnIndexArr)-1] //sendListNum位置
+		trIndex := trIndexArr[len(trIndexArr)-1]   //com.trim位置
+		irIndex := irIndexArr[len(irIndexArr)-1]   //insert位置
+		qu.Debug("sendListNum位置:", trIndex, slIndex, irIndex)
+		if slIndex[1] < trIndex[0] || slIndex[0] > irIndex[1] { //sendListNum方法必须在com.trim方法后,table.insert方法前
 			b = true
 			msg = "sendListNum方法位置错误;" + msg
 		}
@@ -689,16 +694,28 @@ func (f *Front) GetJson() {
 			tr.task_remark = "审核任务创建时间:" + qu.FormatDateByInt64(&comeintime, qu.Date_Short_Layout) + ";" + tr.task_remark
 		}
 		data := tr.dataInfo
-		list := tr.listInfo
+		result := tr.listInfo
 		if len(data) > 0 {
 			data["contenthtml"] = ""
 		}
-		for k, v := range list {
-			v["a_index"] = k + 1
+		num := 0
+		list_fir := []map[string]interface{}{}
+		list_sec := []map[string]interface{}{}
+		for page, list := range result {
+			for k, v := range list {
+				v["a_index"] = k + 1
+				num++
+			}
+			if page == 1 {
+				list_fir = list
+			} else if page == 2 {
+				list_sec = list
+			}
 		}
-
-		f.T["list"] = list
+		f.T["list_fir"] = list_fir
+		f.T["list_sec"] = list_sec
 		f.T["data"] = data
+		f.T["num"] = num
 		f.T["descript"] = tr.task_descript
 		f.T["remark"] = tr.task_remark
 		f.T["rateremark"] = tr.task_rateremark
@@ -707,7 +724,6 @@ func (f *Front) GetJson() {
 		f.T["comeintime"] = comeintime
 		delete(TestResultMap, username+code)
 	}
-
 	f.Render("jsonInfo.html", &f.T)
 }
 
@@ -720,7 +736,7 @@ type TestResult struct {
 	task_descript   string
 	reason          string
 	msg             string
-	listInfo        []map[string]interface{}
+	listInfo        map[int64][]map[string]interface{}
 	dataInfo        map[string]interface{}
 }
 
@@ -728,7 +744,7 @@ type TestResult struct {
 func (f *Front) SpiderPass() {
 	defer mu.Catch()
 	tr := &TestResult{}
-	list := []map[string]interface{}{}
+	result := map[int64][]map[string]interface{}{}
 	data := map[string]interface{}{}
 	msgArr := []string{}
 	code := f.GetString("code")
@@ -765,7 +781,7 @@ func (f *Front) SpiderPass() {
 	tr.task_rateremark = rateremarktmp
 	tr.task_descript = descript
 
-	//基本信息、方法一、方法二、方法三、总请求次数、go方法一、go方法二、go方法三、列表页条数
+	//基本信息、方法一(发布时间)、方法二(列表页)、方法三(详情页)、总请求次数、go方法一、go方法二、go方法三、列表页条数
 	steps := []interface{}{false, false, false, false, 0, 0, 0, 0, 0}
 	one, _ := u.MgoEB.FindOne("luaconfig", map[string]interface{}{"code": code})
 	reason, _ := (*one)["reason"].(string)
@@ -791,59 +807,88 @@ func (f *Front) SpiderPass() {
 		msgArr = u.SpiderPassCheckLua(liststr, contentstr, (*one)) //校验
 	}
 	s := spider.CreateSpider(downloadnode, script)
-	s.SpiderMaxPage = 1
+	s.SpiderMaxPage = 2 //采集列表页总页数
 	s.Timeout = 60
 	timestr, timeerr := s.GetLastPublishTime()
 	if timeerr == nil && len(timestr) > 4 {
-		steps[1] = true
-		list, _ = s.DownListPageItem()
-		for _, l := range list {
-			if publishtime := qu.ObjToString(l["publishtime"]); publishtime == "0" || publishtime == "" {
-				msgArr = append(msgArr, "列表页publishtime取值异常")
-				break
-			} else {
-				t, err := time.ParseInLocation(qu.Date_Full_Layout, publishtime, time.Local)
-				if err != nil || t.Unix() <= 0 {
-					msgArr = append(msgArr, "列表页publishtime取值异常")
-					break
-				}
-			}
+		steps[1] = true //发布时间获取成功
+		downloadNum := 0
+		result, downloadNum, _ = s.DownListPageItem() //列表页采集结果
+		if downloadNum == 0 {
+			f.ServeJson(steps)
+			return
 		}
-		if len(list) > 0 {
-			tr.listInfo = list
-			listone := list[0]
-			if len(qu.ObjToString(listone["href"])) < 7 ||
-				(qu.ObjToString(listone["publishtime"]) != "0" && len(qu.ObjToString(listone["publishtime"])) < 5) ||
-				len(qu.ObjToString(listone["title"])) < 3 {
-				f.ServeJson(steps)
-				return
-			} else {
-				steps[2] = true
-				if s.DownDetail {
-					param := map[string]string{}
-					index := 0
-					if len(list) > 0 {
-						steps[8] = len(list)
-						index = len(list) / 2
-						for k, v := range list[index] {
-							param[k] = qu.ObjToString(v)
-						}
-						data = map[string]interface{}{}
-						s.DownloadDetailPage(param, data)
-						if len(data) > 0 {
-							tr.dataInfo = data
-						}
-						if len(data) == 0 || data["detail"].(string) == "" {
-							steps[3] = false
-						} else {
-							steps[3] = true
-						}
-					}
+		steps[2] = true        //列表页获取成功
+		steps[8] = downloadNum //下载量
+		tr.listInfo = result
+		if s.DownDetail {
+			onePageList := result[1] //第一页数据
+			if onePageDataNum := len(onePageList); onePageDataNum > 0 {
+				index := onePageDataNum / 2 //取一条数据下载三级页
+				param := map[string]string{}
+				for k, v := range onePageList[index] {
+					param[k] = qu.ObjToString(v)
+				}
+				data = map[string]interface{}{}
+				s.DownloadDetailPage(param, data)
+				tr.dataInfo = data
+				if len(data) == 0 || qu.ObjToString(data["detail"]) == "" {
+					steps[3] = false //详情页获取失败
 				} else {
-					steps[3] = true
+					steps[3] = true //详情页获取成功
 				}
 			}
+		} else {
+			steps[3] = true //详情页获取成功
 		}
+		//list, _ = s.DownListPageItem()
+		//for _, l := range list {
+		//	if publishtime := qu.ObjToString(l["publishtime"]); publishtime == "0" || publishtime == "" {
+		//		msgArr = append(msgArr, "列表页publishtime取值异常")
+		//		break
+		//	} else {
+		//		t, err := time.ParseInLocation(qu.Date_Full_Layout, publishtime, time.Local)
+		//		if err != nil || t.Unix() <= 0 {
+		//			msgArr = append(msgArr, "列表页publishtime取值异常")
+		//			break
+		//		}
+		//	}
+		//}
+		//if len(list) > 0 {
+		//	tr.listInfo = list
+		//	listone := list[0]
+		//	if len(qu.ObjToString(listone["href"])) < 7 ||
+		//		(qu.ObjToString(listone["publishtime"]) != "0" && len(qu.ObjToString(listone["publishtime"])) < 5) ||
+		//		len(qu.ObjToString(listone["title"])) < 3 {
+		//		f.ServeJson(steps)
+		//		return
+		//	} else {
+		//		steps[2] = true
+		//		if s.DownDetail {
+		//			param := map[string]string{}
+		//			index := 0
+		//			if len(list) > 0 {
+		//				steps[8] = len(list)
+		//				index = len(list) / 2
+		//				for k, v := range list[index] {
+		//					param[k] = qu.ObjToString(v)
+		//				}
+		//				data = map[string]interface{}{}
+		//				s.DownloadDetailPage(param, data)
+		//				if len(data) > 0 {
+		//					tr.dataInfo = data
+		//				}
+		//				if len(data) == 0 || data["detail"].(string) == "" {
+		//					steps[3] = false
+		//				} else {
+		//					steps[3] = true
+		//				}
+		//			}
+		//		} else {
+		//			steps[3] = true
+		//		}
+		//	}
+		//}
 	}
 	//关闭laustate
 	s.L.Close()
@@ -852,7 +897,7 @@ func (f *Front) SpiderPass() {
 	steps[6] = s.Test_goreqlist
 	steps[7] = s.Test_goreqcon
 	//校验
-	msg := u.SpiderPassCheckListAndDetail(list, data)
+	msg := u.SpiderPassCheckListAndDetail(result, data)
 	msgArr = append(msgArr, msg...)
 	username := f.GetSession("username").(string)
 	tr.msg = strings.Join(msgArr, ";")

+ 7 - 0
src/front/spider2.go

@@ -33,3 +33,10 @@ func (f *Front) TagCode() {
 	util.MgoEB.Update("luaconfig", map[string]interface{}{"code": code}, update, false, false)
 	f.Write("y")
 }
+
+// SpiderCloseErr
+func (f *Front) SpiderCloseErr() {
+	defer qu.Catch()
+	ok := util.MgoS.Del("spider_loadfail", nil)
+	f.ServeJson(map[string]interface{}{"ok": ok})
+}

+ 35 - 36
src/main_test.go

@@ -4,7 +4,6 @@ package main
 import (
 	"github.com/lauyoume/gopinyin"
 	"log"
-	"spider"
 	"testing"
 )
 
@@ -149,38 +148,38 @@ func Test_getFirstName(t *testing.T) {
 	log.Println(str)
 }
 
-func TestCheck(t *testing.T) {
-	steps := make([]bool, 3)
-	s := spider.CreateSpider(spider.GetScript("zgwlzbw_zbgg"))
-	s.SpiderMaxPage = 1
-	time, timeerr := s.GetLastPublishTime()
-	if timeerr != nil || len(time) < 5 {
-		steps[0] = false
-		return
-	} else {
-		list, listerr := s.DownListPageItem()
-		if listerr != nil || len(list) == 0 {
-			steps[0] = false
-		} else {
-			steps[0] = true
-			listone := list[0]
-			if len(listone["href"].(string)) < 7 || len(listone["publishtime"].(string)) < 5 || len(listone["title"].(string)) < 10 {
-				steps[1] = false
-			} else {
-				steps[1] = true
-				param := map[string]string{}
-				param["title"] = list[0]["title"].(string)
-				param["href"] = list[0]["href"].(string)
-				param["publishtime"] = list[0]["publishtime"].(string)
-				data := map[string]interface{}{}
-				s.DownloadDetailPage(param, data)
-				if len(data) == 0 || len(data["detail"].(string)) < 50 {
-					steps[2] = false
-				} else {
-					steps[2] = true
-				}
-			}
-		}
-	}
-
-}
+//func TestCheck(t *testing.T) {
+//	steps := make([]bool, 3)
+//	s := spider.CreateSpider(spider.GetScript("zgwlzbw_zbgg"))
+//	s.SpiderMaxPage = 1
+//	time, timeerr := s.GetLastPublishTime()
+//	if timeerr != nil || len(time) < 5 {
+//		steps[0] = false
+//		return
+//	} else {
+//		list, _, listerr := s.DownListPageItem()
+//		if listerr != nil || len(list) == 0 {
+//			steps[0] = false
+//		} else {
+//			steps[0] = true
+//			listone := list[0]
+//			if len(listone["href"].(string)) < 7 || len(listone["publishtime"].(string)) < 5 || len(listone["title"].(string)) < 10 {
+//				steps[1] = false
+//			} else {
+//				steps[1] = true
+//				param := map[string]string{}
+//				param["title"] = list[0]["title"].(string)
+//				param["href"] = list[0]["href"].(string)
+//				param["publishtime"] = list[0]["publishtime"].(string)
+//				data := map[string]interface{}{}
+//				s.DownloadDetailPage(param, data)
+//				if len(data) == 0 || len(data["detail"].(string)) < 50 {
+//					steps[2] = false
+//				} else {
+//					steps[2] = true
+//				}
+//			}
+//		}
+//	}
+//
+//}

+ 16 - 2
src/spider/script.go

@@ -162,9 +162,23 @@ func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
 	}))
 	//推送列表页下载数据量
 	s.L.SetGlobal("sendListNum", s.L.NewFunction(func(S *lua.LState) int {
+		pageno := S.ToInt(-3) //当前页
+		index := S.ToInt(-2)  //第几条数据
 		table := S.ToTable(-1)
-		list := util.TableToMap(table)
-		qu.Debug(len(list))
+		qu.Debug(s.SCode, index, table.Len())
+		if index == 1 {
+			if pageno == 1 { //第一页数据
+				oneMap := util.TableToMap(table)
+				text, _ := json.Marshal(oneMap)
+				hashText := util.HexTextByte(text)
+				qu.Debug("第一页:", hashText)
+			} else if pageno == 2 { //第一页数据
+				twoMap := util.TableToMap(table)
+				text, _ := json.Marshal(twoMap)
+				hashText := util.HexTextByte(text)
+				qu.Debug("第二页:", hashText)
+			}
+		}
 		return 1
 	}))
 	s.L.SetGlobal("findMap", s.L.NewFunction(func(S *lua.LState) int {

+ 6 - 2
src/spider/spider.go

@@ -83,9 +83,10 @@ func (s *Spider) GetLastPublishTimeTest() (timestr interface{}, errs interface{}
 }
 
 //下载列表
-func (s *Spider) DownListPageItem() (list []map[string]interface{}, errs interface{}) {
+func (s *Spider) DownListPageItem() (result map[int64][]map[string]interface{}, num int, errs interface{}) {
 	defer mu.Catch()
 	s.Test_goreqlist++
+	result = map[int64][]map[string]interface{}{}
 	for ; s.SpiderStartPage <= s.SpiderMaxPage && !s.ExecuteOk; s.SpiderStartPage++ {
 		if err := s.L.CallByParam(lua.P{
 			Fn:      s.L.GetGlobal("downloadAndParseListPage"),
@@ -96,6 +97,7 @@ func (s *Spider) DownListPageItem() (list []map[string]interface{}, errs interfa
 		}
 		lv := s.L.Get(-1)
 		s.L.Pop(1)
+		list := []map[string]interface{}{}
 		if tbl, ok := lv.(*lua.LTable); ok {
 			for i := 1; i <= tbl.Len(); i++ {
 				v := tbl.RawGetInt(i).(*lua.LTable)
@@ -103,11 +105,13 @@ func (s *Spider) DownListPageItem() (list []map[string]interface{}, errs interfa
 				if qu.ObjToString(tmp["exit"]) == "true" {
 					break
 				}
+				num++
 				list = append(list, util.GetTable(v))
 			}
 		}
+		result[s.SpiderStartPage] = list
 	}
-	return list, errs
+	return result, num, errs
 }
 
 //下载列表

+ 62 - 1
src/util/util.go

@@ -183,7 +183,68 @@ func SpiderPassCheckLua(liststr, contentstr string, lua map[string]interface{})
 }
 
 //爬虫整体测试时校验列表页和详情页内容
-func SpiderPassCheckListAndDetail(list []map[string]interface{}, data map[string]interface{}) (msg []string) {
+func SpiderPassCheckListAndDetail(result map[int64][]map[string]interface{}, data map[string]interface{}) (msg []string) {
+	msgMap := map[string]bool{}
+	//校验列表页信息
+	for _, list := range result {
+		for _, l := range list {
+			//校验title
+			title := qu.ObjToString(l["title"])
+			if !TitleFilterReg1.MatchString(title) {
+				msgMap["列表页title中无汉字"] = true
+			} else if TitleFilterReg2.MatchString(title) {
+				msgMap["列表页title中含有上(下)一页"] = true
+			}
+			//校验发布时间
+			publishtime := qu.ObjToString(l["publishtime"])
+			if publishtime == "0" || publishtime == "" {
+				msgMap["列表页publishtime取值异常"] = true
+			} else {
+				t, err := time.ParseInLocation(qu.Date_Full_Layout, publishtime, time.Local)
+				if err != nil || t.Unix() <= 0 {
+					msgMap["列表页publishtime取值异常"] = true
+				}
+			}
+		}
+	}
+	if len(data) > 0 {
+		//校验publishtime
+		if l_np_publishtime, ok := data["l_np_publishtime"].(lua.LNumber); ok {
+			if l_np_publishtime <= 0 || l_np_publishtime > 0 && l_np_publishtime < 1000000000 {
+				msgMap["三级页publishtime取值异常"] = true
+			}
+		} else if l_np_publishtime, ok := data["l_np_publishtime"].(int64); ok {
+			if l_np_publishtime <= 0 || l_np_publishtime > 0 && l_np_publishtime < 1000000000 {
+				msgMap["三级页publishtime取值异常"] = true
+			}
+		} else {
+			msgMap["三级页publishtime值类型异常"] = true
+		}
+		contenthtml := qu.ObjToString(data["contenthtml"])
+		if strings.Contains(contenthtml, "img") {
+			msgMap["contenthtml中含有img是否下载"] = true
+		}
+		detail := qu.ObjToString(data["detail"])
+		if TitleFilterReg2.MatchString(detail) {
+			msgMap["三级页正文提取异常"] = true
+		}
+		//校验jsondata
+		if jsondata, ok := data["jsondata"].(map[string]interface{}); ok && len(jsondata) > 0 {
+			for field, _ := range jsondata {
+				if !JsonDataMap[field] {
+					msgMap["jsondata中"+field+"属性错误"] = true
+				}
+			}
+		}
+	}
+	for text, _ := range msgMap {
+		msg = append(msg, text)
+	}
+	return
+}
+
+//爬虫整体测试时校验列表页和详情页内容
+func SpiderPassCheckListAndDetail_back(list []map[string]interface{}, data map[string]interface{}) (msg []string) {
 	if len(list) > 0 {
 		p_zero := 0
 		h_flag := true

+ 18 - 4
src/web/templates/errlualist.html

@@ -6,7 +6,8 @@
 		   <h1>
 		     错误爬虫列表
 		     <small>
-			   </small>
+				 <button class="btn btn-primary btn-sm" onclick="closeAllErr()">一键清除</button>
+			 </small>
 		   </h1>
         <!--时间-->
 		   <ol class="breadcrumb">
@@ -129,9 +130,22 @@
 			})
     });
   };
-  function updatefinish(){
-    
-  }
+	function closeAllErr() {
+		showConfirm("确定清除所有信息?", function() {
+			$.ajax({
+				url: "/center/spider/closeerr",
+				type: "post",
+				success:function(r){
+					if(r&&r.ok){
+						showTip("删除成功", 1000);
+						errluatable.ajax.reload();
+					}else{
+						showTip("删除失败", 2000);
+					}
+				}
+			})
+		})
+	}
 </script>
 </div>
 {{include "bottom.html"}}

+ 30 - 21
src/web/templates/jsonInfo.html

@@ -11,8 +11,15 @@
 							<h3 class="box-title">列表页Json</h3> &nbsp&nbsp&nbsp
 							<span id="jsonLen"></span>
 						</div>
-						<div class="box-body json-style" style="height:200px">
-							<textarea id="listJson" style="height:100%;width:100%"></textarea>
+						<div class="box-body json-style" style="height:245px;display: flex;justify-content: space-between;">
+							<div style="height:100%;width:49%">
+								<h5 id="firDataNum"></h5>
+								<textarea id="listJson_pageone" style="height:190px;width:100%"></textarea>
+							</div>
+							<div style="height:100%;width:49%;float: right">
+								<h5 id="secDataNum"></h5>
+								<textarea id="listJson_pagetwo" style="height:190px;width:100%"></textarea>
+							</div>
 						</div>
 					</div>
 				</form>		
@@ -27,11 +34,11 @@
 						<div class="box-header with-border">
 							<i class="fa fa-tag"></i>
 							<h3 class="box-title">三级页Json</h3>
-              <a id="ahref" target="_blank"></a>
+							<a id="ahref" target="_blank"></a>
 						</div>
 						<div class="box-body json-style" style="height:200px">
 							<textarea id="mapJson" style="height:100%;width:100%"></textarea>
-						</div>	
+						</div>
 					</div>
 				
 				</form>	
@@ -70,31 +77,33 @@
 </div>
 <script  src="/js/jsonformat.js"></script>
 <script>
-	var list = {{.T.list}};
+	var list_fir = {{.T.list_fir}};
+	var list_sec = {{.T.list_sec}};
+	$("#firDataNum").text("第一页,共"+list_fir.length+"条");
+	$("#secDataNum").text("第二页,共"+list_sec.length+"条");
 	var map = {{.T.data}};
-  if(map != null && map.href!=null){
-    var href = map.href;
-    $("#ahref").attr("href",href);
-    if(href.length>100){
-      href = href.slice(0,100)+"..."
-    }
-    $("#ahref").text(href);
-  }
+	if(map != null && map.href!=null){
+		var href = map.href;
+		$("#ahref").attr("href",href);
+		if(href.length>100){
+		  href = href.slice(0,100)+"..."
+		}
+		$("#ahref").text(href);
+	}
 	var descript = {{.T.descript}};
 	var remark = {{.T.remark}};
 	var rateremark = {{.T.rateremark}};
 	var reason = {{.T.reason}}
 	$(function(){
-		if(list != null){
-			var len = list.length;
-			$("#jsonLen").text("共"+len+"条")
-		}
-		
-		var listJson = JSON.stringify(list);
+		$("#jsonLen").text("共"+{{.T.num}}+"条")
+		var listFirJson = JSON.stringify(list_fir);
+		var listSecJson = JSON.stringify(list_sec);
 		var mapJson = JSON.stringify(map);
-		var jsonListInfo = getFormatData(listJson);
+		var jsonFirInfo = getFormatData(listFirJson);
+		var jsonSecInfo = getFormatData(listSecJson);
 		var jsonMapInfo = getFormatData(mapJson);
-		$("#listJson").text(jsonListInfo);
+		$("#listJson_pageone").text(jsonFirInfo);
+		$("#listJson_pagetwo").text(jsonSecInfo);
 		$("#mapJson").text(jsonMapInfo);
 		$("#descriptJson").val(descript);
 		$("#remarkJson").val(remark);

+ 3 - 3
src/web/templates/luamovelist.html

@@ -90,7 +90,7 @@
 				{"data": "code",render:function(val,a,row){
 					return "<input type='checkbox' ismove='"+row.ismove+"' state='"+row.state+"' code='"+row.code+"' movevent='"+row.toevent+"'/>"
 				}},
-	      		{"data": "site",width:"200px"},
+	      		{"data": "site"},
 				{"data": "channel",render:function (val,a,row){
 					return "<a href='"+row.href+"' title='"+val+"' target='_blank'>"+val+"</a>"
 				}},
@@ -275,10 +275,10 @@
 			  type: "post",
 			  success:function(r){
 				  if(r&&r.ok){
-					  showTip("更新成功", 1000);
+					  showTip("删除成功", 1000);
 					  luamovecodetable.ajax.reload();
 				  }else{
-					  showTip("更新失败", 2000);
+					  showTip("删除失败", 2000);
 				  }
 			  }
 		  })