39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package model
|
||
|
||
// 该类将玩家与网关绑定以及保存token这些事情混在一起了,绑定关系由userBindService提供。token这些由login服提供
|
||
|
||
//type UserGate struct {
|
||
// GateName string `json:"gate_name"`
|
||
// Token string `json:"token"`
|
||
// OnlineTime utils.Time `json:"online"`
|
||
// rdb *redis.Client
|
||
//}
|
||
//
|
||
//func NewUserGate() *UserGate {
|
||
// return &UserGate{rdb: UserRedis}
|
||
//}
|
||
//
|
||
//func (u *UserGate) key(userId int64, gateId string) string {
|
||
// return fmt.Sprintf("gateway:%v:%v", gateId, userId)
|
||
//}
|
||
//
|
||
//func (u *UserGate) Set(userId int64, gateId string, token string) {
|
||
// u.GateName = gateId
|
||
// u.Token = token
|
||
// u.OnlineTime = utils.Time(time.Now())
|
||
// u.rdb.Set(context.Background(), u.key(userId, gateId), utils.Marshal(u), time.Hour*24)
|
||
//}
|
||
//
|
||
//func (u *UserGate) Get(userId int64, gateId string) (*UserGate, error) {
|
||
// s, err := u.rdb.Get(context.Background(), u.key(userId, gateId)).Result()
|
||
// if err != nil {
|
||
// return u, err
|
||
// }
|
||
// err = json.Unmarshal([]byte(s), u)
|
||
// return u, err
|
||
//}
|
||
//
|
||
//func (u *UserGate) Del(userId int64, gateId string) {
|
||
// _, _ = u.rdb.Del(context.Background(), u.key(userId, gateId)).Result()
|
||
//}
|