55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package controller
|
|
|
|
// var sg singleflight.Group
|
|
|
|
// var ServerList []rpc.ServerInfo
|
|
|
|
// func fetchData() (any, error) {
|
|
// ServerList = rpc.GetServerInfoList() //todo 待修改增加缓存
|
|
// return ServerList, nil
|
|
// }
|
|
|
|
// GetServerOnline 处理命令: 105
|
|
// func (h Controller) GetServerOnline(data *user.SidInfo, c gnet.Conn) (result *rpc.CommendSvrInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
// result = rpc.NewInInfo()
|
|
// // tt, _ := cool.CacheManager.Keys(context.Background())
|
|
// //g.Dump(tt)
|
|
// t1 := hex.EncodeToString(data.Sid)
|
|
// userid, ok := playerservice.User.Load(t1)
|
|
// if !ok || userid != data.Head.UserID {
|
|
|
|
// defer c.Close()
|
|
// return
|
|
// }
|
|
|
|
// result.IsVip = 1
|
|
// result.ServerList = rpc.GetServerInfoList(service.NewBaseSysUserService().GetPerson(data.Head.UserID).Debug)
|
|
// ser := playerservice.NewUserService(data.Head.UserID)
|
|
// f, b := ser.Friend.Get()
|
|
// for _, v := range f {
|
|
// result.FriendInfo = append(result.FriendInfo, rpc.FriendInfo{Userid: v, TimePoke: 1})
|
|
// }
|
|
// result.BlackInfo = b
|
|
// defer func() {
|
|
|
|
// // share.ShareManager.DeleteSession(t1)
|
|
|
|
// kickErr := ser.Info.Kick(data.Head.UserID)
|
|
// if kickErr != nil {
|
|
// fmt.Println("踢人失败", kickErr)
|
|
|
|
// }
|
|
// logininfo := ser.Info.SetLogin()
|
|
// if logininfo != nil {
|
|
// cool.CacheManager.Set(context.TODO(), fmt.Sprintf("player:%d", data.Head.UserID), logininfo, 0)
|
|
// cool.CacheManager.Set(context.Background(), fmt.Sprintf("session:%d", data.Head.UserID), t1, 0)
|
|
|
|
// }
|
|
|
|
// }()
|
|
|
|
// return
|
|
|
|
// //return //TODO 这里待实现改成接口调用Ret方法
|
|
// }
|