feat 踢人功能
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.hlsq.asia/mmorpg/service-common/db/redis"
|
||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/service"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/ss/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-gateway/internal/global"
|
||||
"git.hlsq.asia/mmorpg/service-gateway/internal/grpc_server/stream_client"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"time"
|
||||
@@ -42,6 +46,7 @@ func (c *Client) handle(event Event) {
|
||||
if c.Status == 0 {
|
||||
c.Status = 1
|
||||
UserMgr.Add(c.USN, c)
|
||||
redis.GetClient().HSet(c.ctx, fmt.Sprintf(global.KeyGatewayInfo, c.USN), global.HFieldInfoGatewaySID, GatewaySID)
|
||||
c.WriteMessage(sc_pb.MessageID_MESSAGE_ID_LOGIN_SUCCESS, &sc_pb.S2C_LoginSuccess{
|
||||
InstanceID: 1,
|
||||
})
|
||||
@@ -79,7 +84,7 @@ func (c *Client) onLeave() {
|
||||
c.logger.Errorf("SceneNewClient err: %v", err)
|
||||
return
|
||||
}
|
||||
_, err = client.Leave(c.ctx, &grpc_pb.LeaveReq{
|
||||
_, err = client.Leave(context.Background(), &grpc_pb.LeaveReq{
|
||||
USN: c.USN,
|
||||
UniqueNo: c.UniqueNo,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user