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
64b173dd
Commit
64b173dd
authored
Mar 20, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:memberMax
parent
2bf5d01b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
6 deletions
+38
-6
user.go
cv/user_cv/user.go
+38
-6
No files found.
cv/user_cv/user.go
View file @
64b173dd
...
...
@@ -70,10 +70,12 @@ type CvUserDetail struct {
}
type
GroupPower
struct
{
Id
uint64
`json:"id"`
// 群主所在的势力ID
Name
string
`json:"name"`
// 群主所在的势力的名称
Nameplate
string
`json:"nameplate"`
// 势力铭牌
Grade
groupPower_e
.
GroupPowerGrade
`json:"grade"`
// 等级
Id
uint64
`json:"id"`
// 群主所在的势力ID
Name
string
`json:"name"`
// 群主所在的势力的名称
Nameplate
string
`json:"nameplate"`
// 势力铭牌
Grade
groupPower_e
.
GroupPowerGrade
`json:"grade"`
// 等级
MemberNum
uint32
`json:"memberNum,omitempty"`
// 当前成员数
MemberMax
uint32
`json:"memberMax,omitempty"`
// 成员上限
}
type
CvUserTiny
struct
{
...
...
@@ -321,13 +323,41 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
if
err
!=
nil
{
return
nil
,
err
}
groupPowerUsers
,
err
:=
groupPower_m
.
MGetGroupPowerUsers
(
model
,
gpIds
)
if
err
!=
nil
{
return
nil
,
err
}
// 成员上限
groupPowerNames
:=
make
(
map
[
mysql
.
ID
]
string
,
0
)
groupPowerInfos
:=
make
(
map
[
mysql
.
ID
]
groupPower_m
.
GroupPowerInfo
)
groupPowerGrades
:=
make
(
map
[
mysql
.
ID
]
groupPower_m
.
GroupPowerGrade
)
groupPowerMembers
:=
make
(
map
[
mysql
.
ID
][
2
]
int
)
// 0->memberNum 1->memberLimit
for
uid
,
gid
:=
range
groupPowers
{
groupPowerNames
[
uid
]
=
powerNames
[
gid
]
groupPowerInfos
[
uid
]
=
groupPowerInfoMap
[
gid
]
groupPowerGrades
[
uid
]
=
groupPowerGradeMap
[
gid
]
var
memberMax
int
grade
:=
groupPowerGradeMap
[
gid
]
.
Grade
if
grade
>=
groupPower_e
.
GroupPowerGrade0
&&
grade
<=
groupPower_e
.
GroupPowerGradeMax
{
if
grade
==
groupPower_e
.
GroupPowerGrade0
{
memberMax
=
300
}
if
grade
==
groupPower_e
.
GroupPowerGrade1
{
memberMax
=
500
}
if
grade
==
groupPower_e
.
GroupPowerGrade2
{
memberMax
=
800
}
if
grade
==
groupPower_e
.
GroupPowerGrade3
{
memberMax
=
1200
}
}
memberNum
:=
len
(
groupPowerUsers
[
gid
])
if
memberNum
>
memberMax
{
memberMax
=
memberNum
}
groupPowerMembers
[
uid
]
=
[
2
]
int
{
memberNum
,
memberMax
}
}
up
:=
user_m
.
UserProperty
{}
...
...
@@ -372,7 +402,7 @@ func getUserDetails(model *domain.Model, users []*user_m.User, myUserId mysql.ID
cvUserDetail
,
err
:=
userToDetail
(
users
[
i
],
myUserId
,
userTradeUnion
,
likeMap
,
likeMeMap
,
rels
,
vips
[
users
[
i
]
.
ID
]
!=
nil
,
vips
[
users
[
i
]
.
ID
],
svips
[
users
[
i
]
.
ID
],
headwear
,
ride
,
wealthGradeMap
,
charmGradeMap
,
activeGradeMap
,
medals
,
medalInfo
,
rooms
,
groupPowers
,
groupPowerNames
,
groupPowerInfos
,
groupPowerGrades
,
nobles
,
superManagerMap
)
wealthGradeMap
,
charmGradeMap
,
activeGradeMap
,
medals
,
medalInfo
,
rooms
,
groupPowers
,
groupPowerNames
,
groupPowerInfos
,
groupPowerGrades
,
groupPowerMembers
,
nobles
,
superManagerMap
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -392,7 +422,7 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U
likeMeMap
map
[
mysql
.
ID
]
bool
,
hvMap
map
[
mysql
.
ID
]
Relation
,
isVip
bool
,
vipExpireTime
*
int64
,
svip
rpc
.
CvSvip
,
headwear
*
headwear_cv
.
CvHeadwear
,
ride
property_cv
.
CvProperty
,
wealthGradeMap
map
[
mysql
.
ID
]
uint32
,
charmGradeMap
map
[
mysql
.
ID
]
uint32
,
actityGradeMap
map
[
mysql
.
ID
]
uint32
,
medals
map
[
uint64
][]
uint32
,
medalInfo
map
[
uint64
][]
medal_cv
.
CvMedal
,
rooms
map
[
mysql
.
ID
]
string
,
powers
map
[
mysql
.
ID
]
uint64
,
powerNames
map
[
mysql
.
ID
]
string
,
groupPowerInfos
map
[
mysql
.
ID
]
groupPower_m
.
GroupPowerInfo
,
powerGrades
map
[
mysql
.
ID
]
groupPower_m
.
GroupPowerGrade
,
nobles
map
[
mysql
.
ID
]
noble_m
.
UserNoble
,
superManagerMap
map
[
uint64
]
bool
)
(
*
CvUserDetail
,
error
)
{
powers
map
[
mysql
.
ID
]
uint64
,
powerNames
map
[
mysql
.
ID
]
string
,
groupPowerInfos
map
[
mysql
.
ID
]
groupPower_m
.
GroupPowerInfo
,
powerGrades
map
[
mysql
.
ID
]
groupPower_m
.
GroupPowerGrade
,
groupPowerMembers
map
[
mysql
.
ID
][
2
]
int
,
nobles
map
[
mysql
.
ID
]
noble_m
.
UserNoble
,
superManagerMap
map
[
uint64
]
bool
)
(
*
CvUserDetail
,
error
)
{
cvUserDetail
:=
&
CvUserDetail
{
CvUserBase
:
CvUserBase
{
Id
:
&
user
.
ID
,
...
...
@@ -537,6 +567,8 @@ func userToDetail(user *user_m.User, myUserId mysql.ID, userTradeUnion *user_m.U
Name
:
groupPowerInfos
[
user
.
ID
]
.
Name
,
Nameplate
:
groupPowerInfos
[
user
.
ID
]
.
Nameplate
,
Grade
:
powerGrades
[
user
.
ID
]
.
Grade
,
MemberNum
:
mysql
.
Num
(
groupPowerMembers
[
user
.
ID
][
0
]),
MemberMax
:
mysql
.
Num
(
groupPowerMembers
[
user
.
ID
][
1
]),
}
if
n
,
ok
:=
nobles
[
user
.
ID
];
ok
&&
n
.
Level
>
0
{
cvUserDetail
.
Noble
=
noble_cv
.
CvNoble
{
...
...
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