diff --git a/domain/cache/group_c/enter_room.go b/domain/cache/group_c/enter_room.go index a164a0439f39fd75953919686da34296ee521d74..def6372ef2c1ded5780da37d7130fe0a2e713660 100644 --- a/domain/cache/group_c/enter_room.go +++ b/domain/cache/group_c/enter_room.go @@ -59,3 +59,13 @@ func GetUserRecentRooms(model *domain.Model, userId uint64) (imGroupIds []string } return } + +// 清理房间访客 +// 15天前访问的 +func RemoveRoomVisitors(model *domain.Model, imGroupId string) { + groupKey := group_k.GetUserEnterRoomGroupKey(imGroupId) + err := model.Redis.ZRemRangeByScore(model, groupKey, "-inf", fmt.Sprintf("%d", time.Now().AddDate(0, 0, -15).Unix())).Err() + if err != nil { + model.Log.Errorf("RemoveRoomVisitors fail:%v", err) + } +}