This commit is contained in:
@@ -1,19 +1,5 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blazing/common/rpc"
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/cool"
|
||||
"blazing/logic/service/user"
|
||||
"blazing/modules/base/service"
|
||||
playerservice "blazing/modules/player/service"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"github.com/panjf2000/gnet/v2"
|
||||
)
|
||||
|
||||
// var sg singleflight.Group
|
||||
|
||||
// var ServerList []rpc.ServerInfo
|
||||
@@ -24,45 +10,45 @@ import (
|
||||
// }
|
||||
|
||||
// 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 {
|
||||
// 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
|
||||
}
|
||||
// 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() {
|
||||
// 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)
|
||||
// // share.ShareManager.DeleteSession(t1)
|
||||
|
||||
kickErr := ser.Info.Kick(data.Head.UserID)
|
||||
if kickErr != nil {
|
||||
fmt.Println("踢人失败", kickErr)
|
||||
// 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)
|
||||
// }
|
||||
// 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
|
||||
|
||||
//return //TODO 这里待实现改成接口调用Ret方法
|
||||
}
|
||||
// //return //TODO 这里待实现改成接口调用Ret方法
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user