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
Compare Revisions
master...feature/family-up
Source
feature/family-up
Select Git revision
...
Target
master
Select Git revision
Compare
Commits (3)
feat: 家族昵称和家族铭牌延长可以设置15个字符
· e6b3b6b7
hujiebin
authored
Mar 31, 2023
e6b3b6b7
feat:获取家族申请人数
· 1b380be0
hujiebin
authored
Mar 31, 2023
1b380be0
feat: swagger update
· 85b5cb66
hujiebin
authored
Mar 31, 2023
85b5cb66
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
10 deletions
+62
-10
enum.go
_const/enum/groupPower_e/enum.go
+9
-7
family.go
domain/model/groupPower_m/family.go
+2
-2
group_power_apply.go
domain/model/groupPower_m/group_power_apply.go
+14
-0
group_power.go
route/group_power_r/group_power.go
+36
-1
router.go
route/router.go
+1
-0
No files found.
_const/enum/groupPower_e/enum.go
View file @
85b5cb66
package
groupPower_e
import
"git.hilo.cn/hilo-common/resource/mysql"
//国家势力状态
type
GroupPowerStatus
=
mysql
.
Type
type
GroupPowerStatus
=
uint8
const
(
//上架
...
...
@@ -15,7 +13,7 @@ const (
)
//国家势力用户角色
type
GroupPowerUserRole
=
mysql
.
Type
type
GroupPowerUserRole
=
uint8
const
(
//普通用户
...
...
@@ -27,7 +25,7 @@ const (
)
//国家势力排行榜类型
type
GroupPowerRankType
=
mysql
.
Type
type
GroupPowerRankType
=
uint8
const
(
GroupPowerRankTypeFamous
GroupPowerRankType
=
1
...
...
@@ -36,7 +34,7 @@ const (
)
//国家势力日志操作类型
type
GroupPowerUserLogType
=
mysql
.
Type
type
GroupPowerUserLogType
=
uint8
const
(
//加入
...
...
@@ -51,7 +49,7 @@ const (
GroupPowerUserLogDissolve
GroupPowerUserLogType
=
5
)
type
GroupPowerDiamondLogType
=
mysql
.
Type
type
GroupPowerDiamondLogType
=
uint8
const
(
//群组原因加入
...
...
@@ -67,3 +65,7 @@ const (
PowerSuppportAwarded
PowerSupportAwardState
=
1
// 已经领取
PowerSuppportWaiting
PowerSupportAwardState
=
2
// 待领取
)
const
(
LongestNameplate
=
15
)
domain/model/groupPower_m/family.go
View file @
85b5cb66
...
...
@@ -140,8 +140,8 @@ func UpdateFamily(model *domain.Model, familyId uint64, name, nameplate, declara
if
groupPower
.
ModifyNameplate
!=
mysql
.
YES
{
// 同步修改铭牌
n
:=
len
([]
rune
(
name
))
if
n
>
6
{
n
=
6
if
n
>
groupPower_e
.
LongestNameplate
{
n
=
groupPower_e
.
LongestNameplate
}
updateMap
[
"nameplate"
]
=
string
([]
rune
(
name
[
0
:
n
]))
}
...
...
domain/model/groupPower_m/group_power_apply.go
View file @
85b5cb66
...
...
@@ -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 @
85b5cb66
...
...
@@ -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.踢人"
...
...
@@ -1510,7 +1545,7 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
res_m
.
GetErrByLanguage
(
model
.
Db
,
common
.
MSG_ID_SET_FAMILY_NAMEPL
,
lang
,
bizerr
.
GroupPowerChangeNameplate
)
}
// 检查铭牌长度和唯一性
if
len
(
para
.
Nameplate
)
>
6
{
if
len
(
para
.
Nameplate
)
>
groupPower_e
.
LongestNameplate
{
return
myContext
,
bizerr
.
GroupPowerHaveTooLong
}
if
groupPower_m
.
IsExistsNameplate
(
model
,
para
.
Nameplate
)
{
...
...
route/router.go
View file @
85b5cb66
...
...
@@ -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
))
...
...