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
ffb7acdc
Commit
ffb7acdc
authored
Mar 20, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:补上等级
parent
ef0d3aed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
29 deletions
+38
-29
groupPower.go
cv/group_power_cv/groupPower.go
+15
-15
family.go
domain/model/groupPower_m/family.go
+0
-6
groupPower.go
domain/model/groupPower_m/groupPower.go
+0
-3
group_power.go
route/group_power_r/group_power.go
+23
-5
No files found.
cv/group_power_cv/groupPower.go
View file @
ffb7acdc
...
...
@@ -657,21 +657,21 @@ type GroupPowerInfo struct {
}
type
GroupPower
struct
{
Id
uint64
`json:"id"`
Name
string
`json:"name"`
Nameplate
string
`json:"nameplate"`
// 铭牌
Declaration
string
`json:"declaration"`
// 宣言
Icon
string
`json:"icon"`
// 头像
Grade
mysql
.
Num
`json:"grade" gorm:"-"`
// 等级
Exp
mysql
.
Num
`json:"exp" gorm:"-"`
// 当前经验值
NextExp
mysql
.
Num
`json:"nextExp" gorm:"-"`
// 升到下一级需要的经验值
GradeName
mysql
.
Str
`json:"gradeName"`
// 等级称号
GradeMedal
mysql
.
Str
`json:"gradeMedal"`
// 等级勋章图片
MemberNum
mysql
.
Num
`json:"memberNum" gorm:"-"`
// 当前人数
MemberMax
mysql
.
Num
`json:"memberMax" gorm:"-"`
// 最大人数
Role
int
`json:"role" gorm:"-"`
// 我在此家族中的角色 0.路人 1.成员 2.家族长 3.管理员
IsApply
bool
`json:"isApply" gorm:"-"`
// 最大人数
MonthRank
int
`json:"monthRank" gorm:"-"`
// 家族月排名
Id
uint64
`json:"id"`
Name
string
`json:"name"`
Nameplate
string
`json:"nameplate"`
// 铭牌
Declaration
string
`json:"declaration"`
// 宣言
Icon
string
`json:"icon"`
// 头像
Grade
groupPower_e
.
GroupPowerGrade
`json:"grade" gorm:"-"`
// 等级
Exp
mysql
.
Num
`json:"exp" gorm:"-"`
// 当前经验值
NextExp
mysql
.
Num
`json:"nextExp" gorm:"-"`
// 升到下一级需要的经验值
GradeName
mysql
.
Str
`json:"gradeName"`
// 等级称号
GradeMedal
mysql
.
Str
`json:"gradeMedal"`
// 等级勋章图片
MemberNum
mysql
.
Num
`json:"memberNum" gorm:"-"`
// 当前人数
MemberMax
mysql
.
Num
`json:"memberMax" gorm:"-"`
// 最大人数
Role
int
`json:"role" gorm:"-"`
// 我在此家族中的角色 0.路人 1.成员 2.家族长 3.管理员
IsApply
bool
`json:"isApply" gorm:"-"`
// 最大人数
MonthRank
int
`json:"monthRank" gorm:"-"`
// 家族月排名
}
type
GroupPowerUser
struct
{
...
...
domain/model/groupPower_m/family.go
View file @
ffb7acdc
...
...
@@ -2,7 +2,6 @@ package groupPower_m
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/common"
...
...
@@ -41,11 +40,6 @@ func (this *GroupPower) Get(model *domain.Model) (*GroupPower, error) {
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
if
grade
.
GroupPowerId
>
0
{
group
.
Grade
=
mysql
.
Num
(
grade
.
Grade
)
group
.
Exp
=
mysql
.
Num
(
grade
.
Exp
)
group
.
NextExp
=
mysql
.
Num
(
grade
.
Exp
)
}
return
group
,
nil
}
...
...
domain/model/groupPower_m/groupPower.go
View file @
ffb7acdc
...
...
@@ -29,9 +29,6 @@ type GroupPower struct {
Nameplate
mysql
.
Str
// 铭牌
Declaration
mysql
.
Str
// 宣言
Icon
mysql
.
Str
// 头像
Grade
mysql
.
Num
`gorm:"-"`
// 等级
Exp
mysql
.
Num
`gorm:"-"`
// 当前经验值
NextExp
mysql
.
Num
`gorm:"-"`
// 升到下一级需要的经验值
GradeName
mysql
.
Str
// 等级称号
GradeMedal
mysql
.
Str
// 等级勋章图片
}
...
...
route/group_power_r/group_power.go
View file @
ffb7acdc
...
...
@@ -744,9 +744,18 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
resMembers
=
append
(
resMembers
,
&
group_power_cv
.
GroupPowerUser
{
User
:
userMap
[
v
.
UserId
],
Role
:
v
.
Role
})
}
groupPowerGrade
,
err
:=
groupPower_m
.
MGetGroupPowerGrade
(
model
,
[]
mysql
.
ID
{
gp
.
ID
})
gradeM
,
err
:=
groupPower_m
.
MGetGroupPowerGrade
(
model
,
[]
mysql
.
ID
{
gp
.
ID
})
if
err
!=
nil
{
return
myContext
,
err
}
grade
:=
gradeM
[
gp
.
ID
]
nextExp
:=
mysql
.
Num
(
0
)
if
grade
.
Grade
!=
groupPower_e
.
GroupPowerGradeMax
{
nextExp
=
groupPower_e
.
GroupPowerGradeExp
[
grade
.
Grade
+
1
]
}
info
:=
&
group_power_cv
.
GroupPower
{
Id
:
gpInfo
.
ID
,
Name
:
gpInfo
.
Name
,
Nameplate
:
gpInfo
.
Nameplate
,
Declaration
:
gpInfo
.
Declaration
,
Icon
:
gpInfo
.
Icon
,
Grade
:
g
pInfo
.
Grade
,
Exp
:
gpInfo
.
Exp
,
NextExp
:
gpInfo
.
N
extExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
Grade
:
g
rade
.
Grade
,
Exp
:
grade
.
Exp
,
NextExp
:
n
extExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
group_power_cv
.
GroupPowerGradePrivilegeNum
[
groupPowerGrade
[
gp
.
ID
]
.
Grade
][
0
]
.
Num
),
}
if
info
.
Icon
!=
""
{
...
...
@@ -1399,12 +1408,12 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
// 检查铭牌是否能够修改
if
para
.
Nameplate
!=
""
{
// 等级检查
gp
:=
&
groupPower_m
.
GroupPower
{
Entity
:
mysql
.
Entity
{
ID
:
myGroupPUser
.
GroupPowerId
}}
groupPInfo
,
err
:=
gp
.
Get
(
model
)
gradeM
,
err
:=
groupPower_m
.
MGetGroupPowerGrade
(
model
,
[]
mysql
.
ID
{
myGroupPUser
.
GroupPowerId
})
if
err
!=
nil
{
return
myContext
,
err
}
if
groupPInfo
.
Grade
<
1
{
grade
:=
gradeM
[
myGroupPUser
.
GroupPowerId
]
if
grade
.
Grade
<
1
{
return
myContext
,
bizerr
.
GroupPowerChangeNameplate
}
// 检查铭牌长度和唯一性
...
...
@@ -1433,9 +1442,18 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
myerr
.
WrapErr
(
err
)
}
groupPowerGrade
,
err
:=
groupPower_m
.
MGetGroupPowerGrade
(
model
,
[]
mysql
.
ID
{
gp
.
ID
})
gradeM
,
err
:=
groupPower_m
.
MGetGroupPowerGrade
(
model
,
[]
mysql
.
ID
{
gp
.
ID
})
if
err
!=
nil
{
return
myContext
,
err
}
grade
:=
gradeM
[
gp
.
ID
]
nextExp
:=
mysql
.
Num
(
0
)
if
grade
.
Grade
!=
groupPower_e
.
GroupPowerGradeMax
{
nextExp
=
groupPower_e
.
GroupPowerGradeExp
[
grade
.
Grade
+
1
]
}
info
:=
&
group_power_cv
.
GroupPower
{
Id
:
gpInfo
.
ID
,
Name
:
gpInfo
.
Name
,
Nameplate
:
gpInfo
.
Nameplate
,
Declaration
:
gpInfo
.
Declaration
,
Icon
:
gpInfo
.
Icon
,
Grade
:
g
pInfo
.
Grade
,
Exp
:
gpInfo
.
Exp
,
NextExp
:
gpInfo
.
N
extExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
Grade
:
g
rade
.
Grade
,
Exp
:
grade
.
Exp
,
NextExp
:
n
extExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
group_power_cv
.
GroupPowerGradePrivilegeNum
[
groupPowerGrade
[
gp
.
ID
]
.
Grade
][
0
]
.
Num
),
}
if
info
.
Icon
!=
""
{
...
...
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