diff --git a/route/group_r/group_list.go b/route/group_r/group_list.go index 03e570d4d8589d25fada90b01008e6d3c01a1fb5..8a21ddfa5e190ced752da6b5dc766e6823750eb0 100644 --- a/route/group_r/group_list.go +++ b/route/group_r/group_list.go @@ -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 {