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
e4ce8b28
Commit
e4ce8b28
authored
Jul 26, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口优化
parent
359f4833
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
14 deletions
+34
-14
rank.go
cv/cp_cv/rank.go
+6
-6
user.go
cv/user_cv/user.go
+20
-0
rank.go
route/cp_r/rank.go
+8
-8
No files found.
cv/cp_cv/rank.go
View file @
e4ce8b28
...
...
@@ -6,12 +6,12 @@ import (
)
type
CvCpRank
struct
{
CpId
uint64
`json:"cpId"`
// cpId
User1
*
user_cv
.
CvUser
Bas
e
`json:"user1"`
// user1
User2
*
user_cv
.
CvUser
Bas
e
`json:"user2,omitempty"`
// user2
Score
uint32
`json:"score"`
// 分值
CpLevel
CvCpLevel
`json:"cpLevel"`
// cp等级
Ranking
string
`json:"ranking"`
// 排名
CpId
uint64
`json:"cpId"`
// cpId
User1
*
user_cv
.
CvUser
Littl
e
`json:"user1"`
// user1
User2
*
user_cv
.
CvUser
Littl
e
`json:"user2,omitempty"`
// user2
Score
uint32
`json:"score"`
// 分值
CpLevel
CvCpLevel
`json:"cpLevel"`
// cp等级
Ranking
string
`json:"ranking"`
// 排名
}
type
CvCpAchievement
struct
{
...
...
cv/user_cv/user.go
View file @
e4ce8b28
...
...
@@ -111,6 +111,17 @@ type CvUserBase struct {
GroupRole
common
.
GroupRoleType
`json:"groupRole"`
// 在群组的角色
}
type
CvUserLittle
struct
{
//不会有返回值
Id
*
mysql
.
ID
`json:"id,omitempty"`
//头像,不存在为nil
Avatar
*
string
`json:"avatar"`
//用户对外ID
ExternalId
*
string
`json:"externalId"`
//昵称,不存在为nil
Nick
*
string
`json:"nick"`
}
//批量获取用户基本信息
func
GetUserBases
(
userIds
[]
mysql
.
ID
,
myUserId
mysql
.
ID
)
([]
*
CvUserBase
,
error
)
{
if
len
(
userIds
)
==
0
{
...
...
@@ -516,3 +527,12 @@ type CvCpLevel struct {
type
CvPrivilege
struct
{
Type
cp_e
.
CpPrivilege
`json:"type"`
// 特权id 1:空间 2:横幅 3:等级勋章 4:证书 5:进场特效 6:头像头饰 7:动态资料卡 8:麦位特效
}
func
UserBaseToUserLittle
(
base
*
CvUserBase
)
*
CvUserLittle
{
return
&
CvUserLittle
{
Id
:
base
.
Id
,
Avatar
:
base
.
Avatar
,
ExternalId
:
base
.
ExternalId
,
Nick
:
base
.
Nick
,
}
}
route/cp_r/rank.go
View file @
e4ce8b28
...
...
@@ -81,8 +81,8 @@ func CpRank(c *gin.Context) (*mycontext.MyContext, error) {
for
i
,
rank
:=
range
ranks
{
response
=
append
(
response
,
cp_cv
.
CvCpRank
{
CpId
:
rank
.
CpId
,
User1
:
user
Base
[
rank
.
UserId1
]
,
User2
:
user
Base
[
rank
.
UserId2
]
,
User1
:
user
_cv
.
UserBaseToUserLittle
(
userBase
[
rank
.
UserId1
])
,
User2
:
user
_cv
.
UserBaseToUserLittle
(
userBase
[
rank
.
UserId2
])
,
Score
:
rank
.
Score
,
Ranking
:
fmt
.
Sprintf
(
"%d"
,
i
+
1
+
offset
),
CpLevel
:
cp_cv
.
CvCpLevel
{
...
...
@@ -143,8 +143,8 @@ func CpTop3(c *gin.Context) (*mycontext.MyContext, error) {
if
queryType
==
"day"
{
response
.
Day
=
append
(
response
.
Day
,
cp_cv
.
CvCpRank
{
CpId
:
rank
.
CpId
,
User1
:
user
Base
[
rank
.
UserId1
]
,
User2
:
user
Base
[
rank
.
UserId2
]
,
User1
:
user
_cv
.
UserBaseToUserLittle
(
userBase
[
rank
.
UserId1
])
,
User2
:
user
_cv
.
UserBaseToUserLittle
(
userBase
[
rank
.
UserId2
])
,
Score
:
rank
.
Score
,
Ranking
:
fmt
.
Sprintf
(
"%d"
,
i
+
1
+
offset
),
CpLevel
:
cp_cv
.
CvCpLevel
{
...
...
@@ -154,8 +154,8 @@ func CpTop3(c *gin.Context) (*mycontext.MyContext, error) {
}
else
{
response
.
Week
=
append
(
response
.
Week
,
cp_cv
.
CvCpRank
{
CpId
:
rank
.
CpId
,
User1
:
user
Base
[
rank
.
UserId1
]
,
User2
:
user
Base
[
rank
.
UserId2
]
,
User1
:
user
_cv
.
UserBaseToUserLittle
(
userBase
[
rank
.
UserId1
])
,
User2
:
user
_cv
.
UserBaseToUserLittle
(
userBase
[
rank
.
UserId2
])
,
Score
:
rank
.
Score
,
Ranking
:
fmt
.
Sprintf
(
"%d"
,
i
+
1
+
offset
),
CpLevel
:
cp_cv
.
CvCpLevel
{
...
...
@@ -224,10 +224,10 @@ func CpMy(c *gin.Context) (*mycontext.MyContext, error) {
Score
:
scores
,
}
if
relation
.
UserId1
>
0
{
response
.
User1
=
user
Bases
[
relation
.
UserId1
]
response
.
User1
=
user
_cv
.
UserBaseToUserLittle
(
userBases
[
relation
.
UserId1
])
}
if
relation
.
UserId2
>
0
{
response
.
User2
=
user
Bases
[
relation
.
UserId2
]
response
.
User2
=
user
_cv
.
UserBaseToUserLittle
(
userBases
[
relation
.
UserId2
])
response
.
Ranking
=
"30+"
ranks
:=
cp_m
.
PageCpDayRank
(
model
,
beginDate
,
endDate
,
0
,
30
)
for
i
,
rank
:=
range
ranks
{
...
...
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