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
c3dceed8
Commit
c3dceed8
authored
Mar 10, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:群组信息加上铭牌
parent
7bb301e5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
41 deletions
+55
-41
group.go
cv/group_cv/group.go
+10
-8
groupPower.go
cv/group_power_cv/groupPower.go
+9
-6
user.go
cv/user_cv/user.go
+1
-1
groupPower.go
domain/model/groupPower_m/groupPower.go
+11
-7
group_power.go
route/group_power_r/group_power.go
+5
-4
group_info.go
route/group_r/group_info.go
+4
-3
group_list.go
route/group_r/group_list.go
+15
-12
No files found.
cv/group_cv/group.go
View file @
c3dceed8
...
@@ -64,10 +64,11 @@ type GroupInfo struct {
...
@@ -64,10 +64,11 @@ type GroupInfo struct {
GroupBasicInfo
GroupBasicInfo
// hilo业务
// hilo业务
EntryLevel
uint32
`json:"entryLevel"`
// obsolete
EntryLevel
uint32
`json:"entryLevel"`
// obsolete
HasOnMic
bool
`json:"hasOnMic"`
// 房间麦上是否有人
HasOnMic
bool
`json:"hasOnMic"`
// 房间麦上是否有人
GroupPowerId
uint64
`json:"groupPowerId"`
// 群主所在的势力ID
GroupPowerId
uint64
`json:"groupPowerId"`
// 群主所在的势力ID
GroupPowerName
string
`json:"groupPowerName"`
// 群主所在的势力的名称
GroupPowerName
string
`json:"groupPowerName"`
// 群主所在的势力的名称
GroupPowerNameplate
string
`json:"groupPowerNameplate"`
// 势力铭牌
// "AppDefinedData": 群组维度的自定义字段 【暂时不用】
// "AppDefinedData": 群组维度的自定义字段 【暂时不用】
MemberList
[]
MemberListInfo
MemberList
[]
MemberListInfo
...
@@ -312,7 +313,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
...
@@ -312,7 +313,7 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
for
_
,
i
:=
range
groupIds
{
for
_
,
i
:=
range
groupIds
{
owners
=
append
(
owners
,
groupInfo
[
i
]
.
Owner
)
owners
=
append
(
owners
,
groupInfo
[
i
]
.
Owner
)
}
}
powerIds
,
powerNames
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
powerIds
,
powerNames
,
powerNameplates
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
err
return
nil
,
0
,
err
}
}
...
@@ -388,9 +389,10 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
...
@@ -388,9 +389,10 @@ func BuildJoinedGroupInfo(myService *domain.Service, myUserId uint64, groupIds [
MicNumType
:
int
(
g
.
MicNumType
),
MicNumType
:
int
(
g
.
MicNumType
),
GroupMedals
:
medals
,
GroupMedals
:
medals
,
},
},
HasOnMic
:
len
(
micUsers
)
>
0
,
HasOnMic
:
len
(
micUsers
)
>
0
,
GroupPowerId
:
powerIds
[
g
.
Owner
],
GroupPowerId
:
powerIds
[
g
.
Owner
],
GroupPowerName
:
powerNames
[
g
.
Owner
],
GroupPowerName
:
powerNames
[
g
.
Owner
],
GroupPowerNameplate
:
powerNameplates
[
g
.
Owner
],
},
},
MicUsers
:
micUsers
,
MicUsers
:
micUsers
,
RoomUserCount
:
uint
(
roomCount
[
i
]),
RoomUserCount
:
uint
(
roomCount
[
i
]),
...
...
cv/group_power_cv/groupPower.go
View file @
c3dceed8
...
@@ -232,28 +232,31 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) {
...
@@ -232,28 +232,31 @@ func GetCvGroupPowerUsers(groupPowerId uint64) ([]mysql.ID, error) {
return
usreIds
,
nil
return
usreIds
,
nil
}
}
func
BatchGetGroupPower
(
db
*
gorm
.
DB
,
userIds
[]
uint64
)
(
map
[
uint64
]
uint64
,
map
[
uint64
]
string
,
error
)
{
// return userId->powerId userId->powerName userId->powerNameplate
func
BatchGetGroupPower
(
db
*
gorm
.
DB
,
userIds
[]
uint64
)
(
map
[
uint64
]
uint64
,
map
[
uint64
]
string
,
map
[
uint64
]
string
,
error
)
{
if
len
(
userIds
)
<=
0
{
if
len
(
userIds
)
<=
0
{
return
nil
,
nil
,
nil
return
nil
,
nil
,
nil
,
nil
}
}
groupPowers
,
err
:=
groupPower_m
.
GetGroupPowerMap
(
db
,
userIds
)
groupPowers
,
err
:=
groupPower_m
.
GetGroupPowerMap
(
db
,
userIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
nil
,
err
}
}
gpIds
:=
make
([]
uint64
,
0
)
gpIds
:=
make
([]
uint64
,
0
)
for
_
,
i
:=
range
groupPowers
{
for
_
,
i
:=
range
groupPowers
{
gpIds
=
append
(
gpIds
,
i
)
gpIds
=
append
(
gpIds
,
i
)
}
}
powerNames
,
err
:=
groupPower_m
.
GetGroupPowerNames
(
db
,
gpIds
)
powerNames
,
powerNameplates
,
err
:=
groupPower_m
.
GetGroupPowerNames
(
db
,
gpIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
nil
,
err
}
}
groupPowerNames
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
groupPowerNames
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
groupPowerNameplates
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
for
i
,
g
:=
range
groupPowers
{
for
i
,
g
:=
range
groupPowers
{
groupPowerNames
[
i
]
=
powerNames
[
g
]
groupPowerNames
[
i
]
=
powerNames
[
g
]
groupPowerNameplates
[
i
]
=
powerNameplates
[
g
]
}
}
return
groupPowers
,
groupPowerNames
,
nil
return
groupPowers
,
groupPowerNames
,
groupPowerNameplates
,
nil
}
}
//获取国家势力的所有用户数量
//获取国家势力的所有用户数量
...
...
cv/user_cv/user.go
View file @
c3dceed8
...
@@ -299,7 +299,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
...
@@ -299,7 +299,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
for
_
,
i
:=
range
groupPowers
{
for
_
,
i
:=
range
groupPowers
{
gpIds
=
append
(
gpIds
,
i
)
gpIds
=
append
(
gpIds
,
i
)
}
}
powerNames
,
err
:=
groupPower_m
.
GetGroupPowerNames
(
mysql
.
Db
,
gpIds
)
powerNames
,
_
,
err
:=
groupPower_m
.
GetGroupPowerNames
(
mysql
.
Db
,
gpIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
domain/model/groupPower_m/groupPower.go
View file @
c3dceed8
...
@@ -348,24 +348,28 @@ func GetGroupPowerMap(db *gorm.DB, userIds []mysql.ID) (map[mysql.ID]uint64, err
...
@@ -348,24 +348,28 @@ func GetGroupPowerMap(db *gorm.DB, userIds []mysql.ID) (map[mysql.ID]uint64, err
return
result
,
nil
return
result
,
nil
}
}
func
GetGroupPowerNames
(
db
*
gorm
.
DB
,
ids
[]
mysql
.
ID
)
(
map
[
mysql
.
ID
]
string
,
error
)
{
// return
func
GetGroupPowerNames
(
db
*
gorm
.
DB
,
ids
[]
mysql
.
ID
)
(
map
[
mysql
.
ID
]
string
,
map
[
mysql
.
ID
]
string
,
error
)
{
type
record
struct
{
type
record
struct
{
Id
mysql
.
ID
Id
mysql
.
ID
Name
string
Name
string
Nameplate
string
}
}
rows
:=
make
([]
record
,
0
)
rows
:=
make
([]
record
,
0
)
result
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
result2
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
if
len
(
ids
)
>
0
{
if
len
(
ids
)
>
0
{
if
err
:=
db
.
Model
(
&
GroupPower
{})
.
Select
(
"p.id, i.name"
)
.
if
err
:=
db
.
Model
(
&
GroupPower
{})
.
Select
(
"p.id, i.name
,i.nameplate
"
)
.
Joins
(
"AS p INNER JOIN group_info AS i ON p.group_uid = i.im_group_id"
)
.
Joins
(
"AS p INNER JOIN group_info AS i ON p.group_uid = i.im_group_id"
)
.
Where
(
"p.id IN ?"
,
ids
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
Where
(
"p.id IN ?"
,
ids
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
return
nil
,
err
return
result
,
result2
,
err
}
}
}
}
result
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
for
_
,
i
:=
range
rows
{
for
_
,
i
:=
range
rows
{
result
[
i
.
Id
]
=
i
.
Name
result
[
i
.
Id
]
=
i
.
Name
result
[
i
.
Id
]
=
i
.
Nameplate
}
}
return
result
,
nil
return
result
,
result2
,
nil
}
}
func
GetGroupPower
(
model
*
domain
.
Model
,
id
mysql
.
ID
)
(
*
GroupPower
,
error
)
{
func
GetGroupPower
(
model
*
domain
.
Model
,
id
mysql
.
ID
)
(
*
GroupPower
,
error
)
{
...
...
route/group_power_r/group_power.go
View file @
c3dceed8
...
@@ -375,7 +375,7 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -375,7 +375,7 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds
=
append
(
groupIds
,
i
.
ImGroupId
)
groupIds
=
append
(
groupIds
,
i
.
ImGroupId
)
owners
=
append
(
owners
,
i
.
Owner
)
owners
=
append
(
owners
,
i
.
Owner
)
}
}
powerIds
,
powerNames
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
powerIds
,
powerNames
,
powerNameplates
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
@@ -487,9 +487,10 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -487,9 +487,10 @@ func GetGroupPowerGroups(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType
:
int
(
i
.
MicNumType
),
MicNumType
:
int
(
i
.
MicNumType
),
GroupMedals
:
medals
,
GroupMedals
:
medals
,
},
},
HasOnMic
:
len
(
roomMicUserMap
[
i
.
ImGroupId
])
>
0
,
HasOnMic
:
len
(
roomMicUserMap
[
i
.
ImGroupId
])
>
0
,
GroupPowerId
:
powerIds
[
i
.
Owner
],
GroupPowerId
:
powerIds
[
i
.
Owner
],
GroupPowerName
:
powerNames
[
i
.
Owner
],
GroupPowerName
:
powerNames
[
i
.
Owner
],
GroupPowerNameplate
:
powerNameplates
[
i
.
Owner
],
},
},
MicUsers
:
micUsers
,
MicUsers
:
micUsers
,
RoomUserCount
:
uint
(
roomCount
[
i
.
ImGroupId
]),
RoomUserCount
:
uint
(
roomCount
[
i
.
ImGroupId
]),
...
...
route/group_r/group_info.go
View file @
c3dceed8
...
@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -133,7 +133,7 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
}
}
model
.
Log
.
Info
(
"GetTheirGroups: theirRoles - "
,
theirRoles
)
model
.
Log
.
Info
(
"GetTheirGroups: theirRoles - "
,
theirRoles
)
powerIds
,
powerNames
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
powerIds
,
powerNames
,
powerNameplates
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
@@ -273,8 +273,9 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -273,8 +273,9 @@ func GetTheirGroups(c *gin.Context) (*mycontext.MyContext, error) {
GroupMedals
:
medals
,
GroupMedals
:
medals
,
},
},
//HasOnMic: onMicScore[i.GroupId] != 0,
//HasOnMic: onMicScore[i.GroupId] != 0,
GroupPowerId
:
powerIds
[
gi
.
Owner
],
GroupPowerId
:
powerIds
[
gi
.
Owner
],
GroupPowerName
:
powerNames
[
gi
.
Owner
],
GroupPowerName
:
powerNames
[
gi
.
Owner
],
GroupPowerNameplate
:
powerNameplates
[
gi
.
Owner
],
},
},
MicUsers
:
micUsers
,
MicUsers
:
micUsers
,
RoomUserCount
:
uint
(
roomCount
[
i
.
GroupId
]),
RoomUserCount
:
uint
(
roomCount
[
i
.
GroupId
]),
...
...
route/group_r/group_list.go
View file @
c3dceed8
...
@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -246,7 +246,7 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
groupIds
=
append
(
groupIds
,
i
.
ImGroupId
)
groupIds
=
append
(
groupIds
,
i
.
ImGroupId
)
owners
=
append
(
owners
,
i
.
Owner
)
owners
=
append
(
owners
,
i
.
Owner
)
}
}
powerIds
,
powerNames
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
powerIds
,
powerNames
,
powerNameplates
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
@@ -338,9 +338,10 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -338,9 +338,10 @@ func GetPopularGroups(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType
:
int
(
i
.
MicNumType
),
MicNumType
:
int
(
i
.
MicNumType
),
GroupMedals
:
medals
,
GroupMedals
:
medals
,
},
},
HasOnMic
:
true
,
HasOnMic
:
true
,
GroupPowerId
:
powerIds
[
i
.
Owner
],
GroupPowerId
:
powerIds
[
i
.
Owner
],
GroupPowerName
:
powerNames
[
i
.
Owner
],
GroupPowerName
:
powerNames
[
i
.
Owner
],
GroupPowerNameplate
:
powerNameplates
[
i
.
Owner
],
},
},
MicUsers
:
micUsers
,
MicUsers
:
micUsers
,
RoomUserCount
:
uint
(
roomCount
[
i
.
ImGroupId
]),
RoomUserCount
:
uint
(
roomCount
[
i
.
ImGroupId
]),
...
@@ -468,7 +469,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -468,7 +469,7 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
for
_
,
group
:=
range
groupInfos
{
for
_
,
group
:=
range
groupInfos
{
owners
=
append
(
owners
,
group
.
Owner
)
owners
=
append
(
owners
,
group
.
Owner
)
}
}
powerIds
,
powerNames
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
powerIds
,
powerNames
,
powerNameplates
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
@@ -555,9 +556,10 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -555,9 +556,10 @@ func GetLatestGroups(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType
:
int
(
group
.
MicNumType
),
MicNumType
:
int
(
group
.
MicNumType
),
GroupMedals
:
medals
,
GroupMedals
:
medals
,
},
},
HasOnMic
:
true
,
HasOnMic
:
true
,
GroupPowerId
:
powerIds
[
group
.
Owner
],
GroupPowerId
:
powerIds
[
group
.
Owner
],
GroupPowerName
:
powerNames
[
group
.
Owner
],
GroupPowerName
:
powerNames
[
group
.
Owner
],
GroupPowerNameplate
:
powerNameplates
[
group
.
Owner
],
},
},
MicUsers
:
micUsers
,
MicUsers
:
micUsers
,
RoomUserCount
:
uint
(
roomCount
[
group
.
ImGroupId
]),
RoomUserCount
:
uint
(
roomCount
[
group
.
ImGroupId
]),
...
@@ -1289,7 +1291,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1289,7 +1291,7 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
groupIds
=
append
(
groupIds
,
i
.
ImGroupId
)
groupIds
=
append
(
groupIds
,
i
.
ImGroupId
)
owners
=
append
(
owners
,
i
.
Owner
)
owners
=
append
(
owners
,
i
.
Owner
)
}
}
powerIds
,
powerNames
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
powerIds
,
powerNames
,
powerNameplates
,
err
:=
group_power_cv
.
BatchGetGroupPower
(
model
.
Db
,
owners
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
@@ -1369,9 +1371,10 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1369,9 +1371,10 @@ func GetGroupByCountry(c *gin.Context) (*mycontext.MyContext, error) {
MicNumType
:
int
(
i
.
MicNumType
),
MicNumType
:
int
(
i
.
MicNumType
),
GroupMedals
:
medals
,
GroupMedals
:
medals
,
},
},
HasOnMic
:
micGroupNum
[
i
.
ImGroupId
]
>
0
,
HasOnMic
:
micGroupNum
[
i
.
ImGroupId
]
>
0
,
GroupPowerId
:
powerIds
[
i
.
Owner
],
GroupPowerId
:
powerIds
[
i
.
Owner
],
GroupPowerName
:
powerNames
[
i
.
Owner
],
GroupPowerName
:
powerNames
[
i
.
Owner
],
GroupPowerNameplate
:
powerNameplates
[
i
.
Owner
],
},
},
MicUsers
:
[]
user_cv
.
CvUserTiny
{},
MicUsers
:
[]
user_cv
.
CvUserTiny
{},
RoomUserCount
:
uint
(
roomCount
[
i
.
ImGroupId
]),
RoomUserCount
:
uint
(
roomCount
[
i
.
ImGroupId
]),
...
...
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