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
Compare Revisions
master...feature/cp-entry-effect
Source
feature/cp-entry-effect
Select Git revision
...
Target
master
Select Git revision
Compare
Commits (1)
feature/cp-entry-effect
· e09d78e2
hujiebin
authored
Jun 21, 2023
e09d78e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
1 deletion
+68
-1
cp.go
cv/cp_cv/cp.go
+11
-1
router.go
route/router.go
+1
-0
inner.go
route/user_r/inner.go
+56
-0
No files found.
cv/cp_cv/cp.go
View file @
e09d78e2
package
cp_cv
import
"hilo-user/cv/user_cv"
import
(
"hilo-user/_const/enum/cp_e"
"hilo-user/cv/user_cv"
)
// cp信息
type
CvCp
struct
{
...
...
@@ -18,3 +21,10 @@ type CvCpRelation struct {
CpUserId
uint64
`json:"cpUserId"`
CpUserAvatar
string
`json:"cpUserAvatar,omitempty"`
}
// cp进场特效信息
type
CvCpEntryEffect
struct
{
CpLevel
cp_e
.
CpLevel
`json:"cpLevel"`
CpUserAvatar
string
`json:"cpUserAvatar"`
CpEntryEffect
bool
`json:"cpEntryEffect"`
}
route/router.go
View file @
e09d78e2
...
...
@@ -61,6 +61,7 @@ func InitRouter() *gin.Engine {
innerUser
.
GET
(
"/cp"
,
wrapper
(
user_r
.
GetUserCp
))
innerUser
.
GET
(
"/cpRelations"
,
wrapper
(
user_r
.
MGetUserCpRelation
))
innerUser
.
GET
(
"/cp/pair"
,
wrapper
(
user_r
.
GetUserCpPair
))
innerUser
.
GET
(
"/cp/entryEffect"
,
wrapper
(
user_r
.
GetUserCpEntryEffect
))
// 获取cp进场特效信息,高频接口,需要额外处理
}
// 道具相关
innerProp
:=
inner
.
Group
(
"/prop"
)
...
...
route/user_r/inner.go
View file @
e09d78e2
...
...
@@ -8,6 +8,7 @@ import (
"hilo-user/_const/enum/cp_e"
"hilo-user/cv/cp_cv"
"hilo-user/cv/user_cv"
"hilo-user/domain/cache/user_c"
"hilo-user/domain/model/bag_m"
"hilo-user/domain/model/cp_m"
"hilo-user/domain/model/noble_m"
...
...
@@ -260,3 +261,58 @@ func GetUserCpPair(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}
// @Tags 用户-内部
// @Summary 获取用户cpEffect
// @Param id query int true "用户id"
// @Param language query string true "语言"
// @Success 200 {object} cp_cv.CvCpEntryEffect
// @Router /inner/user/cp/entryEffect [get]
func
GetUserCpEntryEffect
(
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
.
CvCpEntryEffect
cpLevel
:=
cp_e
.
CpLevel0
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
userId
)
if
!
exists
{
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}
level
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
Id
)
if
level
.
ExpireAt
.
Before
(
time
.
Now
())
{
level
.
ExpireAt
=
time
.
Now
()
.
AddDate
(
0
,
1
,
0
)
}
cpLevel
=
level
.
Level
cpUserId
:=
cpRelation
.
UserId2
if
cpUserId
==
userId
{
cpUserId
=
cpRelation
.
UserId1
}
response
.
CpLevel
=
cpLevel
userPrivileges
,
err
:=
cp_m
.
MGetUserSvipPrivilege
(
model
,
[]
uint64
{
userId
})
if
err
!=
nil
{
return
myContext
,
err
}
privilegeList
:=
cp_cv
.
CopyCpLevelPrivilegeList
(
level
.
Level
,
"en"
)
for
i
,
v
:=
range
privilegeList
{
if
v
.
CanSwitch
{
privilegeList
[
i
]
.
UserSwitch
=
userPrivileges
[
userId
][
v
.
Type
]
}
}
// 我的特权,有开关并且打开才返回
for
_
,
v
:=
range
privilegeList
{
if
v
.
Type
==
cp_e
.
CpPrivilegeRoomEffect
&&
v
.
UserSwitch
{
response
.
CpEntryEffect
=
true
}
}
if
cpUser
,
_
:=
user_c
.
GetUserTinyById
(
model
,
cpUserId
);
cpUser
!=
nil
{
response
.
CpUserAvatar
=
cpUser
.
Avatar
}
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}