|
@@ -220,6 +220,7 @@ func sendmail(appid string, days int, force int, fn string, bcron bool) {
|
|
|
}
|
|
|
}
|
|
|
fields2["item"] = 1
|
|
|
+ fields2["bget"] = 1 //2020/3/11 没加这个字段重复发送会扣除
|
|
|
log.Info(fields2, dataQuery)
|
|
|
data, bdata := Mgo.Find("usermail", dataQuery, `{"_id":1}`, fields2, false, -1, -1)
|
|
|
firstId, lastId := "", ""
|
|
@@ -241,6 +242,10 @@ func sendmail(appid string, days int, force int, fn string, bcron bool) {
|
|
|
},
|
|
|
},
|
|
|
})
|
|
|
+ if len(updateMap) > 500 {
|
|
|
+ Mgo.UpdateBulk("usermail", updateMap...)
|
|
|
+ updateMap = [][]map[string]interface{}{}
|
|
|
+ }
|
|
|
}
|
|
|
if index == 0 {
|
|
|
firstId = qu.BsonIdToSId(v1["_id"])
|
|
@@ -277,7 +282,10 @@ func sendmail(appid string, days int, force int, fn string, bcron bool) {
|
|
|
//处理总条数,有重复获取的信息条不计数,*******************
|
|
|
if newGetLen > 0 {
|
|
|
redis.Decrby(REDISDB, "limitnum_"+appid, newGetLen)
|
|
|
- go Mgo.UpdateBulk("usermail", updateMap...)
|
|
|
+ //数据量特别大的时候
|
|
|
+ if len(updateMap) > 0 {
|
|
|
+ Mgo.UpdateBulk("usermail", updateMap...)
|
|
|
+ }
|
|
|
}
|
|
|
d := map[string]interface{}{}
|
|
|
d["size"] = len(infos)
|
|
@@ -297,6 +305,8 @@ func sendmail(appid string, days int, force int, fn string, bcron bool) {
|
|
|
log.Println(saveData)
|
|
|
}
|
|
|
}()
|
|
|
+ //去掉bget
|
|
|
+ delete(fields2, "bget")
|
|
|
GetBidInfoXlsx(appid, fn, mails, fields2, allUserData)
|
|
|
}
|
|
|
}
|