30 lines
807 B
Go
30 lines
807 B
Go
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]
|
|
}
|