|
@@ -18,9 +18,9 @@ import (
|
|
"net/http"
|
|
"net/http"
|
|
"net/url"
|
|
"net/url"
|
|
qu "qfw/util"
|
|
qu "qfw/util"
|
|
- "qfw/util/elastic"
|
|
|
|
"qfw/util/redis"
|
|
"qfw/util/redis"
|
|
"regexp"
|
|
"regexp"
|
|
|
|
+ "spiderutil"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
@@ -154,14 +154,16 @@ func (jy *RepairRule) RepairNewSave() {
|
|
// 保存服务
|
|
// 保存服务
|
|
href := qu.ObjToString((*updata)["href"])
|
|
href := qu.ObjToString((*updata)["href"])
|
|
//db := HexToBigIntMod(href)
|
|
//db := HexToBigIntMod(href)
|
|
- hashHref := HexText(href)
|
|
|
|
- shaid := Sha(detail)
|
|
|
|
|
|
+ //hashHref := HexText(href)
|
|
|
|
+ //shaid := Sha(detail)
|
|
if !strings.Contains(href, "https://www.jianyu360.cn/") {
|
|
if !strings.Contains(href, "https://www.jianyu360.cn/") {
|
|
// 剑鱼链接 不需要存redis
|
|
// 剑鱼链接 不需要存redis
|
|
//PutRedis("title_repeat_fulljudgement", db, hashHref, mongodb.BsonIdToSId((*updata)["_id"]), -1) // 全量redis
|
|
//PutRedis("title_repeat_fulljudgement", db, hashHref, mongodb.BsonIdToSId((*updata)["_id"]), -1) // 全量redis
|
|
- RedisClusterPut(RedisCluster, context.TODO(), hashHref, "", -1) // 全量redis
|
|
|
|
|
|
+ //RedisClusterPut(RedisCluster, context.TODO(), hashHref, "", -1) // 全量redis
|
|
|
|
+ _, _ = spiderutil.AddBloomRedis("href", href)
|
|
}
|
|
}
|
|
- RedisClusterPut(RedisCluster, context.TODO(), shaid, "", 365*86400) // 增量reids
|
|
|
|
|
|
+ //RedisClusterPut(RedisCluster, context.TODO(), shaid, "", 365*86400) // 增量reids
|
|
|
|
+ _, _ = spiderutil.AddBloomRedis("detail", spiderutil.FilterDetail(detail))
|
|
//PutRedis("title_repeat_listpagehref", 0, href, "", 3600*24*30*24) // 列表页增量redis
|
|
//PutRedis("title_repeat_listpagehref", 0, href, "", 3600*24*30*24) // 列表页增量redis
|
|
if b {
|
|
if b {
|
|
log.Println("当前新增id:", mongodb.BsonIdToSId((*updata)["_id"]))
|
|
log.Println("当前新增id:", mongodb.BsonIdToSId((*updata)["_id"]))
|
|
@@ -272,17 +274,17 @@ func (jy *RepairRule) RepairPub() {
|
|
// 保存服务
|
|
// 保存服务
|
|
href := qu.ObjToString(save["href"])
|
|
href := qu.ObjToString(save["href"])
|
|
//db := HexToBigIntMod(href)
|
|
//db := HexToBigIntMod(href)
|
|
- hashHref := HexText(href)
|
|
|
|
- shaid := Sha(qu.ObjToString(save["detail"]))
|
|
|
|
|
|
+ //hashHref := HexText(href)
|
|
|
|
+ //shaid := Sha(qu.ObjToString(save["detail"]))
|
|
if !strings.Contains(href, "https://www.jianyu360.cn/") {
|
|
if !strings.Contains(href, "https://www.jianyu360.cn/") {
|
|
// 剑鱼链接 不需要存redis
|
|
// 剑鱼链接 不需要存redis
|
|
//PutRedis("title_repeat_fulljudgement", db, hashHref, mongodb.BsonIdToSId(save["_id"]), -1)
|
|
//PutRedis("title_repeat_fulljudgement", db, hashHref, mongodb.BsonIdToSId(save["_id"]), -1)
|
|
- r := RedisClusterPut(RedisCluster, context.TODO(), hashHref, "", -1)
|
|
|
|
- qu.Debug(r.String())
|
|
|
|
|
|
+ //r := RedisClusterPut(RedisCluster, context.TODO(), hashHref, "", -1)
|
|
|
|
+ _, _ = spiderutil.AddBloomRedis("href", href)
|
|
|
|
|
|
}
|
|
}
|
|
- r := RedisClusterPut(RedisCluster, context.TODO(), shaid, "", 365*86400)
|
|
|
|
- qu.Debug(r.String())
|
|
|
|
|
|
+ //r := RedisClusterPut(RedisCluster, context.TODO(), shaid, "", 365*86400)
|
|
|
|
+ _, _ = spiderutil.AddBloomRedis("detail", spiderutil.FilterDetail(qu.ObjToString(save["detail"])))
|
|
log.Println("当前新增id:", mongodb.BsonIdToSId(save["_id"]))
|
|
log.Println("当前新增id:", mongodb.BsonIdToSId(save["_id"]))
|
|
//日志记录
|
|
//日志记录
|
|
user := jy.GetSession("user").(map[string]interface{})
|
|
user := jy.GetSession("user").(map[string]interface{})
|
|
@@ -1177,7 +1179,7 @@ func (jy *RepairRule) EsCount() {
|
|
value := jy.GetString("data")
|
|
value := jy.GetString("data")
|
|
field := jy.GetString("field")
|
|
field := jy.GetString("field")
|
|
esquery := `{"query":{"bool":{"must":[{"term":{"` + field + `":"` + value + `"}}]}}}`
|
|
esquery := `{"query":{"bool":{"must":[{"term":{"` + field + `":"` + value + `"}}]}}}`
|
|
- count := elastic.Count(EsIndex, EsType, esquery)
|
|
|
|
|
|
+ count := JyEs.Count(EsIndex, EsType, esquery)
|
|
jy.ServeJson(map[string]interface{}{
|
|
jy.ServeJson(map[string]interface{}{
|
|
"rep": true,
|
|
"rep": true,
|
|
"count": count,
|
|
"count": count,
|
|
@@ -1190,7 +1192,7 @@ func (jy *RepairRule) EsDelBy() {
|
|
field := jy.GetString("field")
|
|
field := jy.GetString("field")
|
|
count, _ := jy.GetInt("count")
|
|
count, _ := jy.GetInt("count")
|
|
esquery := `{"query":{"bool":{"must":[{"term":{"` + field + `":"` + value + `"}}]}}}`
|
|
esquery := `{"query":{"bool":{"must":[{"term":{"` + field + `":"` + value + `"}}]}}}`
|
|
- bol := elastic.Del(EsIndex, EsType, esquery)
|
|
|
|
|
|
+ bol := JyEs.Del(EsIndex, EsType, esquery)
|
|
Mgo.Save("jy_es_del_log", bson.M{"type": field, "value": value, "count": count, "createtime": time.Now().Unix()})
|
|
Mgo.Save("jy_es_del_log", bson.M{"type": field, "value": value, "count": count, "createtime": time.Now().Unix()})
|
|
jy.ServeJson(map[string]interface{}{
|
|
jy.ServeJson(map[string]interface{}{
|
|
"rep": bol,
|
|
"rep": bol,
|