浏览代码

爬虫迁移提醒修改

maxiaoshan 2 年之前
父节点
当前提交
4044b722a1
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 7 0
      src/timetask/timetask.go
  2. 1 0
      src/util/util.go

+ 7 - 0
src/timetask/timetask.go

@@ -133,9 +133,14 @@ func CheckLuaMove() {
 	list, _ := util.MgoEB.Find("luamovelog", query, nil, nil, false, -1, -1)
 	if len(*list) > 0 {
 		codes := []string{}
+		arr := [][]map[string]interface{}{}
 		for _, l := range *list {
 			code := qu.ObjToString(l["code"])
 			codes = append(codes, code)
+			update := []map[string]interface{}{}
+			update = append(update, map[string]interface{}{"_id": l["_id"]})
+			update = append(update, map[string]interface{}{"$set": map[string]interface{}{"ok": true, "updatetime": time.Now().Unix()}})
+			arr = append(arr, update)
 		}
 		for i := 1; i <= 3; i++ {
 			res, err := http.Get(fmt.Sprintf("%s?to=%s&title=%s&body=%s", sp.Config.JkMail["api"], sp.Config.JkMail["to"], "lua-move-fail", strings.Join(codes, ";")))
@@ -146,6 +151,8 @@ func CheckLuaMove() {
 				break
 			}
 		}
+		util.MgoEB.UpdateBulk("luamovelog", arr...)
+		arr = [][]map[string]interface{}{}
 	}
 }
 

+ 1 - 0
src/util/util.go

@@ -80,6 +80,7 @@ var (
 		"subtype":            true,
 		"winnerorder":        true,
 		"bidopendate":        true,
+		"bidtype":            true,
 	}
 	Bu = "_bu" //创建采历史爬虫后缀
 )