feat(app): update
This commit is contained in:
29
pkg/dto/response/GetHostGuardListResponse.go
Normal file
29
pkg/dto/response/GetHostGuardListResponse.go
Normal file
@ -0,0 +1,29 @@
|
||||
package response
|
||||
|
||||
type GetHostGuardListResponse struct {
|
||||
UserId string
|
||||
Avatar string
|
||||
NickName string
|
||||
TimeDiff string
|
||||
GoldGuardTime string `json:"GoldGuardTime,omitempty"`
|
||||
SilverGuardTime string `json:"SilverGuardTime,omitempy"`
|
||||
BronzeGuardTime string `json:"BronzeGuardTime,omitempy"`
|
||||
TotalGuardValue int `json:"-"`
|
||||
}
|
||||
|
||||
type HostGuardListResponseList []GetHostGuardListResponse
|
||||
|
||||
// 获取此 slice 的长度
|
||||
func (p HostGuardListResponseList) Len() int {
|
||||
return len(p)
|
||||
}
|
||||
|
||||
// 根据实时分钟流水降序排序 (此处按照自己的业务逻辑写)
|
||||
func (p HostGuardListResponseList) Less(i, j int) bool {
|
||||
return p[i].TotalGuardValue > p[j].TotalGuardValue
|
||||
}
|
||||
|
||||
// 交换数据
|
||||
func (p HostGuardListResponseList) Swap(i, j int) {
|
||||
p[i], p[j] = p[j], p[i]
|
||||
}
|
||||
Reference in New Issue
Block a user