Explorar o código

Merge branch 'feature/v1.2.16' into dev/v1.2.16_rjj

renjiaojiao hai 1 ano
pai
achega
1310fa8573
Modificáronse 1 ficheiros con 16 adicións e 3 borrados
  1. 16 3
      rpc/internal/common/task.go

+ 16 - 3
rpc/internal/common/task.go

@@ -94,6 +94,16 @@ func PushData(users []string, data *[]map[string]interface{}) {
 	}
 
 	if len(ids) > 0 {
+		var bits []string
+		for _, i2 := range ids {
+			bits = append(bits, fmt.Sprintf("toUInt64(%d)", i2))
+		}
+		err := entity.ClickhouseConn.Exec(context.Background(), fmt.Sprintf(`alter table message_summary UPDATE msg_bitmap = bitmapOr(msg_bitmap,bitmapBuild([%s])) where group_id = %d`, strings.Join(bits, ","), 5))
+		if err != nil {
+			log.Println("message_summary err=== ", err.Error())
+			return
+		}
+
 		var userIds []string
 		for k, user := range users {
 			userIds = append(userIds, user)
@@ -102,7 +112,6 @@ func PushData(users []string, data *[]map[string]interface{}) {
 				userIds = []string{}
 			}
 		}
-
 	}
 }
 
@@ -194,10 +203,14 @@ func IntelUser(isFree bool) []string {
 
 // 获取推送消息
 func messageData(number int) *[]map[string]interface{} {
+	now := time.Now().AddDate(0, 0, -1)
+	starttime := fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix())
+	enttime := fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day(), 24, 0, 0, 0, time.Local).Unix())
+
 	query := map[string]interface{}{
-		"publishtime": map[string]interface{}{"$gt": time.Now().AddDate(0, 0, -1).Unix()},
+		"yucetime": map[string]interface{}{"$gt": starttime, "$lt": enttime},
 	}
-	data, _ := entity.Bidding.Find("project_forecast", query, map[string]interface{}{"publishtime": -1}, `{"title":1,"_id":1}`, false, 0, number)
+	data, _ := entity.Bidding.Find("project_forecast", query, map[string]interface{}{"yucetime": -1}, `{"title":1,"_id":1}`, false, 0, number)
 	return data
 }