瀏覽代碼

新增补采模块

mxs 1 年之前
父節點
當前提交
e6d3a037ce

+ 54 - 328
src/front/front.go

@@ -12,7 +12,6 @@ import (
 	"mongodb"
 	"os"
 	qu "qfw/util"
-	"qfw/util/redis"
 	"regexp"
 	"sort"
 	"spider"
@@ -27,24 +26,24 @@ import (
 
 type Front struct {
 	*xweb.Action
-	login           xweb.Mapper `xweb:"/"`
-	logout          xweb.Mapper `xweb:"/center/logout"`                 //退出
-	loadIndex       xweb.Mapper `xweb:"/center"`                        //控制中心
-	spidernew       xweb.Mapper `xweb:"/center/spider"`                 //爬虫新建
-	reg             xweb.Mapper `xweb:"/center/reg"`                    //爬虫注册
-	assign          xweb.Mapper `xweb:"/center/user/assign"`            //分配爬虫
-	auditExport     xweb.Mapper `xweb:"/center/user/auditexport"`       //导出审核日志
-	loadSpider      xweb.Mapper `xweb:"/center/spider/edit/(.*)"`       //爬虫加载
-	viewSpider      xweb.Mapper `xweb:"/center/spider/view/(.*)"`       //爬虫查看
-	downSpider      xweb.Mapper `xweb:"/center/spider/download/(.*)"`   //爬虫下载
-	upState         xweb.Mapper `xweb:"/center/spider/upstate"`         //爬虫状态更新
-	assort          xweb.Mapper `xweb:"/center/spider/assort"`          //审核人员分类(无发布、需登录、无法处理、需删除)
-	batchShelves    xweb.Mapper `xweb:"/center/spider/batchShelves"`    //批量上下架
-	checktime       xweb.Mapper `xweb:"/center/spider/checktime"`       //爬虫核对
-	disables        xweb.Mapper `xweb:"/center/spider/disable"`         //批量作废
-	changeEvent     xweb.Mapper `xweb:"/center/changeEvent"`            //节点更新
-	getJson         xweb.Mapper `xweb:"/center/spider/json"`            //
-	delRedis        xweb.Mapper `xweb:"/center/spider/delRedis"`        //清理Redis
+	login        xweb.Mapper `xweb:"/"`
+	logout       xweb.Mapper `xweb:"/center/logout"`               //退出
+	loadIndex    xweb.Mapper `xweb:"/center"`                      //控制中心
+	spidernew    xweb.Mapper `xweb:"/center/spider"`               //爬虫新建
+	reg          xweb.Mapper `xweb:"/center/reg"`                  //爬虫注册
+	assign       xweb.Mapper `xweb:"/center/user/assign"`          //分配爬虫
+	auditExport  xweb.Mapper `xweb:"/center/user/auditexport"`     //导出审核日志
+	loadSpider   xweb.Mapper `xweb:"/center/spider/edit/(.*)"`     //爬虫加载
+	viewSpider   xweb.Mapper `xweb:"/center/spider/view/(.*)"`     //爬虫查看
+	downSpider   xweb.Mapper `xweb:"/center/spider/download/(.*)"` //爬虫下载
+	upState      xweb.Mapper `xweb:"/center/spider/upstate"`       //爬虫状态更新
+	assort       xweb.Mapper `xweb:"/center/spider/assort"`        //审核人员分类(无发布、需登录、无法处理、需删除)
+	batchShelves xweb.Mapper `xweb:"/center/spider/batchShelves"`  //批量上下架
+	checktime    xweb.Mapper `xweb:"/center/spider/checktime"`     //爬虫核对
+	disables     xweb.Mapper `xweb:"/center/spider/disable"`       //批量作废
+	changeEvent  xweb.Mapper `xweb:"/center/changeEvent"`          //节点更新
+	getJson      xweb.Mapper `xweb:"/center/spider/json"`          //
+	//delRedis        xweb.Mapper `xweb:"/center/spider/delRedis"`        //清理Redis
 	updateESP       xweb.Mapper `xweb:"/center/spider/updateesp"`       //修改爬虫的节点/状态/平台
 	updatePendState xweb.Mapper `xweb:"/center/spider/updatePendState"` //更新爬虫挂起状态
 	tagCode         xweb.Mapper `xweb:"/center/spider/tagcode"`         //标记爬虫
@@ -84,6 +83,9 @@ type Front struct {
 	saveNewUser   xweb.Mapper `xweb:"/center/user/saveNewUser"`   //添加用户
 
 	getCity xweb.Mapper `xweb:"/center/getCity"` //获取城市
+
+	//补采信息
+	supplementList xweb.Mapper `xweb:"/center/supplement/list"` //脚本管理
 }
 
 const Sp_state_0, Sp_state_1, Sp_state_2, Sp_state_3, Sp_state_4, Sp_state_5, Sp_state_6, Sp_state_7, Sp_state_8, Sp_state_9, Sp_state_10 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 //0待完成,1待审核,2打回,3发布,4作废,5已上架,6已下架,7无发布,8需登录,9转python,10已删除
@@ -98,282 +100,6 @@ var ListFilterReg = regexp.MustCompile("关键词过滤")
 var ProjectHrefReg = regexp.MustCompile("projecthref")
 var Transfercode map[string]interface{}
 
-func (f *Front) Login() error {
-	username := f.GetString("username")
-	password := f.GetString("password")
-	f.SetSession("password", password)
-	password = util.Se.EncodeString(password)
-	query := map[string]interface{}{
-		"s_name": username,
-		"s_pass": password,
-	}
-	user, _ := u.MgoEB.FindOne("user", query)
-	if user != nil && len(*user) > 0 && qu.IntAll((*user)["i_delete"]) == 0 {
-		f.SetSession("userid", mongodb.BsonIdToSId((*user)["_id"]))
-		f.SetSession("username", (*user)["s_fullname"])
-		f.SetSession("loginuser", (*user)["s_name"])
-		f.SetSession("email", (*user)["s_email"])
-		f.SetSession("auth", (*user)["i_auth"])
-		f.SetSession("platform", (*user)["s_platform"])
-		f.SetSession("identity", (*user)["i_identity"])
-		comeintime := time.Unix((*user)["l_comeintime"].(int64), 0).Format("2006-01-02")
-		f.SetSession("comeintime", comeintime)
-		if qu.IntAll((*user)["i_auth"]) > u.Role_Admin {
-			return f.Redirect("/center/user.html")
-		} else if qu.IntAll((*user)["i_auth"]) == u.Role_Dev {
-			return f.Redirect("/center/mytask")
-		} else {
-			return f.Redirect("/center")
-		}
-	} else {
-		if username != "" {
-			f.T["fail"] = "fail"
-		}
-		return f.Render("login.html", &f.T)
-	}
-}
-
-// 用户管理
-func (f *Front) User() {
-	if f.Method() == "POST" {
-		auth := qu.IntAll(f.GetSession("auth"))
-		if auth > u.Role_Admin {
-			start, _ := f.GetInteger("start")
-			limit, _ := f.GetInteger("length")
-			draw, _ := f.GetInteger("draw")
-			platform := f.GetString("s_platform")
-			identity, _ := f.GetInteger("i_identity")
-			userauth, _ := f.GetInteger("i_auth")
-			searchStr := f.GetString("search[value]")
-			search := strings.TrimSpace(searchStr)
-			query := map[string]interface{}{
-				"i_delete": 0, //可用用户
-				"i_auth": map[string]interface{}{
-					"$lt": 4,
-				},
-			}
-			if platform != "-1" {
-				query["s_platform"] = platform
-			}
-			if identity != -1 {
-				query["i_identity"] = identity
-			}
-			if userauth != -1 {
-				query["i_auth"] = userauth
-			}
-			if search != "" {
-				query["$or"] = []interface{}{
-					map[string]interface{}{"s_name": map[string]interface{}{"$regex": search}},
-					map[string]interface{}{"s_fullname": map[string]interface{}{"$regex": search}},
-				}
-			}
-			sort := `{"%s":%d}`
-			orderIndex := f.GetString("order[0][column]")
-			orderName := f.GetString(fmt.Sprintf("columns[%s][data]", orderIndex))
-			orderType := 1
-			if f.GetString("order[0][dir]") != "desc" {
-				orderType = -1
-			}
-			sort = fmt.Sprintf(sort, orderName, orderType)
-			qu.Debug(query, sort)
-			user, _ := u.MgoEB.Find("user", query, sort, nil, false, start, limit)
-			count := u.MgoEB.Count("user", query)
-			page := start / 10
-			for k, v := range *user {
-				v["num"] = k + 1 + page*10
-				v["s_pass"] = util.Se.DecodeString(v["s_pass"].(string))
-			}
-			f.ServeJson(map[string]interface{}{
-				"draw":            draw,
-				"data":            user,
-				"recordsFiltered": count,
-				"recordsTotal":    count,
-			})
-		}
-	} else {
-		f.Render("user.html")
-	}
-
-}
-
-// 删除用户
-func (f *Front) DelUser() {
-	userid := f.GetString("userid")
-	auth := qu.IntAll(f.GetSession("auth"))
-	if auth > u.Role_Admin {
-		query := map[string]interface{}{
-			"_id": mongodb.StringTOBsonId(userid),
-		}
-
-		update := map[string]interface{}{
-			"$set": map[string]interface{}{
-				"i_delete": 1,
-			},
-		}
-		ok := u.MgoEB.Update("user", query, update, false, false)
-		if ok {
-			f.ServeJson(map[string]interface{}{
-				"status": "y",
-			})
-		} else {
-			f.ServeJson(map[string]interface{}{
-				"status": "n",
-			})
-		}
-	} else {
-		f.ServeJson(map[string]interface{}{
-			"status": "e",
-		})
-	}
-}
-
-// 修改用户
-func (f *Front) UpdateUser() {
-	//	username := f.GetString("username")
-	password := f.GetString("password")
-	userid := f.GetString("userid")
-	f.SetSession("password", password)
-	userAuth := f.GetString("userAuth")
-	auth := qu.IntAll(f.GetSession("auth"))
-	self := f.GetString("self")
-	identity, _ := f.GetInteger("identity")
-	platform := f.GetString("platform")
-	//log.Println("userid----:", userid, "platform----:", platform, "identity----:", identity, "password----:", password, "auth----:", auth, "self----:", self)
-	query := map[string]interface{}{
-		"_id": mongodb.StringTOBsonId(userid),
-	}
-	update := map[string]interface{}{}
-	if "y" == self { //修改个人信息 只修改个人密码
-		password = util.Se.EncodeString(password)
-		update["s_pass"] = password
-	} else if "y" != self && auth == 4 { //修改他人信息
-		update["i_identity"] = identity
-		update["s_platform"] = platform
-		if userAuth == "开发员" {
-			update["i_auth"] = 1
-		} else if userAuth == "审核员" {
-			update["i_auth"] = 2
-		} else if userAuth == "管理员" {
-			update["i_auth"] = 3
-		}
-	} else {
-		f.ServeJson("没有权限!")
-		return
-	}
-	ok := u.MgoEB.Update("user", query, map[string]interface{}{"$set": update}, false, false)
-	if ok {
-		f.ServeJson(map[string]interface{}{
-			"status": "y",
-		})
-	} else {
-		f.ServeJson(map[string]interface{}{
-			"status": "n",
-		})
-	}
-}
-
-func (f *Front) CheckUsenamer() {
-	username := f.GetString("username")
-	if username != "" {
-		query := map[string]interface{}{
-			"s_name": username,
-		}
-		user, _ := u.MgoEB.FindOne("user", query)
-		if user != nil && len(*user) > 0 {
-			f.ServeJson(map[string]interface{}{
-				"status": "hasUser",
-			})
-		} else {
-			f.ServeJson(map[string]interface{}{
-				"status": "notHasUser",
-			})
-		}
-	}
-
-}
-
-func (f *Front) CheckEmail() {
-	email := f.GetString("email")
-	//校验邮箱
-	if email != "" {
-		query := map[string]interface{}{
-			"s_email": email,
-		}
-		user, _ := u.MgoEB.FindOne("user", query)
-		if user != nil && len(*user) > 0 {
-			f.ServeJson(map[string]interface{}{
-				"status": "hasEmail",
-			})
-		} else {
-			f.ServeJson(map[string]interface{}{
-				"status": "notHasEmail",
-			})
-		}
-	}
-}
-
-// 新增用户
-func (f *Front) SaveNewUser() {
-	auth := qu.IntAll(f.GetSession("auth"))
-	if auth != 4 {
-		f.ServeJson("没有权限!")
-		return
-	} else {
-		i_auth := 1
-		username := f.GetString("username")
-		password := f.GetString("password")
-		relname := f.GetString("relname")
-		password = util.Se.EncodeString(password)
-		email := f.GetString("email")
-		userAuth := f.GetString("userAuth")
-		platform := f.GetString("platform")
-		identity, _ := f.GetInteger("identity")
-		if userAuth == "开发员" {
-			i_auth = 1
-		} else if userAuth == "审核员" {
-			i_auth = 2
-		} else {
-			i_auth = 3
-		}
-		time := time.Now().Unix()
-		save := map[string]interface{}{
-			"s_name":       username,
-			"s_fullname":   relname,
-			"s_email":      email,
-			"s_pass":       password,
-			"i_auth":       i_auth,
-			"i_delete":     0,
-			"l_comeintime": time,
-			"i_identity":   identity,
-			"i_scope":      -1,
-			"s_platform":   platform,
-		}
-		ok := u.MgoEB.Save("user", save)
-		if ok != "" {
-			f.ServeJson(map[string]interface{}{
-				"status": "y",
-			})
-		} else {
-			f.ServeJson(map[string]interface{}{
-				"status": "n",
-			})
-		}
-	}
-
-}
-
-func (f *Front) Logout() {
-	email := f.GetSession("email").(string)
-	f.DelSession("username")
-	f.DelSession("userid")
-	f.DelSession("email")
-	f.DelSession("user")
-	f.DelSession("loginuser")
-	f.DelSession("auth")
-	delete(SessMap, email)
-	f.Redirect("/center")
-}
-
 // 控制中心
 func (f *Front) LoadIndex() {
 	auth := qu.IntAll(f.GetSession("auth"))
@@ -1054,39 +780,6 @@ func editModify(codesarr []string, userid, name string) {
 	qu.Debug("任务重新分配成功", b)
 }
 
-// 清理Redis
-func (f *Front) DelRedis() {
-	hrefs := f.GetString("href")
-	hrefsarr := strings.Split(hrefs, ",")
-	auth := qu.IntAll(f.GetSession("auth"))
-	err := []string{}
-	if auth == u.Role_Admin { //权限控制
-		if len(hrefsarr) > 0 {
-			for k1, h := range hrefsarr {
-				href := Reg.FindString(h)
-				if href != "" {
-					href = "url_repeat_" + href + "*"
-					res := redis.GetKeysByPattern("title_repeat_judgement", href)
-					if res != nil {
-						for _, v := range res {
-							hf := string(v.([]uint8))
-							b := redis.Del("title_repeat_judgement", hf)
-							if !b {
-								err = append(err, "第"+strconv.Itoa(k1+1)+"个")
-							}
-						}
-					}
-				} else {
-					err = append(err, "第"+strconv.Itoa(k1+1)+"个")
-				}
-			}
-		}
-	} else {
-		err = append(err, "没有权限")
-	}
-	f.ServeJson(err)
-}
-
 func (f *Front) UpdatePendState() {
 	success := false
 	pendstate, _ := f.GetInteger("pendstate")
@@ -1347,3 +1040,36 @@ func (f *Front) SpiderSplitCopy() {
 	}
 	f.ServeJson(map[string]interface{}{"text": text})
 }
+
+/*// 清理Redis
+func (f *Front) DelRedis() {
+	hrefs := f.GetString("href")
+	hrefsarr := strings.Split(hrefs, ",")
+	auth := qu.IntAll(f.GetSession("auth"))
+	err := []string{}
+	if auth == u.Role_Admin { //权限控制
+		if len(hrefsarr) > 0 {
+			for k1, h := range hrefsarr {
+				href := Reg.FindString(h)
+				if href != "" {
+					href = "url_repeat_" + href + "*"
+					res := redis.GetKeysByPattern("title_repeat_judgement", href)
+					if res != nil {
+						for _, v := range res {
+							hf := string(v.([]uint8))
+							b := redis.Del("title_repeat_judgement", hf)
+							if !b {
+								err = append(err, "第"+strconv.Itoa(k1+1)+"个")
+							}
+						}
+					}
+				} else {
+					err = append(err, "第"+strconv.Itoa(k1+1)+"个")
+				}
+			}
+		}
+	} else {
+		err = append(err, "没有权限")
+	}
+	f.ServeJson(err)
+}*/

+ 105 - 0
src/front/heart.go

@@ -0,0 +1,105 @@
+package front
+
+import (
+	"fmt"
+	qu "qfw/util"
+	"sort"
+	sp "spiderutil"
+	"strings"
+	u "util"
+)
+
+// 心跳监控
+func (f *Front) Heart() {
+	if f.Method() == "POST" {
+		event, _ := f.GetInteger("event")
+		start, _ := f.GetInteger("start")
+		limit, _ := f.GetInteger("length")
+		draw, _ := f.GetInteger("draw")
+		searchStr := f.GetString("search[value]")
+		search := strings.TrimSpace(searchStr) //只能搜索code
+		//qu.Debug("search:", search, "start:", start, "limit:", limit, "draw:", draw)
+		query := map[string]interface{}{
+			"del": false,
+		}
+		if event > -1 {
+			query["event"] = event
+		}
+		if search != "" {
+			query["code"] = search
+		}
+		sort := `{"%s":%d}`
+		orderIndex := f.GetString("order[0][column]")
+		orderName := f.GetString(fmt.Sprintf("columns[%s][data]", orderIndex))
+		orderType := 1
+		if f.GetString("order[0][dir]") != "asc" {
+			orderType = -1
+		}
+		sort = fmt.Sprintf(sort, orderName, orderType)
+		qu.Debug("query:", query, "sort:", sort)
+		list, _ := u.MgoS.Find("spider_heart", query, sort, nil, false, start, limit)
+		count := u.MgoS.Count("spider_heart", query)
+		for _, l := range *list {
+			code := qu.ObjToString(l["code"])
+			qu.Debug(code)
+			//d, _ := u.MgoE.FindOneByField("luaconfig", map[string]interface{}{"code": code}, map[string]interface{}{"state": 1, "param_common": 1, "str_list": 1, "type_list": 1})
+			d, _ := u.MgoEB.FindOneByField("luaconfig", map[string]interface{}{"code": code}, map[string]interface{}{"state": 1, "param_common": 1, "str_list": 1, "type_list": 1, "pendtime": 1})
+			l["state"] = (*d)["state"]
+			l["param_common"] = (*d)["param_common"]
+			if ft := qu.Int64All(l["firstpage"]); ft != 0 {
+				l["firstpage"] = qu.FormatDateByInt64(&ft, qu.Date_Full_Layout)
+			} else {
+				l["firstpage"] = 0
+			}
+			if lt := qu.Int64All(l["list"]); lt != 0 {
+				l["list"] = qu.FormatDateByInt64(&lt, qu.Date_Full_Layout)
+			} else {
+				l["list"] = 0
+			}
+			if dt := qu.Int64All(l["detail"]); dt != 0 {
+				l["detail"] = qu.FormatDateByInt64(&dt, qu.Date_Full_Layout)
+			} else {
+				l["detail"] = 0
+			}
+			if det := qu.Int64All(l["detailexecute"]); det != 0 {
+				l["detailexecute"] = qu.FormatDateByInt64(&det, qu.Date_Full_Layout)
+			} else {
+				l["detailexecute"] = 0
+			}
+			if ft := qu.Int64All(l["findlist"]); ft != 0 {
+				l["findlist"] = qu.FormatDateByInt64(&ft, qu.Date_Full_Layout)
+			} else {
+				l["findlist"] = 0
+			}
+			ut := qu.Int64All(l["updatetime"])
+			l["updatetime"] = qu.FormatDateByInt64(&ut, qu.Date_Full_Layout)
+			pendtime := qu.Int64All((*d)["pendtime"])
+			if pendtime != 0 {
+				l["pendtime"] = qu.FormatDateByInt64(&pendtime, qu.Date_Full_Layout)
+			} else {
+				l["pendtime"] = "0"
+			}
+			//l["isfindlist"] = "否"
+			//typeList := qu.IntAll((*d)["type_list"])
+			//strList := qu.ObjToString((*d)["str_list"])
+			//if typeList == 1 && strings.Contains(strList, "findListHtml") {
+			//	l["isfindlist"] = "是"
+			//}
+		}
+
+		f.ServeJson(map[string]interface{}{"draw": draw, "data": list, "recordsFiltered": count, "recordsTotal": count})
+	} else {
+		events := []string{}
+		for k, _ := range sp.Config.Uploadevents {
+			events = append(events, k)
+		}
+		sort.Strings(events)
+		f.T["events"] = events
+		f.Render("heart.html", &f.T)
+	}
+}
+
+// 下架删除心跳
+func DelSpiderHeart(code string) bool {
+	return u.MgoS.Update("spider_heart", map[string]interface{}{"code": code}, map[string]interface{}{"$set": map[string]interface{}{"del": true}}, false, true)
+}

+ 64 - 0
src/front/http.go

@@ -0,0 +1,64 @@
+package front
+
+import (
+	"encoding/json"
+	"fmt"
+	"log"
+	qu "qfw/util"
+	sp "spiderutil"
+)
+
+// 爬虫信息
+type spinfo struct {
+	code                                   string
+	todayDowncount, toDayRequestNum        int
+	yesterdayDowncount, yestoDayRequestNum int
+	totalDowncount, totalRequestNum        int
+	errorNum, roundCount, runRate          int
+	lastDowncount                          int
+	lastHeartbeat                          string
+	lstate                                 string
+}
+
+// 爬虫信息
+func SpiderInfo(data string) {
+	data = sp.Se.DecodeString(data)
+	infos := []map[string]interface{}{}
+	err := json.Unmarshal([]byte(data), &infos)
+	if err != nil {
+		return
+	}
+	for _, tmp := range infos {
+		lastHeartbeat := qu.Int64All(tmp["lastHeartbeat"])
+		info := &spinfo{
+			code:               fmt.Sprint(tmp["code"]),
+			todayDowncount:     qu.IntAll(tmp["todayDowncount"]),
+			toDayRequestNum:    qu.IntAll(tmp["toDayRequestNum"]),
+			yesterdayDowncount: qu.IntAll(tmp["yesterdayDowncount"]),
+			yestoDayRequestNum: qu.IntAll(tmp["yestoDayRequestNum"]),
+			totalDowncount:     qu.IntAll(tmp["totalDowncount"]),
+			totalRequestNum:    qu.IntAll(tmp["totalRequestNum"]),
+			errorNum:           qu.IntAll(tmp["errorNum"]),
+			roundCount:         qu.IntAll(tmp["roundCount"]),
+			runRate:            qu.IntAll(tmp["runRate"]),
+			lastHeartbeat:      qu.FormatDateByInt64(&lastHeartbeat, qu.Date_Full_Layout),
+			lastDowncount:      qu.IntAll(tmp["lastDowncount"]),
+			lstate:             fmt.Sprint(tmp["lstate"]),
+		}
+		spinfos.Store(info.code, info)
+		//log.Println(info)
+	}
+}
+
+// 接受维护任务信息
+func SpiderModifyTask(data string) {
+	data = sp.Se.DecodeString(data)
+	mtasks := []map[string]interface{}{}
+	err := json.Unmarshal([]byte(data), &mtasks)
+	if err != nil {
+		return
+	}
+	for k, tmp := range mtasks {
+		log.Println(k, tmp)
+	}
+}

+ 0 - 150
src/front/spider.go

@@ -1229,11 +1229,6 @@ func (f *Front) DownSpider(code string) {
 	u.MgoEB.Save("luadownlogs", downlogs)
 }
 
-// 下架删除心跳
-func DelSpiderHeart(code string) bool {
-	return u.MgoS.Update("spider_heart", map[string]interface{}{"code": code}, map[string]interface{}{"$set": map[string]interface{}{"del": true}}, false, true)
-}
-
 //下架删除download数据
 //func delDownloadData(code string) bool {
 //	return mgu.Del("download", "spider", "spider", `{"code":"`+code+`"}`)
@@ -1891,151 +1886,6 @@ func (f *Front) LuaList() {
 	}
 }
 
-// 心跳监控
-func (f *Front) Heart() {
-	if f.Method() == "POST" {
-		event, _ := f.GetInteger("event")
-		start, _ := f.GetInteger("start")
-		limit, _ := f.GetInteger("length")
-		draw, _ := f.GetInteger("draw")
-		searchStr := f.GetString("search[value]")
-		search := strings.TrimSpace(searchStr) //只能搜索code
-		//qu.Debug("search:", search, "start:", start, "limit:", limit, "draw:", draw)
-		query := map[string]interface{}{
-			"del": false,
-		}
-		if event > -1 {
-			query["event"] = event
-		}
-		if search != "" {
-			query["code"] = search
-		}
-		sort := `{"%s":%d}`
-		orderIndex := f.GetString("order[0][column]")
-		orderName := f.GetString(fmt.Sprintf("columns[%s][data]", orderIndex))
-		orderType := 1
-		if f.GetString("order[0][dir]") != "asc" {
-			orderType = -1
-		}
-		sort = fmt.Sprintf(sort, orderName, orderType)
-		qu.Debug("query:", query, "sort:", sort)
-		list, _ := u.MgoS.Find("spider_heart", query, sort, nil, false, start, limit)
-		count := u.MgoS.Count("spider_heart", query)
-		for _, l := range *list {
-			code := qu.ObjToString(l["code"])
-			qu.Debug(code)
-			//d, _ := u.MgoE.FindOneByField("luaconfig", map[string]interface{}{"code": code}, map[string]interface{}{"state": 1, "param_common": 1, "str_list": 1, "type_list": 1})
-			d, _ := u.MgoEB.FindOneByField("luaconfig", map[string]interface{}{"code": code}, map[string]interface{}{"state": 1, "param_common": 1, "str_list": 1, "type_list": 1, "pendtime": 1})
-			l["state"] = (*d)["state"]
-			l["param_common"] = (*d)["param_common"]
-			if ft := qu.Int64All(l["firstpage"]); ft != 0 {
-				l["firstpage"] = qu.FormatDateByInt64(&ft, qu.Date_Full_Layout)
-			} else {
-				l["firstpage"] = 0
-			}
-			if lt := qu.Int64All(l["list"]); lt != 0 {
-				l["list"] = qu.FormatDateByInt64(&lt, qu.Date_Full_Layout)
-			} else {
-				l["list"] = 0
-			}
-			if dt := qu.Int64All(l["detail"]); dt != 0 {
-				l["detail"] = qu.FormatDateByInt64(&dt, qu.Date_Full_Layout)
-			} else {
-				l["detail"] = 0
-			}
-			if det := qu.Int64All(l["detailexecute"]); det != 0 {
-				l["detailexecute"] = qu.FormatDateByInt64(&det, qu.Date_Full_Layout)
-			} else {
-				l["detailexecute"] = 0
-			}
-			if ft := qu.Int64All(l["findlist"]); ft != 0 {
-				l["findlist"] = qu.FormatDateByInt64(&ft, qu.Date_Full_Layout)
-			} else {
-				l["findlist"] = 0
-			}
-			ut := qu.Int64All(l["updatetime"])
-			l["updatetime"] = qu.FormatDateByInt64(&ut, qu.Date_Full_Layout)
-			pendtime := qu.Int64All((*d)["pendtime"])
-			if pendtime != 0 {
-				l["pendtime"] = qu.FormatDateByInt64(&pendtime, qu.Date_Full_Layout)
-			} else {
-				l["pendtime"] = "0"
-			}
-			//l["isfindlist"] = "否"
-			//typeList := qu.IntAll((*d)["type_list"])
-			//strList := qu.ObjToString((*d)["str_list"])
-			//if typeList == 1 && strings.Contains(strList, "findListHtml") {
-			//	l["isfindlist"] = "是"
-			//}
-		}
-
-		f.ServeJson(map[string]interface{}{"draw": draw, "data": list, "recordsFiltered": count, "recordsTotal": count})
-	} else {
-		events := []string{}
-		for k, _ := range sp.Config.Uploadevents {
-			events = append(events, k)
-		}
-		sort.Strings(events)
-		f.T["events"] = events
-		f.Render("heart.html", &f.T)
-	}
-}
-
-// 爬虫信息
-type spinfo struct {
-	code                                   string
-	todayDowncount, toDayRequestNum        int
-	yesterdayDowncount, yestoDayRequestNum int
-	totalDowncount, totalRequestNum        int
-	errorNum, roundCount, runRate          int
-	lastDowncount                          int
-	lastHeartbeat                          string
-	lstate                                 string
-}
-
-// 爬虫信息
-func SpiderInfo(data string) {
-	data = sp.Se.DecodeString(data)
-	infos := []map[string]interface{}{}
-	err := json.Unmarshal([]byte(data), &infos)
-	if err != nil {
-		return
-	}
-	for _, tmp := range infos {
-		lastHeartbeat := qu.Int64All(tmp["lastHeartbeat"])
-		info := &spinfo{
-			code:               fmt.Sprint(tmp["code"]),
-			todayDowncount:     qu.IntAll(tmp["todayDowncount"]),
-			toDayRequestNum:    qu.IntAll(tmp["toDayRequestNum"]),
-			yesterdayDowncount: qu.IntAll(tmp["yesterdayDowncount"]),
-			yestoDayRequestNum: qu.IntAll(tmp["yestoDayRequestNum"]),
-			totalDowncount:     qu.IntAll(tmp["totalDowncount"]),
-			totalRequestNum:    qu.IntAll(tmp["totalRequestNum"]),
-			errorNum:           qu.IntAll(tmp["errorNum"]),
-			roundCount:         qu.IntAll(tmp["roundCount"]),
-			runRate:            qu.IntAll(tmp["runRate"]),
-			lastHeartbeat:      qu.FormatDateByInt64(&lastHeartbeat, qu.Date_Full_Layout),
-			lastDowncount:      qu.IntAll(tmp["lastDowncount"]),
-			lstate:             fmt.Sprint(tmp["lstate"]),
-		}
-		spinfos.Store(info.code, info)
-		//log.Println(info)
-	}
-}
-
-// 接受维护任务信息
-func SpiderModifyTask(data string) {
-	data = sp.Se.DecodeString(data)
-	mtasks := []map[string]interface{}{}
-	err := json.Unmarshal([]byte(data), &mtasks)
-	if err != nil {
-		return
-	}
-	for k, tmp := range mtasks {
-		log.Println(k, tmp)
-	}
-}
-
 // 查看是否有该任务
 func checkTask(codes []string, num int) []string {
 	//	var id string = ""

+ 50 - 0
src/front/supplement.go

@@ -0,0 +1,50 @@
+package front
+
+import (
+	"fmt"
+	qu "qfw/util"
+	"strings"
+	u "util"
+)
+
+func (f *Front) SupplementList() {
+	auth := qu.IntAll(f.GetSession("auth"))
+	if auth != u.Role_Admin {
+		f.ServeJson("没有权限!")
+		return
+	}
+	if f.Method() == "POST" {
+		start, _ := f.GetInteger("start")
+		limit, _ := f.GetInteger("length")
+		draw, _ := f.GetInteger("draw")
+		searchStr := f.GetString("search[value]") //搜索内容
+		search := strings.TrimSpace(searchStr)
+		starttime, _ := f.GetInt("starttime") //当天凌晨时间
+		query := map[string]interface{}{
+			"comeintime": map[string]interface{}{
+				"$gte": starttime,
+				"$lte": starttime + 12*3600,
+			},
+		}
+		if search != "" {
+			query["$or"] = []interface{}{
+				map[string]interface{}{"spidercode": map[string]interface{}{"$regex": search}},
+				map[string]interface{}{"channel": map[string]interface{}{"$regex": search}},
+			}
+		}
+		sort := `{"%s":%d}`
+		orderIndex := f.GetString("order[0][column]")
+		orderName := f.GetString(fmt.Sprintf("columns[%s][data]", orderIndex))
+		orderType := 1
+		if f.GetString("order[0][dir]") != "asc" {
+			orderType = -1
+		}
+		sort = fmt.Sprintf(sort, orderName, orderType)
+		qu.Debug("supplement query:", query)
+		count := u.MgoS.Count("spider_supplement", query)
+		list, _ := u.MgoS.Find("spider_supplement", query, sort, nil, false, start, limit)
+		f.ServeJson(map[string]interface{}{"draw": draw, "data": list, "recordsFiltered": count, "recordsTotal": count})
+	} else {
+		f.Render("supplement.html", &f.T)
+	}
+}

+ 287 - 0
src/front/user.go

@@ -0,0 +1,287 @@
+package front
+
+import (
+	"fmt"
+	"mongodb"
+	qu "qfw/util"
+	util "spiderutil"
+	"strings"
+	"time"
+	u "util"
+)
+
+func (f *Front) Login() error {
+	username := f.GetString("username")
+	password := f.GetString("password")
+	f.SetSession("password", password)
+	password = util.Se.EncodeString(password)
+	query := map[string]interface{}{
+		"s_name": username,
+		"s_pass": password,
+	}
+	user, _ := u.MgoEB.FindOne("user", query)
+	if user != nil && len(*user) > 0 && qu.IntAll((*user)["i_delete"]) == 0 {
+		f.SetSession("userid", mongodb.BsonIdToSId((*user)["_id"]))
+		f.SetSession("username", (*user)["s_fullname"])
+		f.SetSession("loginuser", (*user)["s_name"])
+		f.SetSession("email", (*user)["s_email"])
+		f.SetSession("auth", (*user)["i_auth"])
+		f.SetSession("platform", (*user)["s_platform"])
+		f.SetSession("identity", (*user)["i_identity"])
+		comeintime := time.Unix((*user)["l_comeintime"].(int64), 0).Format("2006-01-02")
+		f.SetSession("comeintime", comeintime)
+		if qu.IntAll((*user)["i_auth"]) > u.Role_Admin {
+			return f.Redirect("/center/user.html")
+		} else if qu.IntAll((*user)["i_auth"]) == u.Role_Dev {
+			return f.Redirect("/center/mytask")
+		} else {
+			return f.Redirect("/center")
+		}
+	} else {
+		if username != "" {
+			f.T["fail"] = "fail"
+		}
+		return f.Render("login.html", &f.T)
+	}
+}
+
+// 用户管理
+func (f *Front) User() {
+	if f.Method() == "POST" {
+		auth := qu.IntAll(f.GetSession("auth"))
+		if auth > u.Role_Admin {
+			start, _ := f.GetInteger("start")
+			limit, _ := f.GetInteger("length")
+			draw, _ := f.GetInteger("draw")
+			platform := f.GetString("s_platform")
+			identity, _ := f.GetInteger("i_identity")
+			userauth, _ := f.GetInteger("i_auth")
+			searchStr := f.GetString("search[value]")
+			search := strings.TrimSpace(searchStr)
+			query := map[string]interface{}{
+				"i_delete": 0, //可用用户
+				"i_auth": map[string]interface{}{
+					"$lt": 4,
+				},
+			}
+			if platform != "-1" {
+				query["s_platform"] = platform
+			}
+			if identity != -1 {
+				query["i_identity"] = identity
+			}
+			if userauth != -1 {
+				query["i_auth"] = userauth
+			}
+			if search != "" {
+				query["$or"] = []interface{}{
+					map[string]interface{}{"s_name": map[string]interface{}{"$regex": search}},
+					map[string]interface{}{"s_fullname": map[string]interface{}{"$regex": search}},
+				}
+			}
+			sort := `{"%s":%d}`
+			orderIndex := f.GetString("order[0][column]")
+			orderName := f.GetString(fmt.Sprintf("columns[%s][data]", orderIndex))
+			orderType := 1
+			if f.GetString("order[0][dir]") != "desc" {
+				orderType = -1
+			}
+			sort = fmt.Sprintf(sort, orderName, orderType)
+			qu.Debug(query, sort)
+			user, _ := u.MgoEB.Find("user", query, sort, nil, false, start, limit)
+			count := u.MgoEB.Count("user", query)
+			page := start / 10
+			for k, v := range *user {
+				v["num"] = k + 1 + page*10
+				v["s_pass"] = util.Se.DecodeString(v["s_pass"].(string))
+			}
+			f.ServeJson(map[string]interface{}{
+				"draw":            draw,
+				"data":            user,
+				"recordsFiltered": count,
+				"recordsTotal":    count,
+			})
+		}
+	} else {
+		f.Render("user.html")
+	}
+
+}
+
+// 删除用户
+func (f *Front) DelUser() {
+	userid := f.GetString("userid")
+	auth := qu.IntAll(f.GetSession("auth"))
+	if auth > u.Role_Admin {
+		query := map[string]interface{}{
+			"_id": mongodb.StringTOBsonId(userid),
+		}
+
+		update := map[string]interface{}{
+			"$set": map[string]interface{}{
+				"i_delete": 1,
+			},
+		}
+		ok := u.MgoEB.Update("user", query, update, false, false)
+		if ok {
+			f.ServeJson(map[string]interface{}{
+				"status": "y",
+			})
+		} else {
+			f.ServeJson(map[string]interface{}{
+				"status": "n",
+			})
+		}
+	} else {
+		f.ServeJson(map[string]interface{}{
+			"status": "e",
+		})
+	}
+}
+
+// 修改用户
+func (f *Front) UpdateUser() {
+	//	username := f.GetString("username")
+	password := f.GetString("password")
+	userid := f.GetString("userid")
+	f.SetSession("password", password)
+	userAuth := f.GetString("userAuth")
+	auth := qu.IntAll(f.GetSession("auth"))
+	self := f.GetString("self")
+	identity, _ := f.GetInteger("identity")
+	platform := f.GetString("platform")
+	//log.Println("userid----:", userid, "platform----:", platform, "identity----:", identity, "password----:", password, "auth----:", auth, "self----:", self)
+	query := map[string]interface{}{
+		"_id": mongodb.StringTOBsonId(userid),
+	}
+	update := map[string]interface{}{}
+	if "y" == self { //修改个人信息 只修改个人密码
+		password = util.Se.EncodeString(password)
+		update["s_pass"] = password
+	} else if "y" != self && auth == 4 { //修改他人信息
+		update["i_identity"] = identity
+		update["s_platform"] = platform
+		if userAuth == "开发员" {
+			update["i_auth"] = 1
+		} else if userAuth == "审核员" {
+			update["i_auth"] = 2
+		} else if userAuth == "管理员" {
+			update["i_auth"] = 3
+		}
+	} else {
+		f.ServeJson("没有权限!")
+		return
+	}
+	ok := u.MgoEB.Update("user", query, map[string]interface{}{"$set": update}, false, false)
+	if ok {
+		f.ServeJson(map[string]interface{}{
+			"status": "y",
+		})
+	} else {
+		f.ServeJson(map[string]interface{}{
+			"status": "n",
+		})
+	}
+}
+
+func (f *Front) CheckUsenamer() {
+	username := f.GetString("username")
+	if username != "" {
+		query := map[string]interface{}{
+			"s_name": username,
+		}
+		user, _ := u.MgoEB.FindOne("user", query)
+		if user != nil && len(*user) > 0 {
+			f.ServeJson(map[string]interface{}{
+				"status": "hasUser",
+			})
+		} else {
+			f.ServeJson(map[string]interface{}{
+				"status": "notHasUser",
+			})
+		}
+	}
+
+}
+
+func (f *Front) CheckEmail() {
+	email := f.GetString("email")
+	//校验邮箱
+	if email != "" {
+		query := map[string]interface{}{
+			"s_email": email,
+		}
+		user, _ := u.MgoEB.FindOne("user", query)
+		if user != nil && len(*user) > 0 {
+			f.ServeJson(map[string]interface{}{
+				"status": "hasEmail",
+			})
+		} else {
+			f.ServeJson(map[string]interface{}{
+				"status": "notHasEmail",
+			})
+		}
+	}
+}
+
+// 新增用户
+func (f *Front) SaveNewUser() {
+	auth := qu.IntAll(f.GetSession("auth"))
+	if auth != 4 {
+		f.ServeJson("没有权限!")
+		return
+	} else {
+		i_auth := 1
+		username := f.GetString("username")
+		password := f.GetString("password")
+		relname := f.GetString("relname")
+		password = util.Se.EncodeString(password)
+		email := f.GetString("email")
+		userAuth := f.GetString("userAuth")
+		platform := f.GetString("platform")
+		identity, _ := f.GetInteger("identity")
+		if userAuth == "开发员" {
+			i_auth = 1
+		} else if userAuth == "审核员" {
+			i_auth = 2
+		} else {
+			i_auth = 3
+		}
+		time := time.Now().Unix()
+		save := map[string]interface{}{
+			"s_name":       username,
+			"s_fullname":   relname,
+			"s_email":      email,
+			"s_pass":       password,
+			"i_auth":       i_auth,
+			"i_delete":     0,
+			"l_comeintime": time,
+			"i_identity":   identity,
+			"i_scope":      -1,
+			"s_platform":   platform,
+		}
+		ok := u.MgoEB.Save("user", save)
+		if ok != "" {
+			f.ServeJson(map[string]interface{}{
+				"status": "y",
+			})
+		} else {
+			f.ServeJson(map[string]interface{}{
+				"status": "n",
+			})
+		}
+	}
+
+}
+
+func (f *Front) Logout() {
+	email := f.GetSession("email").(string)
+	f.DelSession("username")
+	f.DelSession("userid")
+	f.DelSession("email")
+	f.DelSession("user")
+	f.DelSession("loginuser")
+	f.DelSession("auth")
+	delete(SessMap, email)
+	f.Redirect("/center")
+}

File diff suppressed because it is too large
+ 6 - 0
src/web/staticres/datepicker/bootstrap-datepicker.min.css


File diff suppressed because it is too large
+ 6 - 0
src/web/staticres/datepicker/bootstrap-datepicker.min.js


+ 1 - 0
src/web/staticres/datepicker/bootstrap-datepicker.zh-CN.min.js

@@ -0,0 +1 @@
+!function(a){a.fn.datepicker.dates["zh-CN"]={days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],daysShort:["周日","周一","周二","周三","周四","周五","周六"],daysMin:["日","一","二","三","四","五","六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今天",monthsTitle:"选择月份",clear:"清除",format:"yyyy-mm-dd",titleFormat:"yyyy年mm月",weekStart:1}}(jQuery);

+ 9 - 4
src/web/templates/head.html

@@ -24,9 +24,10 @@
 	<link rel="stylesheet"  href="/codemirror/theme/solarized.css">
 	<link rel="stylesheet"  href="/codemirror/theme/abcdef.css">
 	<link rel="stylesheet" href="/codemirror/theme/the-matrix.css">
-  <link rel="stylesheet" href="/time/css/wui.min.css">
-  <link rel="stylesheet" href="/time/css/style.css">
+    <link rel="stylesheet" href="/time/css/wui.min.css">
+    <link rel="stylesheet" href="/time/css/style.css">
 	<link rel="stylesheet"  href="/css/otherStyle.css">
+	<link rel="stylesheet" href="/datepicker/bootstrap-datepicker.min.css">
 
 	<script src="/plugins/jQuery/jquery-2.2.3.min.js"></script>
 	<script src="/js/common.js"></script>
@@ -36,6 +37,8 @@
 	<script src="/js/model.js"></script>
 	<script src="/js/head.js"></script>
 	<script src="/js/xm-select.js"></script>
+	<script src="/datepicker/bootstrap-datepicker.min.js"></script>
+	<script src="/datepicker/bootstrap-datepicker.zh-CN.min.js"></script>
 	<style>
 		#spiderremark-input{
 			width: 1000px;
@@ -616,7 +619,10 @@
 			<li data="index_fbgl"><a href="/center/lualist.html"><i class="glyphicon glyphicon-credit-card"></i> <span>运行监控中心</span></a></li>
 		    <li data="index_pcdr"><a href="/center/importdata"><i class="glyphicon glyphicon-import"></i> <span>爬虫导入</span></a></li>
 		    <li data="index_pcqy"><a href="/center/luamove"><i class="glyphicon glyphicon-move"></i> <span>爬虫迁移管理</span></a></li>
-		  <li data="index_newrwgl"><a href="/center/newtask/tasklist"><i class="glyphicon glyphicon glyphicon-tasks"></i> <span>新版任务管理</span></a></li>
+<!--		    <li data="index_newrwgl"><a href="/center/newtask/tasklist"><i class="glyphicon glyphicon glyphicon-tasks"></i> <span>新版任务管理</span></a></li>-->
+			{{if eq (session "identity") 1}}
+			<li data="index_bcgl"><a href="/center/supplement/list"><i class="glyphicon glyphicon-list-alt"></i> <span>补采管理</span></a></li>
+			{{end}}
 		{{else if eq (session "auth") 2}}
 			<li data="index"><a href="/center"><i class="glyphicon glyphicon-eye-open"></i> <span>爬虫审核</span></a></li>
 			<li data="index_rwsh"><a href="/center/task/audit"><i class="glyphicon glyphicon glyphicon-tasks"></i> <span>任务审核</span></a></li>
@@ -624,7 +630,6 @@
 			<li data="index"><a href="/center"><i class="glyphicon glyphicon-eye-open"></i> <span>爬虫列表</span></a></li>
 			<li data="index_rwlb"><a href="/center/mytask"><i class="glyphicon glyphicon-tasks"></i> <span>任务列表</span></a></li>
 		{{end}}
-
 		{{if eq (session "platform") "golua平台"}}
 		  {{if eq (session "identity") 1}}
 		  <li data="index_heart"><a href="/center/heart"><i class="fa fa-heartbeat"></i> <span>心跳监控</span></a></li>

+ 131 - 0
src/web/templates/supplement.html

@@ -0,0 +1,131 @@
+{{include "head.html"}}
+<div class="content-wrapper">
+    <section class="content-header">
+        <h1>
+            补采列表
+            <small>
+            </small>
+        </h1>
+        <ol class="breadcrumb">
+            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
+            <li class="active">列表</li>
+        </ol>
+    </section>
+    <section class="content">
+        <div class="box">
+            <!-- /.box-header -->
+            <div class="box-body">
+                <table id="supplement" class="table table-bordered table-striped">
+                    <thead>
+                    <tr>
+                        <th>爬虫</th>
+                        <th>网站</th>
+                        <th>栏目</th>
+                        <th>作者</th>
+                        <th>补采量</th>
+                        <th>成功量</th>
+                        <th>失败量</th>
+                        <th>时间异常量</th>
+                    </tr>
+                    </thead>
+                </table>
+            </div>
+            <!-- /.box-body -->
+        </div>
+    </section>
+    <script>
+        $(function(){
+            ttable=$('#supplement').DataTable({
+                "language": {
+                    "url": "/js/dataTables.chinese.lang"
+                },
+                "columnDefs": [
+                    { "orderable": false, "targets": [0,1,2] },
+                ],
+                "order": [[4,"desc"]],
+                "processing": true,
+                "serverSide": true,
+                "searching": true,
+                "ordering": true,
+                "info": true,
+                "autoWidth": true,
+                "ajax": {
+                    "url": "/center/supplement/list",
+                    "type": "POST"
+                },
+                "columns": [
+                    { "data": "spidercode"},
+                    { "data": "site"},
+                    { "data": "channel"},
+                    { "data": "modifyuser"},
+                    { "data": "savenum"},
+                    { "data": "success"},
+                    { "data": "failed"},
+                    { "data": "ptimezeronum"}
+                ],
+                "fnDrawCallback": function(table) {
+                    $("ul.pagination").prepend("&nbsp;&nbsp;&nbsp;转到第 <input type='text' id='changePage'   style='width:20px;'> 页    <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
+                    $('#dataTable-btn').click(function(e) {
+                        var redirectpage=0;
+                        if($("#changePage").val() && $("#changePage").val() > 0) {
+                            var redirectpage = $("#changePage").val() - 1;
+                        }
+                        ttable.page(redirectpage).draw(false);
+                    });
+                },
+                "fnServerParams": function (e) {
+                    if($('#starttime').length !=0){
+                        var st = $('#starttime').datepicker('getDate')
+                        if (st != null) {
+                            var s = st.toLocaleDateString()
+                            var sc = Date.parse(new Date(s).toString())/1000
+                            e.starttime = sc - 2*3600;
+                        }
+                    }else{
+                        var nst = Date.parse(new Date().toLocaleDateString())/1000;
+                        e.starttime = nst - 2*3600;
+                    }
+                    // console.log(e.starttime)
+                }
+            });
+            ttable.on('init.dt', function () {
+                var selectTime = "<div style='margin-top: -4px'><label for='name'>时间:</label>"+
+                    "<span class='input-group date date-picker' id='starttime' data-provide='datepicker'>"+
+                    "<input type='text' class='form-control form-filter input-sm' readonly name='starttime' placeholder='开始日期' />"+
+                    "<span class='input-group-addon'>"+
+                    "<i class='fa fa-calendar'></i>"+
+                    "</span>"+
+                    "</span>"+
+                    "</div>&nbsp;"
+                $("#supplement_filter").prepend(selectTime);
+                $("#supplement_filter").prepend("&nbsp;");
+                // $("#spiderwarn_length").parent().css("width", "10%")
+                $("#supplement_filter").css({"display": "flex","text-align": "right","align-items": "center","justify-content": "flex-end"})
+
+                $('.date-picker').datepicker({
+                    language: 'zh-CN',
+                    autoclose: true,
+                    clearBtn: true, //清除按钮
+                    todayBtn: false, //今日按钮
+                    format: "yyyy-mm-dd"
+                });
+                $('#starttime').datepicker('setDate',new Date().toLocaleDateString());//设置初始时间
+                $('#starttime').datepicker().on('changeDate', function (e) {
+                    ttable.ajax.reload();
+                });
+            });
+            //发送到服务器的数据先进行处理
+            // ttable.on('preXhr.dt', function ( e, settings, data ) {
+            //     var request = {};
+            //     var search = data.search.value;//搜索框值
+            //     var starttime = data.starttime;//时间
+            //     request["search"] = search;
+            //     request["starttime"] = starttime;
+            //     setCookie("request",JSON.stringify(request));
+            //      console.log("1",getCookie("request"))
+            // })
+            common.setActive("index_fbgl");
+        })
+    </script>
+</div>
+{{include "bottom.html"}}

Some files were not shown because too many files changed in this diff