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
b8799a6a
Commit
b8799a6a
authored
Apr 19, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
贵族6
parent
9f1274ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
group_power.go
domain/service/group_power_s/group_power.go
+27
-0
group_power.go
route/group_power_r/group_power.go
+8
-4
inner.go
route/group_power_r/inner.go
+3
-1
No files found.
domain/service/group_power_s/group_power.go
View file @
b8799a6a
...
...
@@ -4,8 +4,11 @@ import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/cv/group_power_cv"
"hilo-group/domain/event/group_power_ev"
"hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/noble_m"
)
type
GroupPowerService
struct
{
...
...
@@ -66,3 +69,27 @@ func (s *GroupPowerService) GroupPowerUserLeave(groupPowerId mysql.ID, userId my
})
return
remainSeconds
,
err
}
func
GetGroupPowerMaxMemberNum
(
model
*
domain
.
Model
,
familyId
uint64
,
groupPowerGrade
groupPower_e
.
GroupPowerGrade
)
(
maxNum
int
)
{
maxNum
=
group_power_cv
.
GroupPowerGradePrivilegeNum
[
groupPowerGrade
][
0
]
.
Num
ownerId
,
err
:=
groupPower_m
.
GetPowerOwner
(
model
.
Db
,
familyId
)
if
err
==
nil
{
//检查是否是贵族
if
flag
,
err
:=
noble_m
.
CheckNobleLevel
(
model
.
Db
,
ownerId
,
6
);
err
!=
nil
{
}
else
if
flag
{
newNumMap
:=
map
[
groupPower_e
.
GroupPowerGrade
]
int
{
1
:
400
,
2
:
600
,
3
:
1000
,
4
:
1400
}
if
newNum
,
ok
:=
newNumMap
[
groupPowerGrade
];
ok
{
maxNum
=
newNum
}
}
}
users
,
err
:=
groupPower_m
.
GetGroupPowerUser
(
model
,
familyId
)
if
err
!=
nil
{
return
}
memberNum
:=
len
(
users
)
if
memberNum
>
maxNum
{
maxNum
=
memberNum
}
return
}
route/group_power_r/group_power.go
View file @
b8799a6a
...
...
@@ -774,10 +774,11 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
if
grade
.
Grade
!=
groupPower_e
.
GroupPowerGradeMax
{
nextExp
=
groupPower_e
.
GroupPowerGradeExp
[
grade
.
Grade
+
1
]
}
maxNum
:=
group_power_s
.
GetGroupPowerMaxMemberNum
(
model
,
gpInfo
.
ID
,
grade
.
Grade
)
info
:=
&
group_power_cv
.
GroupPower
{
Id
:
gpInfo
.
ID
,
Name
:
gpInfo
.
Name
,
Nameplate
:
gpInfo
.
Nameplate
,
Declaration
:
gpInfo
.
Declaration
,
Icon
:
gpInfo
.
Icon
,
Grade
:
grade
.
Grade
,
Exp
:
grade
.
Exp
,
NextExp
:
nextExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
group_power_cv
.
GroupPowerGradePrivilegeNum
[
grade
.
Grade
][
0
]
.
Num
),
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
max
Num
),
}
if
info
.
Icon
!=
""
{
info
.
Icon
=
common
.
MakeFullUrl
(
info
.
Icon
)
...
...
@@ -1007,7 +1008,8 @@ func GroupPowerApplyJoin(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myContext
,
myerr
.
WrapErr
(
err
)
}
maxNum
:=
group_power_cv
.
GroupPowerGradePrivilegeNum
[
gpInfo
.
Grade
][
0
]
.
Num
maxNum
:=
group_power_s
.
GetGroupPowerMaxMemberNum
(
model
,
familyId
,
gpInfo
.
Grade
)
//maxNum := group_power_cv.GroupPowerGradePrivilegeNum[gpInfo.Grade][0].Num
if
nowNum
+
1
>
int64
(
maxNum
)
{
return
myContext
,
bizerr
.
GroupPowerMemberMax
}
...
...
@@ -1109,7 +1111,8 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
err
}
grade
:=
gradeM
[
apply
.
GroupPowerId
]
maxNum
:=
group_power_cv
.
GroupPowerGradePrivilegeNum
[
grade
.
Grade
][
0
]
.
Num
//maxNum := group_power_cv.GroupPowerGradePrivilegeNum[grade.Grade][0].Num
maxNum
:=
group_power_s
.
GetGroupPowerMaxMemberNum
(
model
,
apply
.
GroupPowerId
,
grade
.
Grade
)
if
int
(
nowNum
+
1
)
>
maxNum
{
return
myContext
,
bizerr
.
GroupPowerMemberMax
}
...
...
@@ -1597,10 +1600,11 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
if
grade
.
Grade
!=
groupPower_e
.
GroupPowerGradeMax
{
nextExp
=
groupPower_e
.
GroupPowerGradeExp
[
grade
.
Grade
+
1
]
}
maxNum
:=
group_power_s
.
GetGroupPowerMaxMemberNum
(
model
,
gpInfo
.
ID
,
grade
.
Grade
)
info
:=
&
group_power_cv
.
GroupPower
{
Id
:
gpInfo
.
ID
,
Name
:
gpInfo
.
Name
,
Nameplate
:
gpInfo
.
Nameplate
,
Declaration
:
gpInfo
.
Declaration
,
Icon
:
gpInfo
.
Icon
,
Grade
:
grade
.
Grade
,
Exp
:
grade
.
Exp
,
NextExp
:
nextExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
group_power_cv
.
GroupPowerGradePrivilegeNum
[
groupPowerGrade
[
gp
.
ID
]
.
Grade
][
0
]
.
Num
),
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
max
Num
),
}
if
info
.
Icon
!=
""
{
info
.
Icon
=
common
.
MakeFullUrl
(
info
.
Icon
)
...
...
route/group_power_r/inner.go
View file @
b8799a6a
...
...
@@ -11,6 +11,7 @@ import (
"hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/msg_m"
"hilo-group/domain/model/user_m"
"hilo-group/domain/service/group_power_s"
"hilo-group/resp"
)
...
...
@@ -48,7 +49,8 @@ func MGetGroupPowers(c *gin.Context) (*mycontext.MyContext, error) {
var
memberMax
mysql
.
Num
grade
:=
groupPowerGrade
[
groupPowerId
]
.
Grade
if
grade
>=
groupPower_e
.
GroupPowerGrade0
&&
grade
<=
groupPower_e
.
GroupPowerGradeMax
{
memberMax
=
mysql
.
Num
(
group_power_cv
.
GroupPowerGradePrivilegeNum
[
groupPowerGrade
[
groupPowerId
]
.
Grade
][
0
]
.
Num
)
//memberMax = mysql.Num(group_power_cv.GroupPowerGradePrivilegeNum[groupPowerGrade[groupPowerId].Grade][0].Num)
memberMax
=
mysql
.
Num
(
group_power_s
.
GetGroupPowerMaxMemberNum
(
model
,
groupPowerId
,
grade
))
}
memberNum
:=
mysql
.
Num
(
len
(
groupPowerUsers
[
groupPowerId
]))
if
memberNum
>
memberMax
{
...
...
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