Files
bl/common/cool/user.go
昔念 4751594ee8 ```
feat: 更新战斗系统模型结构和Redis消息处理

- 引入gredis依赖用于Redis消息处理
- 将战斗相关的枚举和结构体从info包迁移到model包
- 更新战斗结束原因、攻击值等类型的引用路径
- 添加新的zset工具包到工作区
- 修改Redis消息处理逻辑以正确解析gredis.Message类型
- 在战斗控制器中统一使用model包下的类型定义
2026-03-04 22:47:21 +08:00

26 lines
424 B
Go

package cool
import "github.com/liwnn/zset"
type User struct {
JoinTime int64
ID int
Score int
}
func (u User) Key() uint32 {
return uint32(u.ID)
}
// 如果分数不对的话,就按时间排序
func (u User) Less(than User) bool {
if u.Score == than.Score {
return u.JoinTime < than.JoinTime
}
return u.Score < than.Score
}
var zs = zset.New[uint32, User](func(a, b User) bool {
return a.Less(b)
})