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
acad438a
Commit
acad438a
authored
Jun 09, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:userBase
parent
2d25adc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
cp.go
cv/cp_cv/cp.go
+10
-3
inner.go
route/user_r/inner.go
+8
-13
No files found.
cv/cp_cv/cp.go
View file @
acad438a
package
cp_cv
package
cp_cv
import
"hilo-user/cv/user_cv"
// cp信息
// cp信息
type
CvCp
struct
{
type
CvCp
struct
{
CpInfo
CvCpInfo
`json:"cpInfo"`
// cp信息
CpInfo
CvCpInfoAll
`json:"cpInfo"`
// cp信息
CpLevel
CvCpLevel
`json:"cpLevel"`
// cp等级
CpLevel
CvCpLevel
`json:"cpLevel"`
// cp等级
PrivilegeList
[]
CvPrivilege
`json:"privilegeList"`
// 等级特权
MyPrivilegeList
[]
CvPrivilege
`json:"myPrivilegeList"`
// 等级特权
}
type
CvCpInfoAll
struct
{
UserInfo
*
user_cv
.
CvUserBase
`json:"userInfo"`
// 用户信息
CpUserInfo
*
user_cv
.
CvUserBase
`json:"cpUserInfo"`
// cp用户信息
}
}
route/user_r/inner.go
View file @
acad438a
...
@@ -111,17 +111,12 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -111,17 +111,12 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
err
return
myContext
,
err
}
}
userId
:=
req
.
Id
userId
:=
req
.
Id
userInfo
,
err
:=
user_m
.
GetUser
(
model
,
userId
)
if
err
!=
nil
{
return
myContext
,
err
}
var
response
cp_cv
.
CvCp
var
response
cp_cv
.
CvCp
cpLevel
:=
cp_e
.
CpLevel0
cpLevel
:=
cp_e
.
CpLevel0
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
)
}
}
var
cpUserInfo
*
user_m
.
User
var
myPrivilegeList
[]
cp_cv
.
CvPrivilege
var
myPrivilegeList
[]
cp_cv
.
CvPrivilege
level
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
ID
)
level
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
ID
)
if
level
.
ExpireAt
.
Before
(
time
.
Now
())
{
if
level
.
ExpireAt
.
Before
(
time
.
Now
())
{
...
@@ -132,10 +127,6 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -132,10 +127,6 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
if
cpUserId
==
userId
{
if
cpUserId
==
userId
{
cpUserId
=
cpRelation
.
UserId1
cpUserId
=
cpRelation
.
UserId1
}
}
cpUserInfo
,
err
=
user_m
.
GetUser
(
model
,
cpUserId
)
if
err
!=
nil
{
return
myContext
,
err
}
userPrivileges
,
err
:=
cp_m
.
MGetUserSvipPrivilege
(
model
,
[]
uint64
{
userId
})
userPrivileges
,
err
:=
cp_m
.
MGetUserSvipPrivilege
(
model
,
[]
uint64
{
userId
})
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
...
@@ -154,16 +145,20 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -154,16 +145,20 @@ func GetUserCp(c *gin.Context) (*mycontext.MyContext, error) {
myPrivilegeList
=
append
(
myPrivilegeList
,
privilegeList
[
i
])
myPrivilegeList
=
append
(
myPrivilegeList
,
privilegeList
[
i
])
}
}
}
}
userBases
,
err
:=
user_cv
.
GetUserBaseMap
([]
uint64
{
cpUserId
},
userId
)
if
err
!=
nil
{
return
myContext
,
err
}
// 返回值
// 返回值
response
=
cp_cv
.
CvCp
{
response
=
cp_cv
.
CvCp
{
CpInfo
:
cp_cv
.
CvCpInfo
{
CpInfo
:
cp_cv
.
CvCpInfo
All
{
UserInfo
:
user_cv
.
UserToTiny
(
*
userInfo
)
,
//UserInfo: userBases[userId]
,
CpUserInfo
:
user
_cv
.
UserToTiny
(
*
cpUserInfo
)
,
CpUserInfo
:
user
Bases
[
cpUserId
]
,
},
},
CpLevel
:
cp_cv
.
CvCpLevel
{
CpLevel
:
cp_cv
.
CvCpLevel
{
Level
:
cpLevel
,
Level
:
cpLevel
,
},
},
PrivilegeList
:
myPrivilegeList
,
My
PrivilegeList
:
myPrivilegeList
,
}
}
resp
.
ResponseOk
(
c
,
response
)
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
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