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
1115bc9c
Commit
1115bc9c
authored
Aug 16, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/lobby' into 'master'
Feature/lobby See merge request
!60
parents
bcc6452a
c8b291c2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
group.go
cv/group_cv/group.go
+13
-2
groupGame.go
domain/model/group_m/groupGame.go
+17
-0
group_list.go
route/group_r/group_list.go
+10
-1
No files found.
cv/group_cv/group.go
View file @
1115bc9c
...
...
@@ -251,13 +251,24 @@ type CvCountry struct {
AreaCodeName
*
string
`json:"areaShortName"`
}
func
BuildJoinedGroupInfo
(
myService
*
domain
.
Service
,
myUserId
uint64
,
g
roupIds
[]
string
,
pageSize
,
pageIndex
int
)
([]
JoinedGroupInfo
,
int
,
error
)
{
func
BuildJoinedGroupInfo
(
myService
*
domain
.
Service
,
myUserId
uint64
,
originG
roupIds
[]
string
,
pageSize
,
pageIndex
int
)
([]
JoinedGroupInfo
,
int
,
error
)
{
model
:=
domain
.
CreateModel
(
myService
.
CtxAndDb
)
groupInfo
,
err
:=
group_m
.
BatchGetGroupInfo
(
model
,
g
roupIds
)
groupInfo
,
err
:=
group_m
.
BatchGetGroupInfo
(
model
,
originG
roupIds
)
if
err
!=
nil
{
return
nil
,
0
,
err
}
var
groupIds
[]
string
for
_
,
groupId
:=
range
originGroupIds
{
if
group
,
ok
:=
groupInfo
[
groupId
];
ok
{
if
group
.
IsGameRoom
==
0
{
groupIds
=
append
(
groupIds
,
groupId
)
}
}
}
if
len
(
groupIds
)
<=
0
{
return
nil
,
0
,
nil
}
// todo: 可以移到后面,减小查询范围,因为roomMicUserMap不影响排序
roomMicUserMap
,
err
:=
group_m
.
BatchGetAllMicUser
(
model
,
groupIds
)
...
...
domain/model/group_m/groupGame.go
0 → 100644
View file @
1115bc9c
package
group_m
import
"git.hilo.cn/hilo-common/domain"
// 获取游戏房
func
GetGameGroupsMap
(
model
*
domain
.
Model
)
map
[
string
]
bool
{
res
:=
make
(
map
[
string
]
bool
)
var
rows
[]
GroupInfo
if
err
:=
model
.
DB
()
.
Model
(
GroupInfo
{})
.
Where
(
"is_game_room = 1"
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetGameGroupsMap fail:%v"
,
err
)
return
res
}
for
_
,
v
:=
range
rows
{
res
[
v
.
ImGroupId
]
=
true
}
return
res
}
route/group_r/group_list.go
View file @
1115bc9c
...
...
@@ -97,6 +97,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myContext
,
err
}
gameGroups
:=
group_m
.
GetGameGroupsMap
(
model
)
model
.
Log
.
Infof
(
"GetPopularGroups: page size = %d, page index = %d, banMap %v, hidenMap %v,cost:%v"
,
pageSize
,
pageIndex
,
bannedGroups
,
hiddenGroups
,
time
.
Now
()
.
Sub
(
start
))
hotGroupList
:=
make
([]
group_m
.
GroupInfo
,
0
)
...
...
@@ -122,6 +123,10 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
hiddenCount
++
continue
}
// 过滤掉游戏房
if
gameGroups
[
i
]
{
continue
}
groupIds
=
append
(
groupIds
,
i
)
}
model
.
Log
.
Infof
(
"GetPopularGroups, micGroupNum: %v, banned %d, hidden %d,cost:%v"
,
micGroupNum
,
banCount
,
hiddenCount
,
time
.
Now
()
.
Sub
(
start
))
...
...
@@ -471,9 +476,13 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myContext
,
err
}
gameGroups
:=
group_m
.
GetGameGroupsMap
(
model
)
gids
:=
make
([]
string
,
0
)
for
i
,
_
:=
range
micGroupNum
{
// 过滤游戏房
if
gameGroups
[
i
]
{
continue
}
gids
=
append
(
gids
,
i
)
}
// 获取最新群组列表
...
...
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