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
bc331065
Commit
bc331065
authored
Mar 10, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
家族成员列表
parent
a677f328
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
3 deletions
+66
-3
groupPower.go
cv/group_power_cv/groupPower.go
+5
-0
family.go
domain/model/groupPower_m/family.go
+2
-2
group_power.go
route/group_power_r/group_power.go
+58
-1
router.go
route/router.go
+1
-0
No files found.
cv/group_power_cv/groupPower.go
View file @
bc331065
...
...
@@ -656,3 +656,8 @@ type GroupPowerStart struct {
User
*
user_m
.
UserTiny
`json:"user"`
RankingType
groupPower_e
.
GroupPowerRankType
`json:"rankingType"`
}
type
FamilyMemberDetail
struct
{
user_cv
.
CvUserExtend
Role
groupPower_e
.
GroupPowerUserRole
`json:"role"`
}
domain/model/groupPower_m/family.go
View file @
bc331065
...
...
@@ -37,9 +37,9 @@ func (this *GroupPower) Get(model *domain.Model) (*GroupPower, error) {
return
group
,
nil
}
func
(
gpu
*
GroupPowerUser
)
GetBy
(
model
*
domain
.
Model
,
limit
int
)
([]
*
GroupPowerUser
,
error
)
{
func
(
gpu
*
GroupPowerUser
)
GetBy
(
model
*
domain
.
Model
,
pageSize
,
pageIndex
int
)
([]
*
GroupPowerUser
,
error
)
{
rows
:=
make
([]
*
GroupPowerUser
,
0
)
err
:=
model
.
Db
.
Where
(
gpu
)
.
Order
(
"field(`role`, 2, 3, 1)"
)
.
Limit
(
limit
)
.
Find
(
&
rows
)
.
Error
err
:=
model
.
Db
.
Where
(
gpu
)
.
Order
(
"field(`role`, 2, 3, 1)"
)
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
-
1
)
.
Find
(
&
rows
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
route/group_power_r/group_power.go
View file @
bc331065
...
...
@@ -716,7 +716,7 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
err
}
gpU
:=
&
groupPower_m
.
GroupPowerUser
{
GroupPowerId
:
gpInfo
.
ID
}
members
,
err
:=
gpU
.
GetBy
(
model
,
5
)
members
,
err
:=
gpU
.
GetBy
(
model
,
5
,
0
)
if
err
!=
nil
{
return
myContext
,
err
}
...
...
@@ -778,3 +778,60 @@ func GroupPowerRooms(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponseOk
(
c
,
resRooms
)
return
myContext
,
nil
}
// @Tags 家族
// @Summary 获取家族成员列表
// @Param id query int true "家族id"
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageIndex query int true "第几个分页,从1开始 默认:1" default(1)
// @Success 200 {object} []group_power_cv.FamilyMemberDetail
// @Router /v1/groupPower/members [get]
func
GroupPowerMembers
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
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
}
pageSize
,
err
:=
strconv
.
Atoi
(
c
.
Query
(
"pageSize"
))
if
err
!=
nil
{
return
myContext
,
err
}
pageIndex
,
err
:=
strconv
.
Atoi
(
c
.
Query
(
"pageIndex"
))
if
err
!=
nil
{
return
myContext
,
err
}
model
:=
domain
.
CreateModelContext
(
myContext
)
gpU
:=
&
groupPower_m
.
GroupPowerUser
{
GroupPowerId
:
familyId
}
members
,
err
:=
gpU
.
GetBy
(
model
,
pageSize
,
pageIndex
)
if
err
!=
nil
{
return
myContext
,
err
}
userIds
:=
make
([]
uint64
,
0
)
for
_
,
v
:=
range
members
{
userIds
=
append
(
userIds
,
v
.
UserId
)
}
result
:=
make
([]
group_power_cv
.
FamilyMemberDetail
,
0
)
if
len
(
userIds
)
>
0
{
users
,
err
:=
user_cv
.
BatchGetUserExtend
(
model
,
userIds
,
userId
)
if
err
!=
nil
{
return
myContext
,
err
}
for
_
,
v
:=
range
members
{
result
=
append
(
result
,
group_power_cv
.
FamilyMemberDetail
{
CvUserExtend
:
users
[
v
.
UserId
],
Role
:
v
.
Role
,
})
}
}
resp
.
ResponseOk
(
c
,
result
)
return
myContext
,
nil
}
route/router.go
View file @
bc331065
...
...
@@ -128,6 +128,7 @@ func InitRouter() *gin.Engine {
groupPower
.
GET
(
"/billboard/owner/week"
,
wrapper
(
group_power_r
.
GroupPowerBillboardOwnerWeek
))
groupPower
.
GET
(
"/info"
,
wrapper
(
group_power_r
.
GroupPowerInfo
))
groupPower
.
GET
(
"/rooms"
,
wrapper
(
group_power_r
.
GroupPowerRooms
))
groupPower
.
GET
(
"/members"
,
wrapper
(
group_power_r
.
GroupPowerMembers
))
}
charge
:=
v1
.
Group
(
"/charge"
)
...
...
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