Ver Fonte

消息列表修改

renjiaojiao há 1 ano atrás
pai
commit
b10dadf2fb

+ 8 - 3
rpc/internal/common/msglistService.go

@@ -383,9 +383,14 @@ func FindUserClassMsg(userId string) (map[int]int, map[int][]int) {
 
 // GetUserMsgSummary 从用户消息汇总表取数据
 func GetUserMsgSummary(userId string) (userAllMsg, userReadMsg, userUnreadMsg []uint32, err error) {
-	var count int
-	row1, err := entity.ClickhouseConn.Query(context.Background(), fmt.Sprintf("SELECT COUNT(*) from message_user_summary WHERE userId = '%s'", userId))
-	row1.Scan(&count)
+	var count uint64
+	sqlc := fmt.Sprintf("SELECT COUNT(*) as count from message_user_summary WHERE userId = '%s'", userId)
+	fmt.Println("sqlc", sqlc)
+	row1 := entity.ClickhouseConn.QueryRow(context.Background(), sqlc)
+	err = row1.Scan(&count)
+	fmt.Println(err, count)
+	//row1, err := entity.ClickhouseConn.Query(context.Background(), )
+	//row1.Scan(&count)
 	if count == 0 {
 		err = errors.New("用户暂无数据")
 		return

+ 13 - 0
rpc/internal/common/newSendMsgService.go

@@ -5,6 +5,7 @@ import (
 	"app.yhyue.com/moapp/MessageCenter/rpc/internal/config"
 	"app.yhyue.com/moapp/MessageCenter/rpc/type/message"
 	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/redis"
 	"context"
 	"errors"
 	"fmt"
@@ -96,6 +97,12 @@ func NewUserSendMsg(in *message.NewUserInsertMsgReq) string {
 				Row4:        in.Row4,
 			}
 			SentWxTmplAndAppPush(pushData, v, group_id, "", "")
+			key := fmt.Sprintf(MsgCountKey, v, group_id)
+			redis.Del(redisModule, key)
+			if in.MsgType == 11 || in.MsgType == 12 {
+				key1 := fmt.Sprintf(MsgClassCountKey, v, in.MsgType)
+				redis.Del(redisModule, key1)
+			}
 		}(userIdArr[i], positionId)
 	}
 	wg.Wait()
@@ -163,6 +170,12 @@ func UpdateUserMsgSummary(in *message.BitmapSaveMsgReq) error {
 				Row4:        in.Row4,
 			}
 			SentWxTmplAndAppPush(pushData, v, group_id, equityName, equityAddr)
+			key := fmt.Sprintf(MsgCountKey, v, group_id)
+			redis.Del(redisModule, key)
+			if in.MsgType == 11 || in.MsgType == 12 {
+				key1 := fmt.Sprintf(MsgClassCountKey, v, in.MsgType)
+				redis.Del(redisModule, key1)
+			}
 		}(userIdArr[i])
 	}
 	wg.Wait()