Browse Source

v0.0.1开发:rpcbff服务构建

#Suyghur 3 years ago
parent
commit
5e490bd073

+ 63 - 56
bff/apibff/api/desc/apibff.api

@@ -1,83 +1,90 @@
 syntax = "v1"
 
 info(
-	title: "api前端服务"
-	desc: "api前端服务 "
-	author: "#Suyghur"
-	version: "v1"
+    title: "api前端服务"
+    desc: "api前端服务 "
+    author: "#Suyghur"
+    version: "v1"
 )
 
 import (
-	"comm/comm.api"
-	"cmd/cmd.api"
+    "cmd.api"
 )
 
+type CommResp {
+    Code int `json:"code"`
+    Msg string `json:"msg"`
+    Data interface{} `json:"data"`
+}
+
 @server(
-	group: player/login
-	prefix: api/v1
+    group: player/login
+    prefix: api/v1
 )
 service apibff {
-	@doc "玩家登录"
-	@handler playerLogin
-	post /player/login (PlayerLoginInfo) returns (CommResp)
+    @doc "玩家登录"
+    @handler playerLogin
+    post /player/login (PlayerLoginInfo) returns (CommResp)
 }
 
 @server(
-	group: player/cmd
-	prefix: api/v1
-	jwt: Auth
+    group: player/cmd
+    prefix: api/v1
+    jwt: Auth
 )
 service apibff {
-	@doc "玩家连接客服(vip)"
-	@handler playerConnect
-	post /player/connect (PlayerConnectReq) returns (CommResp)
-	
-	@doc "玩家发送信息"
-	@handler playerSend
-	post /player/send (ChatMsgReq) returns (CommResp)
-	
-	@doc "玩家断开连接"
-	@handler playerDisconnect
-	post /player/disconnect (PlayerDisconnectReq) returns (CommResp)
-	
-	@doc "玩家登出"
-	@handler playerLogout
-	post /player/logout returns (CommResp)
+    @doc "玩家连接客服"
+    @handler playerConnect
+    post /player/connect (PlayerConnectReq) returns (CommResp)
+
+    @doc "玩家发送信息"
+    @handler playerSend
+    post /player/send (ChatMsgReq) returns (CommResp)
+
+    @doc "玩家断开连接"
+    @handler playerDisconnect
+    post /player/disconnect returns (CommResp)
+
+
+
+    @doc "玩家登出"
+    @handler playerLogout
+    post /player/logout returns (CommResp)
 }
 
 @server(
-	group : cs/login
-	prefix : api/v1
+    group : cs/login
+    prefix : api/v1
 )
 service apibff {
-	@doc "客服登录"
-	@handler csLogin
-	post /cs/login (CsLoginInfo) returns (CommResp)
+    @doc "客服登录"
+    @handler csLogin
+    post /cs/login (CsLoginInfo) returns (CommResp)
 }
 
 @server(
-	group : cs/cmd
-	prefix : api/v1
-	jwt : Auth
+    group : cs/cmd
+    prefix : api/v1
+    jwt : Auth
 )
 service apibff {
-	@doc "获取等待玩家列表"
-	@handler csFetchQueue
-	post /cs/fetch_queue returns (CommResp)
-	
-	@doc "客服连接玩家"
-	@handler csConnect
-	post /cs/connect (CsConnectReq) returns (CommResp)
-	
-	@doc "客服发送信息"
-	@handler csSend
-	post /cs/send (ChatMsgReq) returns (CommResp)
-	
-	@doc "客服断开连接"
-	@handler csDisconnect
-	post /cs/disconnect (CsDisconnectReq) returns (CommResp)
-	
-	@doc "客服登出"
-	@handler csLogout
-	post /cs/logout returns (CommResp)
+    @doc "获取等待玩家列表"
+    @handler csFetchQueue
+    post /cs/fetch_queue returns (CommResp)
+
+    @doc "客服连接玩家"
+    @handler csConnect
+    post /cs/connect (CsConnectReq) returns (CommResp)
+
+    @doc "客服发送信息"
+    @handler csSend
+    post /cs/send (ChatMsgReq) returns (CommResp)
+
+    @doc "客服断开连接"
+    @handler csDisconnect
+    post /cs/disconnect (CsDisconnectReq) returns (CommResp)
+
+    @doc "客服登出"
+    @handler csLogout
+    post /cs/logout returns (CommResp)
 }

+ 10 - 6
bff/apibff/api/desc/cmd/cmd.api → bff/apibff/api/desc/cmd.api

@@ -13,13 +13,19 @@ type (
         GameId string `json:"game_id"`
     }
 
-    PlayerConnectReq {
-        CsId string `json:"cs_id"`
+    PlayerInfo {
+        GameId string `json:"game_id"`
+        PlayerId string `json:"player_id"`
+        PlayerName string `json:"player_name"`
+        PlayerPower string `json:"player_power"`
+        PlayerVipLevel string `json:"player_vip_level"`
+        PlayerRechargeAmount string `json:"player_recharge_amount"`
+        ServerId string `json:"server_id"`
+        ServerName string `json:"server_name"`
     }
 
-    PlayerDisconnectReq {
+    PlayerConnectReq {
         CsId string `json:"cs_id"`
-        ChatId string `json:"chat_id"`
     }
 
     CsLoginInfo {
@@ -34,11 +40,9 @@ type (
 
     CsDisconnectReq {
         PlayerId string `json:"player_id"`
-        ChatId string `json:"chat_id"`
     }
 
     ChatMsgReq {
-        ChatId string `form:"chat_id"`
         Text string `form:"msg"`
         Pic string `form:"pic,optional"`
     }

+ 0 - 15
bff/apibff/api/desc/comm/comm.api

@@ -1,15 +0,0 @@
-syntax = "v1"
-
-info(
-    title: "公共实例"
-    desc: "公共实例"
-    author: "#Suyghur"
-)
-
-type (
-    CommResp {
-        Code int `json:"code"`
-        Msg string `json:"msg"`
-        Data interface{} `json:"data"`
-    }
-)

+ 1 - 1
bff/apibff/api/etc/apibff.yaml

@@ -13,7 +13,7 @@ Port: 8001
 GatewayRpcConf:
   Etcd:
     Hosts:
-      - 127.0.0.1:2379
+      - 101.33.209.36:2379
     Key: gateway.rpc
 
 Auth:

+ 1 - 1
bff/rpcbff/etc/rpcbff.yaml

@@ -1,5 +1,5 @@
 Name: rpcbff.rpc
-ListenOn: 127.0.0.1:8080
+ListenOn: 0.0.0.0:10001
 Etcd:
   Hosts:
   - 127.0.0.1:2379

+ 41 - 0
bff/rpcbff/internal/logic/connectlogic.go

@@ -0,0 +1,41 @@
+package logic
+
+import (
+	"context"
+	"google.golang.org/protobuf/types/known/structpb"
+
+	"ylink/bff/rpcbff/internal/svc"
+	"ylink/bff/rpcbff/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ConnectLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewConnectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConnectLogic {
+	return &ConnectLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *ConnectLogic) Connect(in *pb.CommandReq, stream pb.Rpcbff_ConnectServer) error {
+	// todo: 验证token
+	// todo: 把stream放入资源pool
+
+	l.Logger.Info("invoke func connect")
+	l.Logger.Infof("%s", in.Token)
+
+	data, _ := structpb.NewStruct(map[string]interface{}{})
+
+	return stream.Send(&pb.CommandResp{
+		CommandCode: 0,
+		CommandMsg:  "success",
+		CommandData: data,
+	})
+}

+ 40 - 0
bff/rpcbff/internal/logic/disconnectlogic.go

@@ -0,0 +1,40 @@
+package logic
+
+import (
+	"context"
+	"google.golang.org/protobuf/types/known/structpb"
+
+	"ylink/bff/rpcbff/internal/svc"
+	"ylink/bff/rpcbff/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type DisconnectLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewDisconnectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DisconnectLogic {
+	return &DisconnectLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *DisconnectLogic) Disconnect(in *pb.CommandReq) (*pb.CommandResp, error) {
+	// todo: 验证token
+	// todo: 把关联的stream从资源pool中移除
+
+	l.Logger.Info("invoke func disconnect")
+	l.Logger.Infof("%s", in.Token)
+
+	data, _ := structpb.NewStruct(map[string]interface{}{})
+	return &pb.CommandResp{
+		CommandCode: 0,
+		CommandMsg:  "success",
+		CommandData: data,
+	}, nil
+}

+ 0 - 30
bff/rpcbff/internal/logic/receiverchatmsglogic.go

@@ -1,30 +0,0 @@
-package logic
-
-import (
-	"context"
-
-	"ylink/bff/rpcbff/internal/svc"
-	"ylink/bff/rpcbff/pb"
-
-	"github.com/zeromicro/go-zero/core/logx"
-)
-
-type ReceiverChatMsgLogic struct {
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-	logx.Logger
-}
-
-func NewReceiverChatMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReceiverChatMsgLogic {
-	return &ReceiverChatMsgLogic{
-		ctx:    ctx,
-		svcCtx: svcCtx,
-		Logger: logx.WithContext(ctx),
-	}
-}
-
-func (l *ReceiverChatMsgLogic) ReceiverChatMsg(in *pb.ChatMsgReq, stream pb.Rpcbff_ReceiverChatMsgServer) error {
-	// todo: add your logic here and delete this line
-
-	return nil
-}

+ 10 - 3
bff/rpcbff/internal/server/rpcbffserver.go

@@ -4,6 +4,8 @@
 package server
 
 import (
+	"context"
+
 	"ylink/bff/rpcbff/internal/logic"
 	"ylink/bff/rpcbff/internal/svc"
 	"ylink/bff/rpcbff/pb"
@@ -20,7 +22,12 @@ func NewRpcbffServer(svcCtx *svc.ServiceContext) *RpcbffServer {
 	}
 }
 
-func (s *RpcbffServer) ReceiverChatMsg(in *pb.ChatMsgReq, stream pb.Rpcbff_ReceiverChatMsgServer) error {
-	l := logic.NewReceiverChatMsgLogic(stream.Context(), s.svcCtx)
-	return l.ReceiverChatMsg(in, stream)
+func (s *RpcbffServer) Connect(in *pb.CommandReq, stream pb.Rpcbff_ConnectServer) error {
+	l := logic.NewConnectLogic(stream.Context(), s.svcCtx)
+	return l.Connect(in, stream)
+}
+
+func (s *RpcbffServer) Disconnect(ctx context.Context, in *pb.CommandReq) (*pb.CommandResp, error) {
+	l := logic.NewDisconnectLogic(ctx, s.svcCtx)
+	return l.Disconnect(in)
 }

+ 75 - 53
bff/rpcbff/pb/rpcbff.pb.go

@@ -9,6 +9,7 @@ package pb
 import (
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+	structpb "google.golang.org/protobuf/types/known/structpb"
 	reflect "reflect"
 	sync "sync"
 )
@@ -20,16 +21,18 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
-type ChatMsgReq struct {
+type CommandResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
+	CommandCode int64            `protobuf:"varint,1,opt,name=command_code,json=commandCode,proto3" json:"command_code,omitempty"`
+	CommandMsg  string           `protobuf:"bytes,2,opt,name=command_msg,json=commandMsg,proto3" json:"command_msg,omitempty"`
+	CommandData *structpb.Struct `protobuf:"bytes,3,opt,name=command_data,json=commandData,proto3" json:"command_data,omitempty"`
 }
 
-func (x *ChatMsgReq) Reset() {
-	*x = ChatMsgReq{}
+func (x *CommandResp) Reset() {
+	*x = CommandResp{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_pb_rpcbff_proto_msgTypes[0]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -37,13 +40,13 @@ func (x *ChatMsgReq) Reset() {
 	}
 }
 
-func (x *ChatMsgReq) String() string {
+func (x *CommandResp) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*ChatMsgReq) ProtoMessage() {}
+func (*CommandResp) ProtoMessage() {}
 
-func (x *ChatMsgReq) ProtoReflect() protoreflect.Message {
+func (x *CommandResp) ProtoReflect() protoreflect.Message {
 	mi := &file_pb_rpcbff_proto_msgTypes[0]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -55,29 +58,42 @@ func (x *ChatMsgReq) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use ChatMsgReq.ProtoReflect.Descriptor instead.
-func (*ChatMsgReq) Descriptor() ([]byte, []int) {
+// Deprecated: Use CommandResp.ProtoReflect.Descriptor instead.
+func (*CommandResp) Descriptor() ([]byte, []int) {
 	return file_pb_rpcbff_proto_rawDescGZIP(), []int{0}
 }
 
-func (x *ChatMsgReq) GetChatId() string {
+func (x *CommandResp) GetCommandCode() int64 {
 	if x != nil {
-		return x.ChatId
+		return x.CommandCode
+	}
+	return 0
+}
+
+func (x *CommandResp) GetCommandMsg() string {
+	if x != nil {
+		return x.CommandMsg
 	}
 	return ""
 }
 
-type ChatMsgReqResp struct {
+func (x *CommandResp) GetCommandData() *structpb.Struct {
+	if x != nil {
+		return x.CommandData
+	}
+	return nil
+}
+
+type CommandReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
-	Pic  string `protobuf:"bytes,2,opt,name=pic,proto3" json:"pic,omitempty"`
+	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
 }
 
-func (x *ChatMsgReqResp) Reset() {
-	*x = ChatMsgReqResp{}
+func (x *CommandReq) Reset() {
+	*x = CommandReq{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_pb_rpcbff_proto_msgTypes[1]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -85,13 +101,13 @@ func (x *ChatMsgReqResp) Reset() {
 	}
 }
 
-func (x *ChatMsgReqResp) String() string {
+func (x *CommandReq) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*ChatMsgReqResp) ProtoMessage() {}
+func (*CommandReq) ProtoMessage() {}
 
-func (x *ChatMsgReqResp) ProtoReflect() protoreflect.Message {
+func (x *CommandReq) ProtoReflect() protoreflect.Message {
 	mi := &file_pb_rpcbff_proto_msgTypes[1]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -103,21 +119,14 @@ func (x *ChatMsgReqResp) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use ChatMsgReqResp.ProtoReflect.Descriptor instead.
-func (*ChatMsgReqResp) Descriptor() ([]byte, []int) {
+// Deprecated: Use CommandReq.ProtoReflect.Descriptor instead.
+func (*CommandReq) Descriptor() ([]byte, []int) {
 	return file_pb_rpcbff_proto_rawDescGZIP(), []int{1}
 }
 
-func (x *ChatMsgReqResp) GetText() string {
-	if x != nil {
-		return x.Text
-	}
-	return ""
-}
-
-func (x *ChatMsgReqResp) GetPic() string {
+func (x *CommandReq) GetToken() string {
 	if x != nil {
-		return x.Pic
+		return x.Token
 	}
 	return ""
 }
@@ -126,18 +135,27 @@ var File_pb_rpcbff_proto protoreflect.FileDescriptor
 
 var file_pb_rpcbff_proto_rawDesc = []byte{
 	0x0a, 0x0f, 0x70, 0x62, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x25, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67,
-	0x52, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x0e,
-	0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12,
-	0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65,
-	0x78, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x03, 0x70, 0x69, 0x63, 0x32, 0x41, 0x0a, 0x06, 0x72, 0x70, 0x63, 0x62, 0x66, 0x66, 0x12, 0x37,
-	0x0a, 0x0f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73,
-	0x67, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x52, 0x65,
-	0x71, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x52, 0x65,
-	0x71, 0x52, 0x65, 0x73, 0x70, 0x30, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
-	0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,
+	0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72,
+	0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x5f, 0x63,
+	0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
+	0x6e, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
+	0x64, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d,
+	0x6d, 0x61, 0x6e, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x3a, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
+	0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
+	0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+	0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44,
+	0x61, 0x74, 0x61, 0x22, 0x22, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65,
+	0x71, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0x65, 0x0a, 0x06, 0x52, 0x70, 0x63, 0x62, 0x66,
+	0x66, 0x12, 0x2c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x0e, 0x2e, 0x70,
+	0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70,
+	0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x30, 0x01, 0x12,
+	0x2d, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x0e, 0x2e,
+	0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e,
+	0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06,
+	0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -154,17 +172,21 @@ func file_pb_rpcbff_proto_rawDescGZIP() []byte {
 
 var file_pb_rpcbff_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
 var file_pb_rpcbff_proto_goTypes = []interface{}{
-	(*ChatMsgReq)(nil),     // 0: pb.ChatMsgReq
-	(*ChatMsgReqResp)(nil), // 1: pb.ChatMsgReqResp
+	(*CommandResp)(nil),     // 0: pb.CommandResp
+	(*CommandReq)(nil),      // 1: pb.CommandReq
+	(*structpb.Struct)(nil), // 2: google.protobuf.Struct
 }
 var file_pb_rpcbff_proto_depIdxs = []int32{
-	0, // 0: pb.rpcbff.receiverChatMsg:input_type -> pb.ChatMsgReq
-	1, // 1: pb.rpcbff.receiverChatMsg:output_type -> pb.ChatMsgReqResp
-	1, // [1:2] is the sub-list for method output_type
-	0, // [0:1] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
+	2, // 0: pb.CommandResp.command_data:type_name -> google.protobuf.Struct
+	1, // 1: pb.Rpcbff.connect:input_type -> pb.CommandReq
+	1, // 2: pb.Rpcbff.disconnect:input_type -> pb.CommandReq
+	0, // 3: pb.Rpcbff.connect:output_type -> pb.CommandResp
+	0, // 4: pb.Rpcbff.disconnect:output_type -> pb.CommandResp
+	3, // [3:5] is the sub-list for method output_type
+	1, // [1:3] is the sub-list for method input_type
+	1, // [1:1] is the sub-list for extension type_name
+	1, // [1:1] is the sub-list for extension extendee
+	0, // [0:1] is the sub-list for field type_name
 }
 
 func init() { file_pb_rpcbff_proto_init() }
@@ -174,7 +196,7 @@ func file_pb_rpcbff_proto_init() {
 	}
 	if !protoimpl.UnsafeEnabled {
 		file_pb_rpcbff_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*ChatMsgReq); i {
+			switch v := v.(*CommandResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -186,7 +208,7 @@ func file_pb_rpcbff_proto_init() {
 			}
 		}
 		file_pb_rpcbff_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*ChatMsgReqResp); i {
+			switch v := v.(*CommandReq); i {
 			case 0:
 				return &v.state
 			case 1:

+ 11 - 7
bff/rpcbff/pb/rpcbff.proto

@@ -4,15 +4,19 @@ option go_package = "./pb";
 
 package pb;
 
-message ChatMsgReq {
-  string chat_id = 1;
+import "google/protobuf/struct.proto";
+
+message CommandResp {
+  int64 command_code = 1;
+  string  command_msg = 2;
+  google.protobuf.Struct command_data = 3;
 }
 
-message ChatMsgReqResp {
-  string text = 1;
-  string pic = 2;
+message CommandReq {
+  string token = 1;
 }
 
-service rpcbff {
-  rpc receiverChatMsg(ChatMsgReq) returns (stream ChatMsgReqResp);
+service Rpcbff {
+  rpc connect(CommandReq) returns (stream CommandResp);
+  rpc disconnect(CommandReq) returns (CommandResp);
 }

+ 60 - 23
bff/rpcbff/pb/rpcbff_grpc.pb.go

@@ -22,7 +22,8 @@ const _ = grpc.SupportPackageIsVersion7
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
 type RpcbffClient interface {
-	ReceiverChatMsg(ctx context.Context, in *ChatMsgReq, opts ...grpc.CallOption) (Rpcbff_ReceiverChatMsgClient, error)
+	Connect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (Rpcbff_ConnectClient, error)
+	Disconnect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (*CommandResp, error)
 }
 
 type rpcbffClient struct {
@@ -33,12 +34,12 @@ func NewRpcbffClient(cc grpc.ClientConnInterface) RpcbffClient {
 	return &rpcbffClient{cc}
 }
 
-func (c *rpcbffClient) ReceiverChatMsg(ctx context.Context, in *ChatMsgReq, opts ...grpc.CallOption) (Rpcbff_ReceiverChatMsgClient, error) {
-	stream, err := c.cc.NewStream(ctx, &Rpcbff_ServiceDesc.Streams[0], "/pb.rpcbff/receiverChatMsg", opts...)
+func (c *rpcbffClient) Connect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (Rpcbff_ConnectClient, error) {
+	stream, err := c.cc.NewStream(ctx, &Rpcbff_ServiceDesc.Streams[0], "/pb.Rpcbff/connect", opts...)
 	if err != nil {
 		return nil, err
 	}
-	x := &rpcbffReceiverChatMsgClient{stream}
+	x := &rpcbffConnectClient{stream}
 	if err := x.ClientStream.SendMsg(in); err != nil {
 		return nil, err
 	}
@@ -48,28 +49,38 @@ func (c *rpcbffClient) ReceiverChatMsg(ctx context.Context, in *ChatMsgReq, opts
 	return x, nil
 }
 
-type Rpcbff_ReceiverChatMsgClient interface {
-	Recv() (*ChatMsgReqResp, error)
+type Rpcbff_ConnectClient interface {
+	Recv() (*CommandResp, error)
 	grpc.ClientStream
 }
 
-type rpcbffReceiverChatMsgClient struct {
+type rpcbffConnectClient struct {
 	grpc.ClientStream
 }
 
-func (x *rpcbffReceiverChatMsgClient) Recv() (*ChatMsgReqResp, error) {
-	m := new(ChatMsgReqResp)
+func (x *rpcbffConnectClient) Recv() (*CommandResp, error) {
+	m := new(CommandResp)
 	if err := x.ClientStream.RecvMsg(m); err != nil {
 		return nil, err
 	}
 	return m, nil
 }
 
+func (c *rpcbffClient) Disconnect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (*CommandResp, error) {
+	out := new(CommandResp)
+	err := c.cc.Invoke(ctx, "/pb.Rpcbff/disconnect", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // RpcbffServer is the server API for Rpcbff service.
 // All implementations must embed UnimplementedRpcbffServer
 // for forward compatibility
 type RpcbffServer interface {
-	ReceiverChatMsg(*ChatMsgReq, Rpcbff_ReceiverChatMsgServer) error
+	Connect(*CommandReq, Rpcbff_ConnectServer) error
+	Disconnect(context.Context, *CommandReq) (*CommandResp, error)
 	mustEmbedUnimplementedRpcbffServer()
 }
 
@@ -77,8 +88,11 @@ type RpcbffServer interface {
 type UnimplementedRpcbffServer struct {
 }
 
-func (UnimplementedRpcbffServer) ReceiverChatMsg(*ChatMsgReq, Rpcbff_ReceiverChatMsgServer) error {
-	return status.Errorf(codes.Unimplemented, "method ReceiverChatMsg not implemented")
+func (UnimplementedRpcbffServer) Connect(*CommandReq, Rpcbff_ConnectServer) error {
+	return status.Errorf(codes.Unimplemented, "method Connect not implemented")
+}
+func (UnimplementedRpcbffServer) Disconnect(context.Context, *CommandReq) (*CommandResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method Disconnect not implemented")
 }
 func (UnimplementedRpcbffServer) mustEmbedUnimplementedRpcbffServer() {}
 
@@ -93,38 +107,61 @@ func RegisterRpcbffServer(s grpc.ServiceRegistrar, srv RpcbffServer) {
 	s.RegisterService(&Rpcbff_ServiceDesc, srv)
 }
 
-func _Rpcbff_ReceiverChatMsg_Handler(srv interface{}, stream grpc.ServerStream) error {
-	m := new(ChatMsgReq)
+func _Rpcbff_Connect_Handler(srv interface{}, stream grpc.ServerStream) error {
+	m := new(CommandReq)
 	if err := stream.RecvMsg(m); err != nil {
 		return err
 	}
-	return srv.(RpcbffServer).ReceiverChatMsg(m, &rpcbffReceiverChatMsgServer{stream})
+	return srv.(RpcbffServer).Connect(m, &rpcbffConnectServer{stream})
 }
 
-type Rpcbff_ReceiverChatMsgServer interface {
-	Send(*ChatMsgReqResp) error
+type Rpcbff_ConnectServer interface {
+	Send(*CommandResp) error
 	grpc.ServerStream
 }
 
-type rpcbffReceiverChatMsgServer struct {
+type rpcbffConnectServer struct {
 	grpc.ServerStream
 }
 
-func (x *rpcbffReceiverChatMsgServer) Send(m *ChatMsgReqResp) error {
+func (x *rpcbffConnectServer) Send(m *CommandResp) error {
 	return x.ServerStream.SendMsg(m)
 }
 
+func _Rpcbff_Disconnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(CommandReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(RpcbffServer).Disconnect(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/pb.Rpcbff/disconnect",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(RpcbffServer).Disconnect(ctx, req.(*CommandReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Rpcbff_ServiceDesc is the grpc.ServiceDesc for Rpcbff service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
 var Rpcbff_ServiceDesc = grpc.ServiceDesc{
-	ServiceName: "pb.rpcbff",
+	ServiceName: "pb.Rpcbff",
 	HandlerType: (*RpcbffServer)(nil),
-	Methods:     []grpc.MethodDesc{},
+	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "disconnect",
+			Handler:    _Rpcbff_Disconnect_Handler,
+		},
+	},
 	Streams: []grpc.StreamDesc{
 		{
-			StreamName:    "receiverChatMsg",
-			Handler:       _Rpcbff_ReceiverChatMsg_Handler,
+			StreamName:    "connect",
+			Handler:       _Rpcbff_Connect_Handler,
 			ServerStreams: true,
 		},
 	},

+ 11 - 5
bff/rpcbff/rpcbff/rpcbff.go

@@ -13,11 +13,12 @@ import (
 )
 
 type (
-	ChatMsgReq     = pb.ChatMsgReq
-	ChatMsgReqResp = pb.ChatMsgReqResp
+	CommandReq  = pb.CommandReq
+	CommandResp = pb.CommandResp
 
 	Rpcbff interface {
-		ReceiverChatMsg(ctx context.Context, in *ChatMsgReq, opts ...grpc.CallOption) (pb.Rpcbff_ReceiverChatMsgClient, error)
+		Connect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (pb.Rpcbff_ConnectClient, error)
+		Disconnect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (*CommandResp, error)
 	}
 
 	defaultRpcbff struct {
@@ -31,7 +32,12 @@ func NewRpcbff(cli zrpc.Client) Rpcbff {
 	}
 }
 
-func (m *defaultRpcbff) ReceiverChatMsg(ctx context.Context, in *ChatMsgReq, opts ...grpc.CallOption) (pb.Rpcbff_ReceiverChatMsgClient, error) {
+func (m *defaultRpcbff) Connect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (pb.Rpcbff_ConnectClient, error) {
 	client := pb.NewRpcbffClient(m.cli.Conn())
-	return client.ReceiverChatMsg(ctx, in, opts...)
+	return client.Connect(ctx, in, opts...)
+}
+
+func (m *defaultRpcbff) Disconnect(ctx context.Context, in *CommandReq, opts ...grpc.CallOption) (*CommandResp, error) {
+	client := pb.NewRpcbffClient(m.cli.Conn())
+	return client.Disconnect(ctx, in, opts...)
 }

+ 0 - 6
gateway/rpc/etc/gateway.yaml

@@ -1,6 +0,0 @@
-Name: gateway.rpc
-ListenOn: 0.0.0.0:9001
-Etcd:
-  Hosts:
-    - 127.0.0.1:2379
-  Key: gateway.rpc

+ 0 - 40
gateway/rpc/gateway.go

@@ -1,40 +0,0 @@
-package main
-
-import (
-	"flag"
-	"fmt"
-
-	"ylink/gateway/rpc/internal/config"
-	"ylink/gateway/rpc/internal/server"
-	"ylink/gateway/rpc/internal/svc"
-	"ylink/gateway/rpc/pb"
-
-	"github.com/zeromicro/go-zero/core/conf"
-	"github.com/zeromicro/go-zero/core/service"
-	"github.com/zeromicro/go-zero/zrpc"
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/reflection"
-)
-
-var configFile = flag.String("f", "etc/gateway.yaml", "the config file")
-
-func main() {
-	flag.Parse()
-
-	var c config.Config
-	conf.MustLoad(*configFile, &c)
-	ctx := svc.NewServiceContext(c)
-	svr := server.NewGatewayServer(ctx)
-
-	s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
-		pb.RegisterGatewayServer(grpcServer, svr)
-
-		if c.Mode == service.DevMode || c.Mode == service.TestMode {
-			reflection.Register(grpcServer)
-		}
-	})
-	defer s.Stop()
-
-	fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
-	s.Start()
-}

+ 0 - 44
gateway/rpc/gateway/gateway.go

@@ -1,44 +0,0 @@
-// Code generated by goctl. DO NOT EDIT!
-// Source: gateway.proto
-
-package gateway
-
-import (
-	"context"
-
-	"ylink/gateway/rpc/pb"
-
-	"github.com/zeromicro/go-zero/zrpc"
-	"google.golang.org/grpc"
-)
-
-type (
-	CsLoginReq     = pb.CsLoginReq
-	LoginResp      = pb.LoginResp
-	PlayerLoginReq = pb.PlayerLoginReq
-
-	Gateway interface {
-		PlayerLogin(ctx context.Context, in *PlayerLoginReq, opts ...grpc.CallOption) (*LoginResp, error)
-		CsLogin(ctx context.Context, in *CsLoginReq, opts ...grpc.CallOption) (*LoginResp, error)
-	}
-
-	defaultGateway struct {
-		cli zrpc.Client
-	}
-)
-
-func NewGateway(cli zrpc.Client) Gateway {
-	return &defaultGateway{
-		cli: cli,
-	}
-}
-
-func (m *defaultGateway) PlayerLogin(ctx context.Context, in *PlayerLoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
-	client := pb.NewGatewayClient(m.cli.Conn())
-	return client.PlayerLogin(ctx, in, opts...)
-}
-
-func (m *defaultGateway) CsLogin(ctx context.Context, in *CsLoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
-	client := pb.NewGatewayClient(m.cli.Conn())
-	return client.CsLogin(ctx, in, opts...)
-}

+ 0 - 7
gateway/rpc/internal/config/config.go

@@ -1,7 +0,0 @@
-package config
-
-import "github.com/zeromicro/go-zero/zrpc"
-
-type Config struct {
-	zrpc.RpcServerConf
-}

+ 0 - 30
gateway/rpc/internal/logic/csloginlogic.go

@@ -1,30 +0,0 @@
-package logic
-
-import (
-	"context"
-
-	"ylink/gateway/rpc/internal/svc"
-	"ylink/gateway/rpc/pb"
-
-	"github.com/zeromicro/go-zero/core/logx"
-)
-
-type CsLoginLogic struct {
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-	logx.Logger
-}
-
-func NewCsLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsLoginLogic {
-	return &CsLoginLogic{
-		ctx:    ctx,
-		svcCtx: svcCtx,
-		Logger: logx.WithContext(ctx),
-	}
-}
-
-func (l *CsLoginLogic) CsLogin(in *pb.CsLoginReq) (*pb.LoginResp, error) {
-	// todo: add your logic here and delete this line
-
-	return &pb.LoginResp{}, nil
-}

+ 0 - 34
gateway/rpc/internal/logic/playerloginlogic.go

@@ -1,34 +0,0 @@
-package logic
-
-import (
-	"context"
-
-	"ylink/gateway/rpc/internal/svc"
-	"ylink/gateway/rpc/pb"
-
-	"github.com/zeromicro/go-zero/core/logx"
-)
-
-type PlayerLoginLogic struct {
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-	logx.Logger
-}
-
-func NewPlayerLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PlayerLoginLogic {
-	return &PlayerLoginLogic{
-		ctx:    ctx,
-		svcCtx: svcCtx,
-		Logger: logx.WithContext(ctx),
-	}
-}
-
-func (l *PlayerLoginLogic) PlayerLogin(in *pb.PlayerLoginReq) (*pb.LoginResp, error) {
-	// todo: add your logic here and delete this line
-
-	return &pb.LoginResp{
-		AccessToken:  in.PlayerId,
-		AccessExpire: 100,
-		RefreshAfter: 100,
-		Url:          "www.baidu.com"}, nil
-}

+ 0 - 33
gateway/rpc/internal/server/gatewayserver.go

@@ -1,33 +0,0 @@
-// Code generated by goctl. DO NOT EDIT!
-// Source: gateway.proto
-
-package server
-
-import (
-	"context"
-
-	"ylink/gateway/rpc/internal/logic"
-	"ylink/gateway/rpc/internal/svc"
-	"ylink/gateway/rpc/pb"
-)
-
-type GatewayServer struct {
-	svcCtx *svc.ServiceContext
-	pb.UnimplementedGatewayServer
-}
-
-func NewGatewayServer(svcCtx *svc.ServiceContext) *GatewayServer {
-	return &GatewayServer{
-		svcCtx: svcCtx,
-	}
-}
-
-func (s *GatewayServer) PlayerLogin(ctx context.Context, in *pb.PlayerLoginReq) (*pb.LoginResp, error) {
-	l := logic.NewPlayerLoginLogic(ctx, s.svcCtx)
-	return l.PlayerLogin(in)
-}
-
-func (s *GatewayServer) CsLogin(ctx context.Context, in *pb.CsLoginReq) (*pb.LoginResp, error) {
-	l := logic.NewCsLoginLogic(ctx, s.svcCtx)
-	return l.CsLogin(in)
-}

+ 0 - 13
gateway/rpc/internal/svc/servicecontext.go

@@ -1,13 +0,0 @@
-package svc
-
-import "ylink/gateway/rpc/internal/config"
-
-type ServiceContext struct {
-	Config config.Config
-}
-
-func NewServiceContext(c config.Config) *ServiceContext {
-	return &ServiceContext{
-		Config: c,
-	}
-}

+ 0 - 327
gateway/rpc/pb/gateway.pb.go

@@ -1,327 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// 	protoc-gen-go v1.28.0
-// 	protoc        v3.19.4
-// source: pb/gateway.proto
-
-package pb
-
-import (
-	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
-)
-
-const (
-	// Verify that this generated code is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
-	// Verify that runtime/protoimpl is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type PlayerLoginReq struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	PlayerId string `protobuf:"bytes,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
-	GameId   string `protobuf:"bytes,2,opt,name=game_id,json=gameId,proto3" json:"game_id,omitempty"`
-}
-
-func (x *PlayerLoginReq) Reset() {
-	*x = PlayerLoginReq{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_pb_gateway_proto_msgTypes[0]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *PlayerLoginReq) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*PlayerLoginReq) ProtoMessage() {}
-
-func (x *PlayerLoginReq) ProtoReflect() protoreflect.Message {
-	mi := &file_pb_gateway_proto_msgTypes[0]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
-}
-
-// Deprecated: Use PlayerLoginReq.ProtoReflect.Descriptor instead.
-func (*PlayerLoginReq) Descriptor() ([]byte, []int) {
-	return file_pb_gateway_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *PlayerLoginReq) GetPlayerId() string {
-	if x != nil {
-		return x.PlayerId
-	}
-	return ""
-}
-
-func (x *PlayerLoginReq) GetGameId() string {
-	if x != nil {
-		return x.GameId
-	}
-	return ""
-}
-
-type CsLoginReq struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	UserName string `protobuf:"bytes,1,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"`
-	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
-}
-
-func (x *CsLoginReq) Reset() {
-	*x = CsLoginReq{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_pb_gateway_proto_msgTypes[1]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *CsLoginReq) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CsLoginReq) ProtoMessage() {}
-
-func (x *CsLoginReq) ProtoReflect() protoreflect.Message {
-	mi := &file_pb_gateway_proto_msgTypes[1]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
-}
-
-// Deprecated: Use CsLoginReq.ProtoReflect.Descriptor instead.
-func (*CsLoginReq) Descriptor() ([]byte, []int) {
-	return file_pb_gateway_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *CsLoginReq) GetUserName() string {
-	if x != nil {
-		return x.UserName
-	}
-	return ""
-}
-
-func (x *CsLoginReq) GetPassword() string {
-	if x != nil {
-		return x.Password
-	}
-	return ""
-}
-
-type LoginResp struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	AccessToken  string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
-	AccessExpire int64  `protobuf:"varint,2,opt,name=access_expire,json=accessExpire,proto3" json:"access_expire,omitempty"`
-	RefreshAfter int64  `protobuf:"varint,3,opt,name=refresh_after,json=refreshAfter,proto3" json:"refresh_after,omitempty"`
-	Url          string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
-}
-
-func (x *LoginResp) Reset() {
-	*x = LoginResp{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_pb_gateway_proto_msgTypes[2]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *LoginResp) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*LoginResp) ProtoMessage() {}
-
-func (x *LoginResp) ProtoReflect() protoreflect.Message {
-	mi := &file_pb_gateway_proto_msgTypes[2]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
-}
-
-// Deprecated: Use LoginResp.ProtoReflect.Descriptor instead.
-func (*LoginResp) Descriptor() ([]byte, []int) {
-	return file_pb_gateway_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *LoginResp) GetAccessToken() string {
-	if x != nil {
-		return x.AccessToken
-	}
-	return ""
-}
-
-func (x *LoginResp) GetAccessExpire() int64 {
-	if x != nil {
-		return x.AccessExpire
-	}
-	return 0
-}
-
-func (x *LoginResp) GetRefreshAfter() int64 {
-	if x != nil {
-		return x.RefreshAfter
-	}
-	return 0
-}
-
-func (x *LoginResp) GetUrl() string {
-	if x != nil {
-		return x.Url
-	}
-	return ""
-}
-
-var File_pb_gateway_proto protoreflect.FileDescriptor
-
-var file_pb_gateway_proto_rawDesc = []byte{
-	0x0a, 0x10, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f,
-	0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x46, 0x0a, 0x0e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
-	0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79,
-	0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61,
-	0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64,
-	0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x22, 0x45,
-	0x0a, 0x0a, 0x43, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1b, 0x0a, 0x09,
-	0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73,
-	0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73,
-	0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x8a, 0x01, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52,
-	0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f,
-	0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73,
-	0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
-	0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x61,
-	0x63, 0x63, 0x65, 0x73, 0x73, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72,
-	0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01,
-	0x28, 0x03, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x41, 0x66, 0x74, 0x65, 0x72,
-	0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
-	0x72, 0x6c, 0x32, 0x65, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x30, 0x0a,
-	0x0b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x2e, 0x70,
-	0x62, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71,
-	0x1a, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x28, 0x0a, 0x07, 0x63, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x70, 0x62, 0x2e,
-	0x43, 0x73, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x70, 0x62, 0x2e,
-	0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
-	0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
-	file_pb_gateway_proto_rawDescOnce sync.Once
-	file_pb_gateway_proto_rawDescData = file_pb_gateway_proto_rawDesc
-)
-
-func file_pb_gateway_proto_rawDescGZIP() []byte {
-	file_pb_gateway_proto_rawDescOnce.Do(func() {
-		file_pb_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_pb_gateway_proto_rawDescData)
-	})
-	return file_pb_gateway_proto_rawDescData
-}
-
-var file_pb_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
-var file_pb_gateway_proto_goTypes = []interface{}{
-	(*PlayerLoginReq)(nil), // 0: pb.PlayerLoginReq
-	(*CsLoginReq)(nil),     // 1: pb.CsLoginReq
-	(*LoginResp)(nil),      // 2: pb.LoginResp
-}
-var file_pb_gateway_proto_depIdxs = []int32{
-	0, // 0: pb.gateway.playerLogin:input_type -> pb.PlayerLoginReq
-	1, // 1: pb.gateway.csLogin:input_type -> pb.CsLoginReq
-	2, // 2: pb.gateway.playerLogin:output_type -> pb.LoginResp
-	2, // 3: pb.gateway.csLogin:output_type -> pb.LoginResp
-	2, // [2:4] is the sub-list for method output_type
-	0, // [0:2] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_pb_gateway_proto_init() }
-func file_pb_gateway_proto_init() {
-	if File_pb_gateway_proto != nil {
-		return
-	}
-	if !protoimpl.UnsafeEnabled {
-		file_pb_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*PlayerLoginReq); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-		file_pb_gateway_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CsLoginReq); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-		file_pb_gateway_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*LoginResp); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-	}
-	type x struct{}
-	out := protoimpl.TypeBuilder{
-		File: protoimpl.DescBuilder{
-			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
-			RawDescriptor: file_pb_gateway_proto_rawDesc,
-			NumEnums:      0,
-			NumMessages:   3,
-			NumExtensions: 0,
-			NumServices:   1,
-		},
-		GoTypes:           file_pb_gateway_proto_goTypes,
-		DependencyIndexes: file_pb_gateway_proto_depIdxs,
-		MessageInfos:      file_pb_gateway_proto_msgTypes,
-	}.Build()
-	File_pb_gateway_proto = out.File
-	file_pb_gateway_proto_rawDesc = nil
-	file_pb_gateway_proto_goTypes = nil
-	file_pb_gateway_proto_depIdxs = nil
-}

+ 0 - 27
gateway/rpc/pb/gateway.proto

@@ -1,27 +0,0 @@
-syntax = "proto3";
-
-option go_package = "./pb";
-
-package pb;
-
-message PlayerLoginReq {
-  string player_id = 1;
-  string game_id = 2;
-}
-
-message CsLoginReq{
-  string user_name = 1;
-  string password = 2;
-}
-
-message LoginResp {
-  string access_token = 1;
-  int64  access_expire = 2;
-  int64  refresh_after = 3;
-  string  url = 4;
-}
-
-service gateway {
-  rpc playerLogin (PlayerLoginReq)returns(LoginResp);
-  rpc csLogin (CsLoginReq)returns(LoginResp);
-}

+ 0 - 141
gateway/rpc/pb/gateway_grpc.pb.go

@@ -1,141 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.4
-// source: pb/gateway.proto
-
-package pb
-
-import (
-	context "context"
-	grpc "google.golang.org/grpc"
-	codes "google.golang.org/grpc/codes"
-	status "google.golang.org/grpc/status"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.32.0 or later.
-const _ = grpc.SupportPackageIsVersion7
-
-// GatewayClient is the client API for Gateway service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type GatewayClient interface {
-	PlayerLogin(ctx context.Context, in *PlayerLoginReq, opts ...grpc.CallOption) (*LoginResp, error)
-	CsLogin(ctx context.Context, in *CsLoginReq, opts ...grpc.CallOption) (*LoginResp, error)
-}
-
-type gatewayClient struct {
-	cc grpc.ClientConnInterface
-}
-
-func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient {
-	return &gatewayClient{cc}
-}
-
-func (c *gatewayClient) PlayerLogin(ctx context.Context, in *PlayerLoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
-	out := new(LoginResp)
-	err := c.cc.Invoke(ctx, "/pb.gateway/playerLogin", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-func (c *gatewayClient) CsLogin(ctx context.Context, in *CsLoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
-	out := new(LoginResp)
-	err := c.cc.Invoke(ctx, "/pb.gateway/csLogin", in, out, opts...)
-	if err != nil {
-		return nil, err
-	}
-	return out, nil
-}
-
-// GatewayServer is the server API for Gateway service.
-// All implementations must embed UnimplementedGatewayServer
-// for forward compatibility
-type GatewayServer interface {
-	PlayerLogin(context.Context, *PlayerLoginReq) (*LoginResp, error)
-	CsLogin(context.Context, *CsLoginReq) (*LoginResp, error)
-	mustEmbedUnimplementedGatewayServer()
-}
-
-// UnimplementedGatewayServer must be embedded to have forward compatible implementations.
-type UnimplementedGatewayServer struct {
-}
-
-func (UnimplementedGatewayServer) PlayerLogin(context.Context, *PlayerLoginReq) (*LoginResp, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method PlayerLogin not implemented")
-}
-func (UnimplementedGatewayServer) CsLogin(context.Context, *CsLoginReq) (*LoginResp, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method CsLogin not implemented")
-}
-func (UnimplementedGatewayServer) mustEmbedUnimplementedGatewayServer() {}
-
-// UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to GatewayServer will
-// result in compilation errors.
-type UnsafeGatewayServer interface {
-	mustEmbedUnimplementedGatewayServer()
-}
-
-func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) {
-	s.RegisterService(&Gateway_ServiceDesc, srv)
-}
-
-func _Gateway_PlayerLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(PlayerLoginReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(GatewayServer).PlayerLogin(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/pb.gateway/playerLogin",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(GatewayServer).PlayerLogin(ctx, req.(*PlayerLoginReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-func _Gateway_CsLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(CsLoginReq)
-	if err := dec(in); err != nil {
-		return nil, err
-	}
-	if interceptor == nil {
-		return srv.(GatewayServer).CsLogin(ctx, in)
-	}
-	info := &grpc.UnaryServerInfo{
-		Server:     srv,
-		FullMethod: "/pb.gateway/csLogin",
-	}
-	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(GatewayServer).CsLogin(ctx, req.(*CsLoginReq))
-	}
-	return interceptor(ctx, in, info, handler)
-}
-
-// Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var Gateway_ServiceDesc = grpc.ServiceDesc{
-	ServiceName: "pb.gateway",
-	HandlerType: (*GatewayServer)(nil),
-	Methods: []grpc.MethodDesc{
-		{
-			MethodName: "playerLogin",
-			Handler:    _Gateway_PlayerLogin_Handler,
-		},
-		{
-			MethodName: "csLogin",
-			Handler:    _Gateway_CsLogin_Handler,
-		},
-	},
-	Streams:  []grpc.StreamDesc{},
-	Metadata: "pb/gateway.proto",
-}