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
1b380be0
Commit
1b380be0
authored
Mar 31, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:获取家族申请人数
parent
e6b3b6b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
group_power_apply.go
domain/model/groupPower_m/group_power_apply.go
+14
-0
group_power.go
route/group_power_r/group_power.go
+35
-0
router.go
route/router.go
+1
-0
No files found.
domain/model/groupPower_m/group_power_apply.go
View file @
1b380be0
...
...
@@ -2,6 +2,7 @@ package groupPower_m
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm"
"hilo-group/common"
"hilo-group/myerr"
...
...
@@ -88,3 +89,16 @@ func DelGroupPowerApplyJoinNoDeal(model *domain.Model, userId uint64) error {
}
return
nil
}
// 获取家族申请人数
// param: isAccept 0:未审核 1:通过 2:拒绝
func
CountGroupPowerApply
(
model
*
domain
.
Model
,
groupPowerId
mysql
.
ID
,
isAccept
int
)
(
int64
,
error
)
{
var
cnt
int64
if
err
:=
model
.
DB
()
.
Model
(
GroupPowerApplyJoin
{})
.
Where
(
"group_power_id = ?"
,
groupPowerId
)
.
Where
(
"is_accept = ?"
,
isAccept
)
.
Count
(
&
cnt
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"CountGroupPowerApply fail:%v"
,
err
)
return
cnt
,
err
}
return
cnt
,
nil
}
route/group_power_r/group_power.go
View file @
1b380be0
...
...
@@ -1223,6 +1223,41 @@ func GroupPowerApplyList(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
nil
}
// @Tags 家族
// @Summary 申请人数
// @Success 200 {object} int
// @Router /v1/groupPower/apply/count [get]
func
GroupPowerApplyCount
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
if
err
!=
nil
{
return
myContext
,
err
}
model
:=
domain
.
CreateModelContext
(
myContext
)
// 判断是否加入了家族
gpU
:=
groupPower_m
.
GroupPowerUser
{
UserId
:
userId
}
myGroupPUser
,
err
:=
gpU
.
GetGroupPowerUser
(
model
)
if
err
!=
nil
{
return
myContext
,
err
}
// 操作者是否加入了家族,是否有操作权限
if
myGroupPUser
==
nil
||
myGroupPUser
.
ID
==
0
{
return
myContext
,
bizerr
.
GroupPowerHaveNoJoin
}
if
myGroupPUser
.
Role
==
0
||
myGroupPUser
.
Role
==
groupPower_e
.
GroupPowerUserRoleUser
{
return
myContext
,
bizerr
.
GroupPowerHaveNoPower
}
// 申请人数
cnt
,
err
:=
groupPower_m
.
CountGroupPowerApply
(
model
,
myGroupPUser
.
GroupPowerId
,
0
)
if
err
!=
nil
{
return
myContext
,
err
}
resp
.
ResponseOk
(
c
,
cnt
)
return
myContext
,
nil
}
// @Tags 家族
// @Summary 退出/踢出家族
// @Param type formData int true "1.自己退出,2.踢人"
...
...
route/router.go
View file @
1b380be0
...
...
@@ -133,6 +133,7 @@ func InitRouter() *gin.Engine {
groupPower
.
POST
(
"/apply"
,
wrapper
(
group_power_r
.
GroupPowerApplyJoin
))
groupPower
.
POST
(
"/apply/pass"
,
wrapper
(
group_power_r
.
GroupPowerApplyPass
))
groupPower
.
GET
(
"/apply/list"
,
wrapper
(
group_power_r
.
GroupPowerApplyList
))
groupPower
.
GET
(
"/apply/count"
,
wrapper
(
group_power_r
.
GroupPowerApplyCount
))
groupPower
.
POST
(
"/quit"
,
wrapper
(
group_power_r
.
GroupPowerQuit
))
groupPower
.
GET
(
"/quit/list"
,
wrapper
(
group_power_r
.
GroupPowerQuitList
))
groupPower
.
POST
(
"/admin"
,
wrapper
(
group_power_r
.
GroupPowerSetAdmin
))
...
...
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