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
6de10476
Commit
6de10476
authored
Mar 13, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
家族
parent
8d492956
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
3 deletions
+76
-3
family.go
domain/model/groupPower_m/family.go
+1
-1
group_power.go
route/group_power_r/group_power.go
+75
-2
No files found.
domain/model/groupPower_m/family.go
View file @
6de10476
...
@@ -40,7 +40,7 @@ func (this *GroupPower) Get(model *domain.Model) (*GroupPower, error) {
...
@@ -40,7 +40,7 @@ func (this *GroupPower) Get(model *domain.Model) (*GroupPower, error) {
func
(
gpu
*
GroupPowerUser
)
GetBy
(
model
*
domain
.
Model
,
pageSize
,
pageIndex
int
)
([]
*
GroupPowerUser
,
int
,
bool
,
error
)
{
func
(
gpu
*
GroupPowerUser
)
GetBy
(
model
*
domain
.
Model
,
pageSize
,
pageIndex
int
)
([]
*
GroupPowerUser
,
int
,
bool
,
error
)
{
rows
:=
make
([]
*
GroupPowerUser
,
0
)
rows
:=
make
([]
*
GroupPowerUser
,
0
)
db
:=
model
.
Db
.
Where
(
gpu
)
.
Order
(
"field(`role`, 2, 3, 1)"
)
db
:=
model
.
Db
.
Model
(
GroupPowerUser
{})
.
Where
(
gpu
)
.
Order
(
"field(`role`, 2, 3, 1)"
)
var
count
int64
var
count
int64
err
:=
db
.
Count
(
&
count
)
.
Error
err
:=
db
.
Count
(
&
count
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
...
...
route/group_power_r/group_power.go
View file @
6de10476
...
@@ -714,12 +714,12 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -714,12 +714,12 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
gp
:=
&
groupPower_m
.
GroupPower
{
Entity
:
mysql
.
Entity
{
ID
:
familyId
}}
gp
:=
&
groupPower_m
.
GroupPower
{
Entity
:
mysql
.
Entity
{
ID
:
familyId
}}
gpInfo
,
err
:=
gp
.
Get
(
model
)
gpInfo
,
err
:=
gp
.
Get
(
model
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
myerr
.
WrapErr
(
err
)
}
}
gpU
:=
&
groupPower_m
.
GroupPowerUser
{
GroupPowerId
:
gpInfo
.
ID
}
gpU
:=
&
groupPower_m
.
GroupPowerUser
{
GroupPowerId
:
gpInfo
.
ID
}
members
,
_
,
_
,
err
:=
gpU
.
GetBy
(
model
,
5
,
0
)
members
,
_
,
_
,
err
:=
gpU
.
GetBy
(
model
,
5
,
0
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
myerr
.
WrapErr
(
err
)
}
}
uids
:=
make
([]
uint64
,
0
,
len
(
members
))
uids
:=
make
([]
uint64
,
0
,
len
(
members
))
for
_
,
v
:=
range
members
{
for
_
,
v
:=
range
members
{
...
@@ -1034,3 +1034,76 @@ func GroupPowerApplyList(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1034,3 +1034,76 @@ func GroupPowerApplyList(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponsePageBaseOk
(
c
,
result
,
nextPageIndex
,
hasNextPage
)
resp
.
ResponsePageBaseOk
(
c
,
result
,
nextPageIndex
,
hasNextPage
)
return
myContext
,
nil
return
myContext
,
nil
}
}
// @Tags 家族
// @Summary 退出/踢出家族
// @Param type formData int true "1.自己退出,2.踢人"
// @Param userExtId formData string false "用户extId"
// @Success 200
// @Router /v1/groupPower/quit [post]
func
GroupPowerQuit
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
if
err
!=
nil
{
return
myContext
,
err
}
quitType
,
err
:=
strconv
.
Atoi
(
c
.
Query
(
"type"
))
if
err
!=
nil
{
return
myContext
,
err
}
if
quitType
<
1
||
quitType
>
2
{
return
myContext
,
bizerr
.
InvalidParameter
}
model
:=
domain
.
CreateModelContext
(
myContext
)
if
quitType
==
1
{
// 主动退出
// 判断是否加入了家族
gpU
:=
groupPower_m
.
GroupPowerUser
{
UserId
:
userId
}
groupPUser
,
err
:=
gpU
.
GetGroupPowerUser
(
model
)
if
err
!=
nil
{
return
myContext
,
err
}
if
groupPUser
==
nil
{
return
myContext
,
bizerr
.
GroupPowerHaveNoJoin
}
// 退出家族
// log
resp
.
ResponseOk
(
c
,
nil
)
return
myContext
,
nil
}
// 判断是否加入了家族
gpU
:=
groupPower_m
.
GroupPowerUser
{
UserId
:
userId
}
myGroupPUser
,
err
:=
gpU
.
GetGroupPowerUser
(
model
)
if
err
!=
nil
{
return
myContext
,
err
}
// 操作者是否加入了家族,是否有操作权限
if
myGroupPUser
==
nil
{
return
myContext
,
bizerr
.
GroupPowerHaveNoJoin
}
if
myGroupPUser
.
Role
==
0
||
myGroupPUser
.
Role
==
groupPower_e
.
GroupPowerUserRoleUser
{
return
myContext
,
bizerr
.
GroupPowerHaveNoPower
}
// 被踢人信息
userExtId
:=
c
.
Query
(
"userExtId"
)
if
userExtId
==
""
{
return
myContext
,
bizerr
.
InvalidParameter
}
u
,
err
:=
user_c
.
GetUserByExternalId
(
model
,
userExtId
)
if
err
!=
nil
{
return
myContext
,
err
}
groupPUser
,
err
:=
gpU
.
GetGroupPowerUser
(
model
)
if
err
!=
nil
{
return
myContext
,
err
}
if
groupPUser
==
nil
{
return
myContext
,
bizerr
.
GroupPowerHaveNoJoin
}
// 退出家族
// log
resp
.
ResponseOk
(
c
,
u
)
return
myContext
,
nil
}
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