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
1db367a3
Commit
1db367a3
authored
Mar 13, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
申请加入家族
parent
5bce9bff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
10 deletions
+88
-10
groupPower.go
cv/group_power_cv/groupPower.go
+7
-0
group_power_apply.go
domain/model/groupPower_m/group_power_apply.go
+13
-2
3.5.0.sql
mysql/3.5.0.sql
+2
-2
group_power.go
route/group_power_r/group_power.go
+63
-4
router.go
route/router.go
+3
-2
No files found.
cv/group_power_cv/groupPower.go
View file @
1db367a3
...
@@ -661,3 +661,10 @@ type FamilyMemberDetail struct {
...
@@ -661,3 +661,10 @@ type FamilyMemberDetail struct {
user_cv
.
CvUserExtend
user_cv
.
CvUserExtend
Role
groupPower_e
.
GroupPowerUserRole
`json:"role"`
Role
groupPower_e
.
GroupPowerUserRole
`json:"role"`
}
}
type
FamilyApplyList
struct
{
User
*
user_m
.
UserTiny
`json:"user"`
Time
time
.
Time
`json:"time"`
Status
int8
`json:"status"`
// 0未操作,1已接受,2.已拒绝
MgrName
string
`json:"mgrName"`
// 管理员名称
}
domain/model/groupPower_m/group_power_apply.go
View file @
1db367a3
...
@@ -15,6 +15,7 @@ type GroupPowerApplyJoin struct {
...
@@ -15,6 +15,7 @@ type GroupPowerApplyJoin struct {
CreatedTime
time
.
Time
`json:"created_time"`
CreatedTime
time
.
Time
`json:"created_time"`
UpdatedTime
time
.
Time
`json:"updated_time"`
UpdatedTime
time
.
Time
`json:"updated_time"`
IsAccept
int8
`json:"is_accept"`
IsAccept
int8
`json:"is_accept"`
MgrId
uint64
`json:"mgr_id"`
}
}
func
InsertGroupPowerApplyJoin
(
model
*
domain
.
Model
,
userId
,
familyId
uint64
)
error
{
func
InsertGroupPowerApplyJoin
(
model
*
domain
.
Model
,
userId
,
familyId
uint64
)
error
{
...
@@ -43,8 +44,8 @@ func GetGroupPowerApplyJoin(model *domain.Model, userId, familyId uint64) (*Grou
...
@@ -43,8 +44,8 @@ func GetGroupPowerApplyJoin(model *domain.Model, userId, familyId uint64) (*Grou
return
res
,
nil
return
res
,
nil
}
}
func
OptGroupPowerApplyJoinById
(
model
*
domain
.
Model
,
id
uint64
,
optType
int
)
error
{
func
OptGroupPowerApplyJoinById
(
model
*
domain
.
Model
,
id
,
mgrId
uint64
,
optType
int
)
error
{
err
:=
model
.
Db
.
Exec
(
"update group_power_apply_join set is_accept = ?
where id=?"
,
optType
,
id
)
.
Error
err
:=
model
.
Db
.
Exec
(
"update group_power_apply_join set is_accept = ?
, mgr_id = ? where id=?"
,
optType
,
mgrId
,
id
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
myerr
.
WrapErr
(
err
)
return
myerr
.
WrapErr
(
err
)
}
}
...
@@ -58,3 +59,13 @@ func AcceptGroupPowerApplyJoin(model *domain.Model, userId, familyId uint64) err
...
@@ -58,3 +59,13 @@ func AcceptGroupPowerApplyJoin(model *domain.Model, userId, familyId uint64) err
}
}
return
nil
return
nil
}
}
func
OptGroupPowerApplyList
(
model
*
domain
.
Model
,
familyId
uint64
,
pageSize
,
pageIndex
int
)
([]
*
GroupPowerApplyJoin
,
error
)
{
rows
:=
make
([]
*
GroupPowerApplyJoin
,
0
)
err
:=
model
.
Db
.
Model
(
GroupPowerApplyJoin
{})
.
Where
(
"group_power_id = ?"
,
familyId
)
.
Order
(
"is_accept, created_time desc"
)
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
-
1
)
.
Find
(
&
rows
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
return
rows
,
nil
}
mysql/3.5.0.sql
View file @
1db367a3
...
@@ -18,7 +18,6 @@ CREATE TABLE `group_power_invite_join` (
...
@@ -18,7 +18,6 @@ CREATE TABLE `group_power_invite_join` (
KEY
`invite_user_id`
(
`invite_user_id`
)
KEY
`invite_user_id`
(
`invite_user_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'邀请加入家族'
;
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'邀请加入家族'
;
CREATE
TABLE
`group_power_apply_join`
(
CREATE
TABLE
`group_power_apply_join`
(
`id`
bigint
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'id'
,
`id`
bigint
unsigned
NOT
NULL
AUTO_INCREMENT
COMMENT
'id'
,
`user_id`
bigint
unsigned
NOT
NULL
COMMENT
'申请者id'
,
`user_id`
bigint
unsigned
NOT
NULL
COMMENT
'申请者id'
,
...
@@ -26,7 +25,8 @@ CREATE TABLE `group_power_apply_join` (
...
@@ -26,7 +25,8 @@ CREATE TABLE `group_power_apply_join` (
`created_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`created_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`updated_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`updated_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`is_accept`
tinyint
NOT
NULL
DEFAULT
'0'
COMMENT
'是否已经接受'
,
`is_accept`
tinyint
NOT
NULL
DEFAULT
'0'
COMMENT
'是否已经接受'
,
`mgr_id`
bigint
unsigned
NOT
NULL
DEFAULT
'0'
COMMENT
'审核的管理员id'
,
PRIMARY
KEY
(
`id`
),
PRIMARY
KEY
(
`id`
),
KEY
`group_power_id`
(
`group_power_id`
),
KEY
`group_power_id`
(
`group_power_id`
),
KEY
`user_id`
(
`user_id`
)
USING
BTREE
KEY
`user_id`
(
`user_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'申请加入家族'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
2
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_ci
COMMENT
=
'申请加入家族'
;
\ No newline at end of file
\ No newline at end of file
route/group_power_r/group_power.go
View file @
1db367a3
...
@@ -13,6 +13,7 @@ import (
...
@@ -13,6 +13,7 @@ import (
"hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/msg_e"
"hilo-group/_const/enum/msg_e"
"hilo-group/_const/redis_key"
"hilo-group/_const/redis_key"
"hilo-group/common"
"hilo-group/cv/group_cv"
"hilo-group/cv/group_cv"
"hilo-group/cv/group_power_cv"
"hilo-group/cv/group_power_cv"
"hilo-group/cv/medal_cv"
"hilo-group/cv/medal_cv"
...
@@ -852,7 +853,7 @@ func GroupPowerMembers(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -852,7 +853,7 @@ func GroupPowerMembers(c *gin.Context) (*mycontext.MyContext, error) {
// @Summary 申请加入家族
// @Summary 申请加入家族
// @Param id formData int true "家族id"
// @Param id formData int true "家族id"
// @Success 200
// @Success 200
// @Router /v1/groupPower/apply
Join
[post]
// @Router /v1/groupPower/apply [post]
func
GroupPowerApplyJoin
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
func
GroupPowerApplyJoin
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
userId
,
err
:=
req
.
GetUserId
(
c
)
...
@@ -899,7 +900,7 @@ func GroupPowerApplyJoin(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -899,7 +900,7 @@ func GroupPowerApplyJoin(c *gin.Context) (*mycontext.MyContext, error) {
// @Param userExtId formData string false "用户extId"
// @Param userExtId formData string false "用户extId"
// @Param type formData int true "1.通过,2.不通过"
// @Param type formData int true "1.通过,2.不通过"
// @Success 200
// @Success 200
// @Router /v1/groupPower/
passApply
[post]
// @Router /v1/groupPower/
apply/pass
[post]
func
GroupPowerApplyPass
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
func
GroupPowerApplyPass
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
userId
,
err
:=
req
.
GetUserId
(
c
)
...
@@ -940,7 +941,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -940,7 +941,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
if
optType
==
2
{
// 拒绝
if
optType
==
2
{
// 拒绝
// 更改申请表状态
// 更改申请表状态
err
=
groupPower_m
.
OptGroupPowerApplyJoinById
(
model
,
apply
.
Id
,
optType
)
err
=
groupPower_m
.
OptGroupPowerApplyJoinById
(
model
,
apply
.
Id
,
userId
,
optType
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
@@ -958,7 +959,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -958,7 +959,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
return
err
return
err
}
}
// 更改申请表状态
// 更改申请表状态
err
=
groupPower_m
.
OptGroupPowerApplyJoinById
(
model
,
apply
.
Id
,
optType
)
err
=
groupPower_m
.
OptGroupPowerApplyJoinById
(
model
,
apply
.
Id
,
userId
,
optType
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -971,3 +972,61 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -971,3 +972,61 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponseOk
(
c
,
nil
)
resp
.
ResponseOk
(
c
,
nil
)
return
myContext
,
nil
return
myContext
,
nil
}
}
// @Tags 家族
// @Summary 申请加入列表
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageIndex query int true "第几个分页,从1开始 默认:1" default(1)
// @Success 200
// @Router /v1/groupPower/apply/list [get]
func
GroupPowerApplyList
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
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
{
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
}
// 申请列表
rows
,
err
:=
groupPower_m
.
OptGroupPowerApplyList
(
model
,
myGroupPUser
.
GroupPowerId
,
pageSize
,
pageIndex
)
if
err
!=
nil
{
return
myContext
,
err
}
uids
:=
make
([]
uint64
,
0
,
len
(
rows
))
for
_
,
v
:=
range
rows
{
uids
=
append
(
uids
,
v
.
UserId
,
v
.
MgrId
)
}
//查找用户信息
uids
=
common
.
UniqueSliceUInt64
(
uids
)
userMap
,
err
:=
user_c
.
GetUserTinyMap
(
domain
.
CreateModelContext
(
myContext
),
uids
,
true
)
result
:=
make
([]
*
group_power_cv
.
FamilyApplyList
,
0
,
len
(
rows
))
for
_
,
v
:=
range
rows
{
result
=
append
(
result
,
&
group_power_cv
.
FamilyApplyList
{
User
:
userMap
[
v
.
UserId
],
Time
:
v
.
CreatedTime
,
Status
:
v
.
IsAccept
,
MgrName
:
userMap
[
v
.
MgrId
]
.
Nick
})
}
resp
.
ResponseOk
(
c
,
result
)
return
myContext
,
nil
}
route/router.go
View file @
1db367a3
...
@@ -129,8 +129,9 @@ func InitRouter() *gin.Engine {
...
@@ -129,8 +129,9 @@ func InitRouter() *gin.Engine {
groupPower
.
GET
(
"/info"
,
wrapper
(
group_power_r
.
GroupPowerInfo
))
groupPower
.
GET
(
"/info"
,
wrapper
(
group_power_r
.
GroupPowerInfo
))
groupPower
.
GET
(
"/rooms"
,
wrapper
(
group_power_r
.
GroupPowerRooms
))
groupPower
.
GET
(
"/rooms"
,
wrapper
(
group_power_r
.
GroupPowerRooms
))
groupPower
.
GET
(
"/members"
,
wrapper
(
group_power_r
.
GroupPowerMembers
))
groupPower
.
GET
(
"/members"
,
wrapper
(
group_power_r
.
GroupPowerMembers
))
groupPower
.
POST
(
"/applyJoin"
,
wrapper
(
group_power_r
.
GroupPowerApplyJoin
))
groupPower
.
POST
(
"/apply"
,
wrapper
(
group_power_r
.
GroupPowerApplyJoin
))
groupPower
.
POST
(
"/passApply"
,
wrapper
(
group_power_r
.
GroupPowerApplyPass
))
groupPower
.
POST
(
"/apply/pass"
,
wrapper
(
group_power_r
.
GroupPowerApplyPass
))
groupPower
.
GET
(
"/apply/list"
,
wrapper
(
group_power_r
.
GroupPowerApplyList
))
}
}
charge
:=
v1
.
Group
(
"/charge"
)
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