Commit 52248445 authored by iamhujiebin's avatar iamhujiebin

feat:redis读取最近进房

parent 77fa9ad1
......@@ -16,6 +16,7 @@ import (
"hilo-group/cv/group_power_cv"
"hilo-group/cv/medal_cv"
"hilo-group/cv/user_cv"
"hilo-group/domain/cache/group_c"
"hilo-group/domain/cache/res_c"
"hilo-group/domain/cache/room_c"
"hilo-group/domain/model/game_m"
......@@ -703,11 +704,12 @@ func GetRecentGroup(c *gin.Context) (*mycontext.MyContext, error) {
model := domain.CreateModelContext(myContext)
uer := group_m.UserEnterRoom{UserId: userId}
rec, err := uer.Find(model.Db)
if err != nil {
return myContext, err
}
//uer := group_m.UserEnterRoom{UserId: userId}
//rec, err := uer.Find(model.Db)
//if err != nil {
// return myContext, err
//}
rec := group_c.GetUserRecentRooms(model, userId)
myGroups, err := group_m.FindGroupMapByOwner(model, userId)
if err != nil {
......@@ -716,9 +718,9 @@ func GetRecentGroup(c *gin.Context) (*mycontext.MyContext, error) {
// 剔除自己创建的群
groupIds := make([]string, 0)
for _, i := range rec {
if _, ok := myGroups[i.GroupId]; !ok {
groupIds = append(groupIds, i.GroupId)
for _, groupId := range rec {
if _, ok := myGroups[groupId]; !ok {
groupIds = append(groupIds, groupId)
}
}
......@@ -827,19 +829,20 @@ func GetGroupVisitors(c *gin.Context) (*mycontext.MyContext, error) {
return myContext, err
}
uer := group_m.UserEnterRoom{GroupId: groupId}
rows, err := uer.Find(model.Db)
if err != nil {
return myContext, err
}
//uer := group_m.UserEnterRoom{GroupId: groupId}
//rows, err := uer.Find(model.Db)
//if err != nil {
// return myContext, err
//}
rows := group_c.GetLastRoomVisitors(model, groupId)
now := time.Now()
t := now.AddDate(0, 0, -15) // 只要15天内进入房间的人
//now := time.Now()
//t := now.AddDate(0, 0, -15) // 只要15天内进入房间的人
userIds := make([]uint64, 0)
for _, i := range rows {
if i.EnterTime.After(t) {
userIds = append(userIds, i.UserId)
}
for _, u := range rows {
//if i.EnterTime.After(t) {
userIds = append(userIds, u)
//}
}
users, err := user_m.GetUserMapByIds(model, userIds)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment