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
d14f8969
Commit
d14f8969
authored
Jun 02, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整参数
parent
f2613d0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
29 deletions
+40
-29
space.go
cv/cp_cv/space.go
+11
-10
rank.go
route/cp_r/rank.go
+1
-1
space.go
route/cp_r/space.go
+28
-18
No files found.
cv/cp_cv/space.go
View file @
d14f8969
...
...
@@ -12,20 +12,21 @@ import (
// cp信息
type
CvCpInfo
struct
{
UserInfo
user_cv
.
UserTiny
`json:"userInfo"`
// 用户信息
CpUserInfo
user_cv
.
UserTiny
`json:"cpUserInfo
"`
// cp用户信息
CpDays
int
`json:"cpDays"`
// cp天数
VisitTimes
int64
`json:"visitTimes"`
// 空间访问量
ApplyToUnbind
bool
`json:"applyToUnbind"`
// 是否申请撤销cp
UserInfo
user_cv
.
UserTiny
`json:"userInfo"`
// 用户信息
CpUserInfo
user_cv
.
UserTiny
`json:"cpUserInfo
,omitempty"`
// cp用户信息
CpDays
int
`json:"cpDays"`
// cp天数
VisitTimes
int64
`json:"visitTimes"`
// 空间访问量
ApplyToUnbind
bool
`json:"applyToUnbind"`
// 是否申请撤销cp
}
// cp等级
type
CvCpLevel
struct
{
Level
cp_e
.
CpLevel
`json:"level"`
// 等级 0:无称号 1:恋爱CP 2:甜蜜CP 3:忠诚CP 4:炽热CP 5:荣耀CP
Points
uint32
`json:"points"`
// CP值
NextPoints
uint32
`json:"nextPoints,omitempty"`
// 下个等级所需CP值
RemainPoints
uint32
`json:"remainPoints,omitempty"`
// 还需要多少CP值到下一个级别
ExpireAtUnix
int64
`json:"expireAtUnix,omitempty"`
// 有效期,时间戳
Level
cp_e
.
CpLevel
`json:"level"`
// 等级 0:无称号 1:恋爱CP 2:甜蜜CP 3:忠诚CP 4:炽热CP 5:荣耀CP
Points
uint32
`json:"points"`
// CP值
StartPoints
uint32
`json:"startPoints,omitempty"`
// 上个等级所需CP值
EndPoints
uint32
`json:"endPoints,omitempty"`
// 下个等级所需CP值
ExpireAtUnix
int64
`json:"expireAtUnix,omitempty"`
// 有效期,时间戳
SettlementDate
string
`json:"settlementDate"`
// 等级过期时间
}
// 资源等级
...
...
route/cp_r/rank.go
View file @
d14f8969
...
...
@@ -81,7 +81,7 @@ func CpRank(c *gin.Context) (*mycontext.MyContext, error) {
CpLevel
:
cp_cv
.
CvCpLevel
{
Level
:
cpLevels
[
rank
.
CpId
]
.
Level
,
//Points: cp_e.CpLevelPoints[cpLevel] + curPoints,
//
Next
Points: nextPoints,
//
End
Points: nextPoints,
//RemainPoints: remainPoints,
//ExpireAtUnix: expireAtUnix,
},
...
...
route/cp_r/space.go
View file @
d14f8969
...
...
@@ -14,6 +14,7 @@ import (
"hilo-user/myerr/bizerr"
"hilo-user/req"
"hilo-user/resp"
"time"
)
// @Tags CP v2
...
...
@@ -38,19 +39,21 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myContext
,
err
}
cp
UserInfo
,
err
:=
user_m
.
GetUserByExtId
(
model
,
externalId
)
target
UserInfo
,
err
:=
user_m
.
GetUserByExtId
(
model
,
externalId
)
if
err
!=
nil
{
return
myContext
,
err
}
var
cpUserInfo
*
user_m
.
User
expireAtUnix
,
cpLevel
:=
int64
(
0
),
cp_e
.
CpLevel0
visitTimes
:=
int64
(
0
)
cpDays
,
applyToUnbind
:=
0
,
false
// todo cp时长
nextPoints
,
remainPoints
,
curPoints
:=
cp_e
.
CpLevelPoints
[
cp_e
.
CpLevel1
],
mysql
.
Num
(
0
)
,
mysql
.
Num
(
0
)
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
cp
UserInfo
.
ID
)
settlementDate
,
cpDays
,
applyToUnbind
:=
""
,
0
,
false
nextPoints
,
curPoints
:=
cp_e
.
CpLevelPoints
[
cp_e
.
CpLevel1
]
,
mysql
.
Num
(
0
)
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
target
UserInfo
.
ID
)
if
exists
{
level
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
ID
)
cpLevel
,
curPoints
=
level
.
Level
,
level
.
Points
expireAtUnix
=
level
.
ExpireAt
.
Unix
()
expireAtUnix
,
settlementDate
=
level
.
ExpireAt
.
Unix
(),
level
.
ExpireAt
.
Format
(
"2006-01-02"
)
cpDays
=
int
(
time
.
Now
()
.
Sub
(
cpRelation
.
CreatedTime
)
.
Hours
()
/
24
)
+
1
// cp 存在的时候,发布访问cp空间事件
if
err
:=
cp_ev
.
PublishCpSpaceVisit
(
model
,
&
cp_ev
.
SpaceVisitEvent
{
UserId
:
userId
,
...
...
@@ -66,10 +69,13 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
cpUserId
=
cpRelation
.
UserId1
}
applyToUnbind
=
cp_m
.
GetApplyToUnbind
(
model
,
userId
,
cpUserId
)
cpUserInfo
,
err
=
user_m
.
GetUser
(
model
,
cpUserId
)
if
err
!=
nil
{
return
myContext
,
err
}
}
if
cpLevel
!=
cp_e
.
CpLevelMax
{
nextPoints
=
cp_e
.
CpLevelPoints
[
cpLevel
+
1
]
remainPoints
=
nextPoints
-
cp_e
.
CpLevelPoints
[
cpLevel
]
-
curPoints
}
privilegeList
:=
cp_cv
.
CopyCpLevelPrivilegeList
(
cpLevel
,
lang
)
userPrivileges
,
err
:=
cp_m
.
MGetUserSvipPrivilege
(
model
,
[]
uint64
{
userId
})
...
...
@@ -81,24 +87,28 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
privilegeList
[
i
]
.
UserSwitch
=
userPrivileges
[
userId
][
v
.
Type
]
}
}
// 返回值
response
:=
cp_cv
.
CvSpace
{
CpInfo
:
cp_cv
.
CvCpInfo
{
UserInfo
:
user_cv
.
UserToTiny
(
*
userInfo
),
CpUserInfo
:
user_cv
.
UserToTiny
(
*
cpUserInfo
),
VisitTimes
:
visitTimes
,
CpDays
:
cpDays
,
ApplyToUnbind
:
applyToUnbind
,
},
CpLevel
:
cp_cv
.
CvCpLevel
{
Level
:
cpLevel
,
Points
:
cp_e
.
CpLevelPoints
[
cpLevel
]
+
curPoints
,
NextPoints
:
nextPoints
,
RemainPoints
:
remainPoints
,
ExpireAtUnix
:
expireAtUnix
,
Level
:
cpLevel
,
Points
:
cp_e
.
CpLevelPoints
[
cpLevel
]
+
curPoints
,
StartPoints
:
cp_e
.
CpLevelPoints
[
cpLevel
],
EndPoints
:
nextPoints
,
ExpireAtUnix
:
expireAtUnix
,
SettlementDate
:
settlementDate
,
},
ResLevelList
:
cp_cv
.
CvResLevelList
,
PrivilegeList
:
privilegeList
,
}
response
.
CpInfo
=
cp_cv
.
CvCpInfo
{
UserInfo
:
user_cv
.
UserToTiny
(
*
userInfo
),
CpDays
:
cpDays
,
VisitTimes
:
visitTimes
,
ApplyToUnbind
:
applyToUnbind
,
}
if
cpUserInfo
!=
nil
{
response
.
CpInfo
.
CpUserInfo
=
user_cv
.
UserToTiny
(
*
cpUserInfo
)
}
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