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
a318b203
Commit
a318b203
authored
Mar 14, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
家族
parent
37768a2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
groupPower.go
cv/group_power_cv/groupPower.go
+6
-4
group_power_apply.go
domain/model/groupPower_m/group_power_apply.go
+6
-2
group_power.go
route/group_power_r/group_power.go
+23
-5
No files found.
cv/group_power_cv/groupPower.go
View file @
a318b203
...
...
@@ -658,10 +658,10 @@ type GroupPowerInfo struct {
type
GroupPower
struct
{
Id
uint64
`json:"id"`
Name
mysql
.
Str
`json:"name"`
Nameplate
mysql
.
Str
`json:"nameplate"`
// 铭牌
Declaration
mysql
.
Str
`json:"declaration"`
// 宣言
Icon
mysql
.
Str
`json:"icon"`
// 头像
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:"-"`
// 升到下一级需要的经验值
...
...
@@ -669,6 +669,8 @@ type GroupPower struct {
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:"-"`
// 最大人数
}
type
GroupPowerUser
struct
{
...
...
domain/model/groupPower_m/group_power_apply.go
View file @
a318b203
...
...
@@ -32,9 +32,13 @@ func InsertGroupPowerApplyJoin(model *domain.Model, userId, familyId uint64) err
return
nil
}
func
GetGroupPowerApplyJoin
(
model
*
domain
.
Model
,
userId
,
familyId
uint64
)
(
*
GroupPowerApplyJoin
,
error
)
{
func
GetGroupPowerApplyJoin
(
model
*
domain
.
Model
,
userId
,
familyId
uint64
,
isAccept
int
)
(
*
GroupPowerApplyJoin
,
error
)
{
res
:=
new
(
GroupPowerApplyJoin
)
err
:=
model
.
Db
.
Where
(
GroupPowerApplyJoin
{
UserId
:
userId
,
GroupPowerId
:
familyId
})
.
Where
(
"is_accept=0"
)
.
First
(
&
res
)
.
Error
db
:=
model
.
Db
.
Where
(
GroupPowerApplyJoin
{
UserId
:
userId
,
GroupPowerId
:
familyId
})
if
isAccept
!=
-
1
{
db
=
db
.
Where
(
"is_accept=?"
,
isAccept
)
}
err
:=
db
.
First
(
&
res
)
.
Error
if
err
!=
nil
{
if
err
==
gorm
.
ErrRecordNotFound
{
return
nil
,
nil
...
...
route/group_power_r/group_power.go
View file @
a318b203
...
...
@@ -709,10 +709,10 @@ func GroupPowerBillboardOwnerWeek(c *gin.Context) (*mycontext.MyContext, error)
// @Router /v1/groupPower/info [get]
func
GroupPowerInfo
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
//u
serId, err := req.GetUserId(c)
//
if err != nil {
//
return myContext, err
//
}
myU
serId
,
err
:=
req
.
GetUserId
(
c
)
if
err
!=
nil
{
return
myContext
,
err
}
familyId
,
err
:=
strconv
.
ParseUint
(
c
.
Query
(
"id"
),
10
,
64
)
if
err
!=
nil
{
return
myContext
,
err
...
...
@@ -748,6 +748,24 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
Grade
:
gpInfo
.
Grade
,
Exp
:
gpInfo
.
Exp
,
NextExp
:
gpInfo
.
NextExp
,
GradeName
:
gpInfo
.
GradeName
,
GradeMedal
:
gpInfo
.
GradeMedal
,
MemberNum
:
mysql
.
Num
(
total
),
MemberMax
:
mysql
.
Num
(
group_power_cv
.
GroupPowerGradePrivilegeNum
[
groupPowerGrade
[
gp
.
ID
]
.
Grade
][
0
]
.
Num
),
}
// 我在该家族中的角色
myPU
:=
groupPower_m
.
GroupPowerUser
{
UserId
:
myUserId
}
myGroupPUser
,
err
:=
myPU
.
GetGroupPowerUser
(
model
)
if
err
!=
nil
{
return
myContext
,
err
}
if
myGroupPUser
!=
nil
&&
myGroupPUser
.
GroupPowerId
==
info
.
Id
{
info
.
Role
=
int
(
myGroupPUser
.
Role
)
}
else
{
// 是否申请了加入
apply
,
err
:=
groupPower_m
.
GetGroupPowerApplyJoin
(
model
,
myUserId
,
info
.
Id
,
-
1
)
if
err
!=
nil
{
return
myContext
,
err
}
if
apply
!=
nil
&&
apply
.
IsAccept
==
0
{
info
.
IsApply
=
true
}
}
// 补上家族之星三个榜一
stars
,
err
:=
groupPower_m
.
GetGroupPowerMonthStartTop1
(
model
,
gp
.
ID
)
if
err
!=
nil
{
...
...
@@ -973,7 +991,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
bizerr
.
GroupPowerHaveNoPower
}
// 查找申请记录
apply
,
err
:=
groupPower_m
.
GetGroupPowerApplyJoin
(
model
,
optUser
.
ID
,
myGroupPUser
.
GroupPowerId
)
apply
,
err
:=
groupPower_m
.
GetGroupPowerApplyJoin
(
model
,
optUser
.
ID
,
myGroupPUser
.
GroupPowerId
,
0
)
if
err
!=
nil
{
return
myContext
,
err
}
...
...
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