|
@@ -191,7 +191,11 @@ func Update(ids []string, msgLogId int64) {
|
|
|
// 查询是否存在 都存在updae 不存在的插入
|
|
|
row := entity.ClickhouseConn.QueryRow(context.Background(), fmt.Sprintf("SELECT userId FROM message_user_summary where userId in ('%s')", strings.Join(ids, `','`)))
|
|
|
var userMsg []map[string]interface{}
|
|
|
- _ = row.Scan(&userMsg)
|
|
|
+ err := row.Scan(&userMsg)
|
|
|
+ if err != nil {
|
|
|
+ log.Println("查询消息失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
if userMsg != nil && len(userMsg) == len(ids) {
|
|
|
log.Println(fmt.Sprintf(`alter table message_user_summary UPDATE allMsg = bitmapOr(allMsg,bitmapBuild([toUInt64(%d)])) where userId in ('%s')`, msgLogId, strings.Join(ids, `','`)))
|
|
|
err1 := entity.ClickhouseConn.Exec(context.Background(), fmt.Sprintf(`alter table message_user_summary UPDATE allMsg = bitmapOr(allMsg,bitmapBuild([toUInt64(%d)])) where userId in ('%s')`, msgLogId, strings.Join(ids, `','`)))
|
|
@@ -221,7 +225,6 @@ func Update(ids []string, msgLogId int64) {
|
|
|
err1 := entity.ClickhouseConn.Exec(context.Background(), fmt.Sprintf(`alter table message_user_summary UPDATE allMsg = bitmapOr(allMsg,bitmapBuild([toUInt64(%d)])) where userId in ('%s')`, msgLogId, strings.Join(uData, `','`)))
|
|
|
if err1 != nil {
|
|
|
log.Printf("批量更新message_user_summary出错:%s", err1)
|
|
|
- return
|
|
|
}
|
|
|
}
|
|
|
if len(sqlArr) > 0 {
|