Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-user
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
chenweijian
hilo-user
Commits
d05fab9e
Commit
d05fab9e
authored
Jun 09, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cp-new' into feature/3.9.0
parents
a8fe9a52
dfed8595
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
cp.go
cv/cp_cv/cp.go
+7
-0
router.go
route/router.go
+1
-0
inner.go
route/user_r/inner.go
+33
-0
No files found.
cv/cp_cv/cp.go
View file @
d05fab9e
...
@@ -8,3 +8,10 @@ type CvCp struct {
...
@@ -8,3 +8,10 @@ type CvCp struct {
CpLevel
CvCpLevel
`json:"cpLevel"`
// cp等级
CpLevel
CvCpLevel
`json:"cpLevel"`
// cp等级
MyPrivilegeList
[]
CvPrivilege
`json:"myPrivilegeList"`
// 等级特权
MyPrivilegeList
[]
CvPrivilege
`json:"myPrivilegeList"`
// 等级特权
}
}
// cp关系
type
CvCpRelation
struct
{
CpId
uint64
`json:"cpId"`
UserId
uint64
`json:"userId"`
CpUserId
uint64
`json:"cpUserId"`
}
route/router.go
View file @
d05fab9e
...
@@ -56,6 +56,7 @@ func InitRouter() *gin.Engine {
...
@@ -56,6 +56,7 @@ func InitRouter() *gin.Engine {
innerUser
.
GET
(
"/levels"
,
wrapper
(
user_r
.
MGetUserLevels
))
innerUser
.
GET
(
"/levels"
,
wrapper
(
user_r
.
MGetUserLevels
))
innerUser
.
GET
(
"/bag/id"
,
wrapper
(
user_r
.
GetUserBagId
))
innerUser
.
GET
(
"/bag/id"
,
wrapper
(
user_r
.
GetUserBagId
))
innerUser
.
GET
(
"/cp"
,
wrapper
(
user_r
.
GetUserCp
))
innerUser
.
GET
(
"/cp"
,
wrapper
(
user_r
.
GetUserCp
))
innerUser
.
GET
(
"/cpRelation"
,
wrapper
(
user_r
.
GetUserCpRelation
))
}
}
// 道具相关
// 道具相关
innerProp
:=
inner
.
Group
(
"/prop"
)
innerProp
:=
inner
.
Group
(
"/prop"
)
...
...
route/user_r/inner.go
View file @
d05fab9e
...
@@ -116,6 +116,7 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -116,6 +116,7 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
userId
)
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
userId
)
if
!
exists
{
if
!
exists
{
resp
.
ResponseOk
(
c
,
response
)
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}
}
var
myPrivilegeList
[]
cp_cv
.
CvPrivilege
var
myPrivilegeList
[]
cp_cv
.
CvPrivilege
level
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
ID
)
level
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
ID
)
...
@@ -160,3 +161,35 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -160,3 +161,35 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponseOk
(
c
,
response
)
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
return
myContext
,
nil
}
}
// @Tags 用户-内部
// @Summary 获取用户cp关系
// @Param id query int true "用户id"
// @Success 200 {object} cp_cv.CvCpRelation
// @Router /inner/user/cpRelation [get]
func
GetUserCpRelation
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
var
model
=
domain
.
CreateModelContext
(
myContext
)
var
req
GetUserCpReq
if
err
:=
c
.
ShouldBindQuery
(
&
req
);
err
!=
nil
{
return
myContext
,
err
}
userId
:=
req
.
Id
var
response
cp_cv
.
CvCpRelation
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
userId
)
if
!
exists
{
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}
cpUserId
:=
cpRelation
.
UserId2
if
cpUserId
==
userId
{
cpUserId
=
cpRelation
.
UserId1
}
response
=
cp_cv
.
CvCpRelation
{
CpId
:
cpRelation
.
ID
,
UserId
:
userId
,
CpUserId
:
cpUserId
,
}
resp
.
ResponseOk
(
c
,
response
)
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