|
@@ -99,11 +99,13 @@ func main() {
|
|
|
// dealInc 处理增量数据
|
|
|
func dealInc() {
|
|
|
now := time.Now()
|
|
|
- yesterday := time.Date(now.Year(), now.Month(), now.Day()+GF.Env.Days, 0, 0, 0, 0, now.Location())
|
|
|
+ start := time.Date(now.Year(), now.Month(), now.Day()+GF.Env.Start, 0, 0, 0, 0, now.Location())
|
|
|
+ end := time.Date(now.Year(), now.Month(), now.Day()+GF.Env.End, 0, 0, 0, 0, now.Location())
|
|
|
|
|
|
where := map[string]interface{}{
|
|
|
"comeintime": map[string]interface{}{
|
|
|
- "$gte": yesterday.Unix(),
|
|
|
+ "$gte": start.Unix(),
|
|
|
+ "$lt": end.Unix(),
|
|
|
},
|
|
|
}
|
|
|
dealTopInformation(where, timeTypeInc)
|
|
@@ -113,7 +115,8 @@ func dealInc() {
|
|
|
func dealAll() {
|
|
|
where := map[string]interface{}{
|
|
|
"comeintime": map[string]interface{}{
|
|
|
- "$gte": 1638288000, //2021-12-01
|
|
|
+ "$gte": 1718812800, //2021-06-20
|
|
|
+ "$lt": 1721664000, //2021-07-23
|
|
|
},
|
|
|
}
|
|
|
|
|
@@ -168,6 +171,7 @@ func dealTopInformation(where interface{}, timeType int) {
|
|
|
|
|
|
// 有匹配新的标签,需要更新MongoDB以及ES 数据
|
|
|
if hasNew {
|
|
|
+ topinformation = removeDuplicates(topinformation) //去重
|
|
|
//ToDo 1.更新MongoDB
|
|
|
biddingID := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
updateData := map[string]interface{}{
|
|
@@ -189,11 +193,11 @@ func dealTopInformation(where interface{}, timeType int) {
|
|
|
}
|
|
|
|
|
|
err := Esa.UpdateDocument("bidding", biddingID, updateData)
|
|
|
- if err != nil {
|
|
|
+ if err != nil && err.Error() != "Document not updated: noop" {
|
|
|
log.Println("esa update err", biddingID, err)
|
|
|
}
|
|
|
err = Esb.UpdateDocument("bidding", biddingID, updateData)
|
|
|
- if err != nil {
|
|
|
+ if err != nil && err.Error() != "Document not updated: noop" {
|
|
|
log.Println("esb update err", biddingID, err)
|
|
|
}
|
|
|
}
|