|
@@ -36,7 +36,7 @@ func (t *TaskInfo) Run() {
|
|
|
|
|
|
func getBidInfo() {
|
|
func getBidInfo() {
|
|
query := `{"query": {"bool": {"must": [{"range": {"pici": {"gte": ` + fmt.Sprint(config.TaskConfig.Pici) + `,"lt": ` + fmt.Sprint(time.Now().Unix()) + `}}},{"bool": {"should": [{"terms": {"toptype": ["预告","招标","结果","其它"]}}],"minimum_should_match": 1}}]}},"_source": ["id","title","projectname","publishtime","buyer","area","pici"],"sort": [{"publishtime": "desc"}],"size": 1}`
|
|
query := `{"query": {"bool": {"must": [{"range": {"pici": {"gte": ` + fmt.Sprint(config.TaskConfig.Pici) + `,"lt": ` + fmt.Sprint(time.Now().Unix()) + `}}},{"bool": {"should": [{"terms": {"toptype": ["预告","招标","结果","其它"]}}],"minimum_should_match": 1}}]}},"_source": ["id","title","projectname","publishtime","buyer","area","pici"],"sort": [{"publishtime": "desc"}],"size": 1}`
|
|
- countQ := `{"query": {"bool": {"must": [{"range": {"pici": {"gte": ` + util.ObjToString(config.TaskConfig.Pici) + `,"lt": ` + util.ObjToString(time.Now().Unix()) + `}}},{"bool": {"should": [{"terms": {"toptype": ["预告","招标","结果","其它"]}}],"minimum_should_match": 1}}]}}}`
|
|
|
|
|
|
+ countQ := `{"query": {"bool": {"must": [{"range": {"pici": {"gte": ` + fmt.Sprint(config.TaskConfig.Pici) + `,"lt": ` + fmt.Sprint(time.Now().Unix()) + `}}},{"bool": {"should": [{"terms": {"toptype": ["预告","招标","结果","其它"]}}],"minimum_should_match": 1}}]}}}`
|
|
logger.Info("countQ: ", countQ)
|
|
logger.Info("countQ: ", countQ)
|
|
c, info := elastic.GetWithCount("bidding", "", countQ, query)
|
|
c, info := elastic.GetWithCount("bidding", "", countQ, query)
|
|
if c > 0 {
|
|
if c > 0 {
|
|
@@ -46,15 +46,19 @@ func getBidInfo() {
|
|
}
|
|
}
|
|
|
|
|
|
func taskInfo() {
|
|
func taskInfo() {
|
|
- ch := make(chan bool, 3)
|
|
|
|
|
|
+ ch := make(chan bool, config.Config.Thead)
|
|
wg := &sync.WaitGroup{}
|
|
wg := &sync.WaitGroup{}
|
|
|
|
|
|
q := map[string]interface{}{
|
|
q := map[string]interface{}{
|
|
- "i_appid": 2,
|
|
|
|
- "s_m_openid": map[string]int{"$exists": 1},
|
|
|
|
- "i_ispush": map[string]int{"$ne": 0},
|
|
|
|
- "s_phone": map[string]int{"$exists": 0},
|
|
|
|
- "s_m_phone": map[string]int{"$exists": 0}}
|
|
|
|
|
|
+ "i_appid": 2,
|
|
|
|
+ "s_m_openid": map[string]int{"$exists": 1},
|
|
|
|
+ "i_ispush": map[string]int{"$ne": 0},
|
|
|
|
+ "s_phone": map[string]int{"$exists": 0},
|
|
|
|
+ "s_m_phone": map[string]int{"$exists": 0},
|
|
|
|
+ "l_registedate": map[string]int64{"$gte": config.Config.RegisterDate}}
|
|
|
|
+ if config.Config.TaskUserId != "" {
|
|
|
|
+ q["_id"] = map[string]interface{}{"$gte": mongodb.StringTOBsonId(config.Config.TaskUserId)}
|
|
|
|
+ }
|
|
f := map[string]interface{}{"s_m_openid": 1}
|
|
f := map[string]interface{}{"s_m_openid": 1}
|
|
it := config.MgoJy.GetMgoConn().DB(config.Config.MongoDb.JianYu.DbName).C("user").Find(q).Select(f).Iter()
|
|
it := config.MgoJy.GetMgoConn().DB(config.Config.MongoDb.JianYu.DbName).C("user").Find(q).Select(f).Iter()
|
|
logger.Info("查询数据量:", config.MgoJy.Count("user", q))
|
|
logger.Info("查询数据量:", config.MgoJy.Count("user", q))
|
|
@@ -76,8 +80,10 @@ func taskInfo() {
|
|
}
|
|
}
|
|
wg.Wait()
|
|
wg.Wait()
|
|
Count = 0
|
|
Count = 0
|
|
- Info = make(map[string]interface{})
|
|
|
|
logger.Info("轮次结束 ---", count)
|
|
logger.Info("轮次结束 ---", count)
|
|
|
|
+ config.TaskConfig.Pici = util.Int64All(Info["pici"])
|
|
|
|
+ util.WriteSysConfig("./task.json", &config.TaskConfig)
|
|
|
|
+ Info = make(map[string]interface{})
|
|
}
|
|
}
|
|
|
|
|
|
func TestTask() {
|
|
func TestTask() {
|
|
@@ -90,8 +96,6 @@ func TestTask() {
|
|
|
|
|
|
// 微信远程调用,实现模板发送消息
|
|
// 微信远程调用,实现模板发送消息
|
|
func sendWeixin(user map[string]interface{}) {
|
|
func sendWeixin(user map[string]interface{}) {
|
|
- config.TaskConfig.Pici = util.Int64All(Info["pici"])
|
|
|
|
- util.WriteSysConfig("./task.json", &config.TaskConfig)
|
|
|
|
pb := util.Int64All(Info["publishtime"])
|
|
pb := util.Int64All(Info["publishtime"])
|
|
pname := util.ObjToString(Info["projectname"])
|
|
pname := util.ObjToString(Info["projectname"])
|
|
buyer := util.ObjToString(util.If(util.ObjToString(Info["buyer"]) == "", "--", util.ObjToString(Info["buyer"])))
|
|
buyer := util.ObjToString(util.If(util.ObjToString(Info["buyer"]) == "", "--", util.ObjToString(Info["buyer"])))
|
|
@@ -126,8 +130,9 @@ func sendWeixin(user map[string]interface{}) {
|
|
if err != nil {
|
|
if err != nil {
|
|
logger.Info("wx模版消息发送失败", err)
|
|
logger.Info("wx模版消息发送失败", err)
|
|
} else {
|
|
} else {
|
|
- config.MgoJy.Save("push_unbind_log", map[string]interface{}{
|
|
|
|
|
|
+ config.JyLog.Save("push_unbind_log", map[string]interface{}{
|
|
"userid": mongodb.BsonIdToSId(user["_id"]),
|
|
"userid": mongodb.BsonIdToSId(user["_id"]),
|
|
|
|
+ "s_m_openid": util.ObjToString(user["s_m_openid"]),
|
|
"infoid": util.ObjToString(Info["id"]),
|
|
"infoid": util.ObjToString(Info["id"]),
|
|
"createtime": now,
|
|
"createtime": now,
|
|
})
|
|
})
|