Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-group
Commits
ec2ad090
Commit
ec2ad090
authored
Aug 28, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:临时兼容
parent
32c52c48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
group.go
cv/group_cv/group.go
+4
-1
enter_room.go
domain/cache/group_c/enter_room.go
+9
-3
group_list.go
route/group_r/group_list.go
+2
-2
No files found.
cv/group_cv/group.go
View file @
ec2ad090
...
@@ -251,7 +251,7 @@ type CvCountry struct {
...
@@ -251,7 +251,7 @@ type CvCountry struct {
AreaCodeName
*
string
`json:"areaShortName"`
AreaCodeName
*
string
`json:"areaShortName"`
}
}
func
BuildJoinedGroupInfo
(
myService
*
domain
.
Service
,
myUserId
uint64
,
originGroupIds
[]
string
,
pageSize
,
pageIndex
int
)
([]
JoinedGroupInfo
,
int
,
error
)
{
func
BuildJoinedGroupInfo
(
myService
*
domain
.
Service
,
myUserId
uint64
,
originGroupIds
[]
string
,
pageSize
,
pageIndex
int
,
_roomEnterTime
...
map
[
string
]
int64
)
([]
JoinedGroupInfo
,
int
,
error
)
{
model
:=
domain
.
CreateModel
(
myService
.
CtxAndDb
)
model
:=
domain
.
CreateModel
(
myService
.
CtxAndDb
)
groupInfo
,
err
:=
group_m
.
BatchGetGroupInfo
(
model
,
originGroupIds
)
groupInfo
,
err
:=
group_m
.
BatchGetGroupInfo
(
model
,
originGroupIds
)
...
@@ -321,6 +321,9 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, originGrou
...
@@ -321,6 +321,9 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, originGrou
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
err
return
nil
,
0
,
err
}
}
if
len
(
_roomEnterTime
)
>
0
{
roomEnterTime
=
_roomEnterTime
[
0
]
}
//model.Log.Infof("BuildJoinedGroupInfo, roomEnterTime: %v", roomEnterTime)
//model.Log.Infof("BuildJoinedGroupInfo, roomEnterTime: %v", roomEnterTime)
// 排序优先级V8.0版本
// 排序优先级V8.0版本
...
...
domain/cache/group_c/enter_room.go
View file @
ec2ad090
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"fmt"
"fmt"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/domain"
"github.com/go-redis/redis/v8"
"github.com/go-redis/redis/v8"
"github.com/spf13/cast"
"hilo-group/_const/redis_key/group_k"
"hilo-group/_const/redis_key/group_k"
"strconv"
"strconv"
"time"
"time"
...
@@ -49,16 +50,21 @@ func GetLastRoomVisitors(model *domain.Model, imGroupId string) (userIds []uint6
...
@@ -49,16 +50,21 @@ func GetLastRoomVisitors(model *domain.Model, imGroupId string) (userIds []uint6
// 获取最近进入的房间
// 获取最近进入的房间
// 3个月
// 3个月
func
GetUserRecentRooms
(
model
*
domain
.
Model
,
userId
uint64
)
(
imGroupIds
[]
string
)
{
func
GetUserRecentRooms
(
model
*
domain
.
Model
,
userId
uint64
)
(
imGroupIds
[]
string
,
roomEnterTime
map
[
string
]
int64
)
{
roomEnterTime
=
make
(
map
[
string
]
int64
)
userKey
:=
group_k
.
GetUserEnterRoomUserKey
(
userId
)
userKey
:=
group_k
.
GetUserEnterRoomUserKey
(
userId
)
var
err
error
res
,
err
:=
model
.
Redis
.
ZRangeByScoreWithScores
(
model
,
userKey
,
&
redis
.
ZRangeBy
{
imGroupIds
,
err
=
model
.
Redis
.
ZRangeByScore
(
model
,
userKey
,
&
redis
.
ZRangeBy
{
Min
:
fmt
.
Sprintf
(
"%d"
,
time
.
Now
()
.
AddDate
(
0
,
-
3
,
0
)
.
Unix
()),
Min
:
fmt
.
Sprintf
(
"%d"
,
time
.
Now
()
.
AddDate
(
0
,
-
3
,
0
)
.
Unix
()),
Max
:
"+inf"
,
Max
:
"+inf"
,
})
.
Result
()
})
.
Result
()
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
for
_
,
v
:=
range
res
{
imGroupId
:=
cast
.
ToString
(
v
.
Member
)
imGroupIds
=
append
(
imGroupIds
,
imGroupId
)
roomEnterTime
[
imGroupId
]
=
int64
(
v
.
Score
)
}
return
return
}
}
...
...
route/group_r/group_list.go
View file @
ec2ad090
...
@@ -718,7 +718,7 @@ func GetRecentGroup(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -718,7 +718,7 @@ func GetRecentGroup(c *gin.Context) (*mycontext.MyContext, error) {
//if err != nil {
//if err != nil {
// return myContext, err
// return myContext, err
//}
//}
rec
:=
group_c
.
GetUserRecentRooms
(
model
,
userId
)
rec
,
roomEnterTime
:=
group_c
.
GetUserRecentRooms
(
model
,
userId
)
myGroups
,
err
:=
group_m
.
FindGroupMapByOwner
(
model
,
userId
)
myGroups
,
err
:=
group_m
.
FindGroupMapByOwner
(
model
,
userId
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -734,7 +734,7 @@ func GetRecentGroup(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -734,7 +734,7 @@ func GetRecentGroup(c *gin.Context) (*mycontext.MyContext, error) {
}
}
myService
:=
domain
.
CreateService
(
myContext
)
myService
:=
domain
.
CreateService
(
myContext
)
result
,
_
,
err
:=
group_cv
.
BuildJoinedGroupInfo
(
myService
,
userId
,
groupIds
,
30
,
1
)
result
,
_
,
err
:=
group_cv
.
BuildJoinedGroupInfo
(
myService
,
userId
,
groupIds
,
30
,
1
,
roomEnterTime
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment