Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
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
hujiebin
hilo-group
Commits
41a0b694
Commit
41a0b694
authored
Mar 20, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:rankTop
parent
1f15d4a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletion
+67
-1
group_rank.go
cv/group_power_cv/group_rank.go
+5
-0
group_rank.go
route/group_power_r/group_rank.go
+61
-1
router.go
route/router.go
+1
-0
No files found.
cv/group_power_cv/group_rank.go
View file @
41a0b694
...
...
@@ -40,6 +40,11 @@ type CvGroupPowerRank struct {
Items
[]
CvGroupPowerRankData
`json:"items"`
// 列表
}
type
CvGroupPowerRankTop3
struct
{
Period
string
`json:"period"`
// 榜单周期 day:日 week:周 month:月
Items
[]
CvGroupPowerRankData
`json:"items"`
// 列表
}
type
CvGroupPowerRankData
struct
{
CvGroupPowerBase
`json:",inline"`
CvGroupPowerGrade
`json:",inline"`
...
...
route/group_power_r/group_rank.go
View file @
41a0b694
...
...
@@ -24,7 +24,7 @@ import (
// @Param token header string true "token"
// @Param nonce header string true "随机数字"
// @Param period path string true "榜单周期 day:日 week:周 month:月"
// @Success 200 {object}
group_power_cv.CvGroupPowerRank
// @Success 200 {object}
[]group_power_cv.CvGroupPowerRankTop3
// @Router /v1/groupPower/rank/{period} [get]
func
GroupPowerRank
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
...
...
@@ -107,6 +107,66 @@ func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
nil
}
// @Tags 国家势力
// @Summary 家族日周月榜单top3
// @Param token header string true "token"
// @Param nonce header string true "随机数字"
// @Success 200 {object} []group_power_cv.CvGroupPowerRankTop3
// @Router /v1/groupPower/rankTop [get]
func
GroupPowerRankTop
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
periods
:=
[]
string
{
"day"
,
"week"
,
"month"
}
var
response
[]
group_power_cv
.
CvGroupPowerRankTop3
for
_
,
period
:=
range
periods
{
var
beginDate
,
endDate
string
switch
period
{
case
"day"
:
beginDate
,
endDate
=
time
.
Now
()
.
Format
(
"2006-01-02"
),
time
.
Now
()
.
Format
(
"2006-01-02"
)
case
"week"
:
beginDate
,
endDate
=
utils
.
GetMonday
(
time
.
Now
())
.
Format
(
"2006-01-02"
),
utils
.
GetMonday
(
time
.
Now
())
.
AddDate
(
0
,
0
,
6
)
.
Format
(
"2006-01-02"
)
case
"month"
:
beginDate
,
endDate
=
now
.
BeginningOfMonth
()
.
Format
(
"2006-01-02"
),
now
.
EndOfMonth
()
.
Format
(
"2006-01-02"
)
}
var
model
=
domain
.
CreateModelContext
(
myContext
)
rank
,
err
:=
groupPower_m
.
GetGroupPowerExpRank
(
model
,
beginDate
,
endDate
,
3
)
if
err
!=
nil
{
return
myContext
,
err
}
var
ids
[]
mysql
.
ID
for
_
,
g
:=
range
rank
{
ids
=
append
(
ids
,
g
.
GroupPowerId
)
}
grades
,
err
:=
groupPower_m
.
MGetGroupPowerGrade
(
model
,
ids
)
if
err
!=
nil
{
return
myContext
,
err
}
groupPowers
,
err
:=
groupPower_m
.
MGetGroupPowerInfoMap
(
model
,
ids
)
if
err
!=
nil
{
return
myContext
,
err
}
data
:=
group_power_cv
.
CvGroupPowerRankTop3
{
Period
:
period
}
for
_
,
v
:=
range
rank
{
data
.
Items
=
append
(
data
.
Items
,
group_power_cv
.
CvGroupPowerRankData
{
CvGroupPowerBase
:
group_power_cv
.
CvGroupPowerBase
{
Id
:
v
.
GroupPowerId
,
Icon
:
groupPowers
[
v
.
GroupPowerId
]
.
Icon
,
Name
:
groupPowers
[
v
.
GroupPowerId
]
.
Name
,
Nameplate
:
groupPowers
[
v
.
GroupPowerId
]
.
Nameplate
,
},
CvGroupPowerGrade
:
group_power_cv
.
CvGroupPowerGrade
{
Grade
:
grades
[
v
.
GroupPowerId
]
.
Grade
,
Exp
:
v
.
Exp
,
},
Rank
:
v
.
Rank
,
})
}
response
=
append
(
response
,
data
)
}
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
}
type
GroupPowerStarReq
struct
{
GroupPowerId
mysql
.
ID
`form:"groupPowerId" binding:"required"`
Type
groupPower_e
.
GroupPowerStarType
`form:"type" binding:"required"`
...
...
route/router.go
View file @
41a0b694
...
...
@@ -137,6 +137,7 @@ func InitRouter() *gin.Engine {
groupPower
.
GET
(
"/quit/list"
,
wrapper
(
group_power_r
.
GroupPowerQuitList
))
groupPower
.
POST
(
"/admin"
,
wrapper
(
group_power_r
.
GroupPowerSetAdmin
))
groupPower
.
GET
(
"/rank/:period"
,
wrapper
(
group_power_r
.
GroupPowerRank
))
groupPower
.
GET
(
"/rankTop"
,
wrapper
(
group_power_r
.
GroupPowerRankTop
))
groupPower
.
GET
(
"/star"
,
wrapper
(
group_power_r
.
GroupPowerStar
))
groupPower
.
POST
(
"/info/set"
,
wrapper
(
group_power_r
.
GroupPowerSetInfo
))
}
...
...
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