Browse Source

v0.0.1开发:调整项目目录结构

#Suyghur 3 years ago
parent
commit
0d3fd78e8d
100 changed files with 1178 additions and 922 deletions
  1. 0 66
      apis/auth/internal/logic/checkauthlogic.go
  2. 0 28
      bff/apibff/internal/handler/cs/cmd/csfetchhistorylisthandler.go
  3. 0 28
      bff/apibff/internal/handler/cs/cmd/csfetchhistorymsghandler.go
  4. 0 28
      bff/apibff/internal/handler/cs/cmd/csfetchmsghandler.go
  5. 0 28
      bff/apibff/internal/handler/cs/cmd/csfetchplayerqueuehandler.go
  6. 0 28
      bff/apibff/internal/handler/cs/cmd/cssendmsghandler.go
  7. 0 17
      bff/apibff/internal/handler/player/cmd/playerdisconnecthandler.go
  8. 0 24
      bff/apibff/internal/handler/player/cmd/playerfetchhistorymsghandler.go
  9. 0 17
      bff/apibff/internal/handler/player/cmd/playerfetchmsghandler.go
  10. 3 4
      bff/authbff/api/authbff.go
  11. 34 0
      bff/authbff/api/desc/authbff.api
  12. 0 0
      bff/authbff/api/etc/authbff.yaml
  13. 0 0
      bff/authbff/api/internal/config/config.go
  14. 25 0
      bff/authbff/api/internal/handler/csloginhandler.go
  15. 25 0
      bff/authbff/api/internal/handler/playerloginhandler.go
  16. 6 11
      bff/authbff/api/internal/handler/routes.go
  17. 35 0
      bff/authbff/api/internal/logic/csloginlogic.go
  18. 36 0
      bff/authbff/api/internal/logic/playerloginlogic.go
  19. 2 2
      bff/authbff/api/internal/svc/servicecontext.go
  20. 1 7
      bff/authbff/api/internal/types/types.go
  21. 0 44
      bff/authbff/desc/authbff.api
  22. 0 28
      bff/authbff/internal/handler/checkauthhandler.go
  23. 0 35
      bff/authbff/internal/handler/csauthhandler.go
  24. 0 28
      bff/authbff/internal/handler/playerauthhandler.go
  25. 0 43
      bff/authbff/internal/logic/checkauthlogic.go
  26. 0 43
      bff/authbff/internal/logic/csauthlogic.go
  27. 0 44
      bff/authbff/internal/logic/playerauthlogic.go
  28. 5 4
      bff/cmdbff/api/cmdbff.go
  29. 0 0
      bff/cmdbff/api/desc/bean.api
  30. 17 17
      bff/cmdbff/api/desc/cmdbff.api
  31. 1 1
      bff/cmdbff/api/etc/cmdbff.yaml
  32. 0 0
      bff/cmdbff/api/internal/config/config.go
  33. 8 7
      bff/cmdbff/api/internal/handler/cs/connectplayerhandler.go
  34. 25 0
      bff/cmdbff/api/internal/handler/cs/fetchhistorylisthandler.go
  35. 25 0
      bff/cmdbff/api/internal/handler/cs/fetchhistorymsghandler.go
  36. 25 0
      bff/cmdbff/api/internal/handler/cs/fetchmsghandler.go
  37. 25 0
      bff/cmdbff/api/internal/handler/cs/fetchplayerqueuehandler.go
  38. 25 0
      bff/cmdbff/api/internal/handler/cs/sendmsghandler.go
  39. 17 0
      bff/cmdbff/api/internal/handler/player/disconnecthandler.go
  40. 8 7
      bff/cmdbff/api/internal/handler/player/fetchcsinfohandler.go
  41. 25 0
      bff/cmdbff/api/internal/handler/player/fetchhistorymsghandler.go
  42. 17 0
      bff/cmdbff/api/internal/handler/player/fetchmsghandler.go
  43. 8 7
      bff/cmdbff/api/internal/handler/player/sendmsghandler.go
  44. 16 16
      bff/cmdbff/api/internal/handler/routes.go
  45. 30 0
      bff/cmdbff/api/internal/logic/cs/connectplayerlogic.go
  46. 4 4
      bff/cmdbff/api/internal/logic/cs/csconnectplayerlogic.go
  47. 3 3
      bff/cmdbff/api/internal/logic/cs/csfetchhistorylistlogic.go
  48. 3 3
      bff/cmdbff/api/internal/logic/cs/csfetchhistorymsglogic.go
  49. 3 3
      bff/cmdbff/api/internal/logic/cs/csfetchmsglogic.go
  50. 3 3
      bff/cmdbff/api/internal/logic/cs/csfetchplayerqueuelogic.go
  51. 3 3
      bff/cmdbff/api/internal/logic/cs/cssendmsglogic.go
  52. 30 0
      bff/cmdbff/api/internal/logic/cs/fetchhistorylistlogic.go
  53. 30 0
      bff/cmdbff/api/internal/logic/cs/fetchhistorymsglogic.go
  54. 30 0
      bff/cmdbff/api/internal/logic/cs/fetchmsglogic.go
  55. 30 0
      bff/cmdbff/api/internal/logic/cs/fetchplayerqueuelogic.go
  56. 30 0
      bff/cmdbff/api/internal/logic/cs/sendmsglogic.go
  57. 28 0
      bff/cmdbff/api/internal/logic/player/disconnectlogic.go
  58. 30 0
      bff/cmdbff/api/internal/logic/player/fetchcsinfologic.go
  59. 30 0
      bff/cmdbff/api/internal/logic/player/fetchhistorymsglogic.go
  60. 30 0
      bff/cmdbff/api/internal/logic/player/fetchmsglogic.go
  61. 3 3
      bff/cmdbff/api/internal/logic/player/playerdisconnectlogic.go
  62. 4 4
      bff/cmdbff/api/internal/logic/player/playerfetchcsinfologic.go
  63. 5 4
      bff/cmdbff/api/internal/logic/player/playerfetchhistorymsglogic.go
  64. 4 4
      bff/cmdbff/api/internal/logic/player/playerfetchmsglogic.go
  65. 4 4
      bff/cmdbff/api/internal/logic/player/playersendmsglogic.go
  66. 30 0
      bff/cmdbff/api/internal/logic/player/sendmsglogic.go
  67. 2 2
      bff/cmdbff/api/internal/svc/servicecontext.go
  68. 0 0
      bff/cmdbff/api/internal/types/types.go
  69. 2 2
      bff/rpcbff/rpc/etc/rpcbff.yaml
  70. 1 1
      bff/rpcbff/rpc/internal/config/config.go
  71. 15 17
      bff/rpcbff/rpc/internal/logic/connectlogic.go
  72. 18 13
      bff/rpcbff/rpc/internal/logic/disconnectlogic.go
  73. 3 3
      bff/rpcbff/rpc/internal/server/rpcbffserver.go
  74. 3 3
      bff/rpcbff/rpc/internal/svc/servicecontext.go
  75. 129 69
      bff/rpcbff/rpc/pb/rpcbff.pb.go
  76. 11 5
      bff/rpcbff/rpc/pb/rpcbff.proto
  77. 0 0
      bff/rpcbff/rpc/pb/rpcbff_grpc.pb.go
  78. 4 4
      bff/rpcbff/rpc/rpcbff.go
  79. 1 1
      bff/rpcbff/rpc/rpcbff/rpcbff.go
  80. 4 4
      core/auth/rpc/auth.go
  81. 4 3
      core/auth/rpc/auth/auth.go
  82. 0 0
      core/auth/rpc/etc/auth.yaml
  83. 0 0
      core/auth/rpc/internal/config/config.go
  84. 48 0
      core/auth/rpc/internal/logic/checkauthlogic.go
  85. 6 13
      core/auth/rpc/internal/logic/csauthlogic.go
  86. 6 15
      core/auth/rpc/internal/logic/playerauthlogic.go
  87. 4 4
      core/auth/rpc/internal/server/authserver.go
  88. 1 3
      core/auth/rpc/internal/svc/servicecontext.go
  89. 109 81
      core/auth/rpc/pb/auth.pb.go
  90. 6 8
      core/auth/rpc/pb/auth.proto
  91. 5 5
      core/auth/rpc/pb/auth_grpc.pb.go
  92. 4 4
      core/cmd/rpc/cmd.go
  93. 1 2
      core/cmd/rpc/cmd/cmd.go
  94. 0 0
      core/cmd/rpc/etc/cmd.yaml
  95. 0 0
      core/cmd/rpc/internal/config/config.go
  96. 2 2
      core/cmd/rpc/internal/logic/csconnectplayerlogic.go
  97. 2 2
      core/cmd/rpc/internal/logic/csfetchhistorychatlogic.go
  98. 2 2
      core/cmd/rpc/internal/logic/csfetchhistorymsglogic.go
  99. 2 2
      core/cmd/rpc/internal/logic/csfetchmsglogic.go
  100. 2 2
      core/cmd/rpc/internal/logic/csfetchplayerqueuelogic.go

+ 0 - 66
apis/auth/internal/logic/checkauthlogic.go

@@ -1,66 +0,0 @@
-package logic
-
-import (
-	"context"
-	"errors"
-	"github.com/golang-jwt/jwt/v4"
-	"github.com/zeromicro/go-zero/core/logx"
-	"google.golang.org/protobuf/types/known/structpb"
-	"ylink/apis/auth/internal/svc"
-	"ylink/apis/auth/pb"
-)
-
-type CheckAuthLogic struct {
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-	logx.Logger
-}
-
-func NewCheckAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CheckAuthLogic {
-	return &CheckAuthLogic{
-		ctx:    ctx,
-		svcCtx: svcCtx,
-		Logger: logx.WithContext(ctx),
-	}
-}
-
-func (l *CheckAuthLogic) CheckAuth(in *pb.CheckAuthReq) (*pb.AuthResp, error) {
-
-	// 解析传入的token
-	// 第二个参数是一个回调函数,作用是判断生成token所用的签名算法是否和传入token的签名算法是否一致。
-	// 算法匹配就返回密钥,用来解析token.
-	token, err := jwt.Parse(in.AccessToken, func(token *jwt.Token) (i interface{}, err error) {
-		if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
-			return nil, errors.New("unexpected signing method")
-		}
-		return []byte(l.svcCtx.Config.JwtAuth.AccessSecret), nil
-	})
-
-	// err不为空,说明token已过期
-	if err != nil {
-		return nil, err
-	}
-
-	// 将获取的token中的Claims强转为MapClaims
-	claims, ok := token.Claims.(jwt.MapClaims)
-	// 判断token是否有效
-	if !(ok && token.Valid) {
-		return nil, errors.New("cannot convert claim to mapClaim")
-	}
-
-	iat := claims["iat"].(int64)
-	exp := claims["exp"].(int64)
-	if iat == exp {
-		return nil, errors.New("access token is invalid")
-	}
-
-	data, err := structpb.NewStruct(map[string]interface{}{})
-	if err != nil {
-		return nil, err
-	}
-	return &pb.AuthResp{
-		Code: 0,
-		Msg:  "success",
-		Data: data,
-	}, nil
-}

+ 0 - 28
bff/apibff/internal/handler/cs/cmd/csfetchhistorylisthandler.go

@@ -1,28 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/cs/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
-)
-
-func CsFetchHistoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CsFetchHistoryChatReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := cmd.NewCsFetchHistoryListLogic(r.Context(), svcCtx)
-		resp, err := l.CsFetchHistoryList(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 28
bff/apibff/internal/handler/cs/cmd/csfetchhistorymsghandler.go

@@ -1,28 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/cs/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
-)
-
-func CsFetchHistoryMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CsFetchHistoryMsgReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := cmd.NewCsFetchHistoryMsgLogic(r.Context(), svcCtx)
-		resp, err := l.CsFetchHistoryMsg(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 28
bff/apibff/internal/handler/cs/cmd/csfetchmsghandler.go

@@ -1,28 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/cs/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
-)
-
-func CsFetchMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CsFetchMsgReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := cmd.NewCsFetchMsgLogic(r.Context(), svcCtx)
-		resp, err := l.CsFetchMsg(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 28
bff/apibff/internal/handler/cs/cmd/csfetchplayerqueuehandler.go

@@ -1,28 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/cs/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
-)
-
-func CsFetchPlayerQueueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CsFetchPlayerQueueReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := cmd.NewCsFetchPlayerQueueLogic(r.Context(), svcCtx)
-		resp, err := l.CsFetchPlayerQueue(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 28
bff/apibff/internal/handler/cs/cmd/cssendmsghandler.go

@@ -1,28 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/cs/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
-)
-
-func CsSendMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CsSendMsgReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := cmd.NewCsSendMsgLogic(r.Context(), svcCtx)
-		err := l.CsSendMsg(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.Ok(w)
-		}
-	}
-}

+ 0 - 17
bff/apibff/internal/handler/player/cmd/playerdisconnecthandler.go

@@ -1,17 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-	"ylink/ext/result"
-
-	"ylink/bff/apibff/internal/logic/player/cmd"
-	"ylink/bff/apibff/internal/svc"
-)
-
-func PlayerDisconnectHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		l := cmd.NewPlayerDisconnectLogic(r.Context(), svcCtx)
-		err := l.PlayerDisconnect()
-		result.HttpResult(r, w, nil, err)
-	}
-}

+ 0 - 24
bff/apibff/internal/handler/player/cmd/playerfetchhistorymsghandler.go

@@ -1,24 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-	"ylink/ext/result"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/player/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
-)
-
-func PlayerFetchHistoryMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.PlayerFetchHistoryMsgReq
-		if err := httpx.Parse(r, &req); err != nil {
-			result.ParamErrorResult(r, w, err)
-		}
-
-		l := cmd.NewPlayerFetchHistoryMsgLogic(r.Context(), svcCtx)
-		resp, err := l.PlayerFetchHistoryMsg(&req)
-		result.HttpResult(r, w, resp, err)
-	}
-}

+ 0 - 17
bff/apibff/internal/handler/player/cmd/playerfetchmsghandler.go

@@ -1,17 +0,0 @@
-package cmd
-
-import (
-	"net/http"
-	"ylink/ext/result"
-
-	"ylink/bff/apibff/internal/logic/player/cmd"
-	"ylink/bff/apibff/internal/svc"
-)
-
-func PlayerFetchMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		l := cmd.NewPlayerFetchMsgLogic(r.Context(), svcCtx)
-		resp, err := l.PlayerFetchMsg()
-		result.HttpResult(r, w, resp, err)
-	}
-}

+ 3 - 4
bff/authbff/authbff.go → bff/authbff/api/authbff.go

@@ -3,10 +3,9 @@ package main
 import (
 	"flag"
 	"fmt"
-
-	"ylink/bff/authbff/internal/config"
-	"ylink/bff/authbff/internal/handler"
-	"ylink/bff/authbff/internal/svc"
+	"ylink/bff/authbff/api/internal/config"
+	"ylink/bff/authbff/api/internal/handler"
+	"ylink/bff/authbff/api/internal/svc"
 
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/rest"

+ 34 - 0
bff/authbff/api/desc/authbff.api

@@ -0,0 +1,34 @@
+syntax = "v1"
+
+info(
+	title: "api前端服务"
+	desc: "api前端服务 "
+	author: "#Suyghur"
+	version: "v1"
+)
+
+type PlayerAuthReq {
+	PlayerId string `json:"player_id"`
+	GameId   string `json:"game_id"`
+}
+
+type CsAuthReq {
+	CsId string `json:"cs_id"`
+}
+
+type AuthResp {
+	AccessToken string `json:"access_token"`
+}
+
+@server(
+	prefix: api/v1/auth
+)
+service Authbff {
+	@doc "玩家登录"
+	@handler playerLogin
+	post /player-login (PlayerAuthReq) returns (AuthResp)
+	
+	@doc "客服登录"
+	@handler csLogin
+	post /cs-login (CsAuthReq) returns (AuthResp)
+}

+ 0 - 0
bff/authbff/etc/authbff.yaml → bff/authbff/api/etc/authbff.yaml


+ 0 - 0
bff/authbff/internal/config/config.go → bff/authbff/api/internal/config/config.go


+ 25 - 0
bff/authbff/api/internal/handler/csloginhandler.go

@@ -0,0 +1,25 @@
+package handler
+
+import (
+	"net/http"
+	"ylink/bff/authbff/api/internal/logic"
+	"ylink/bff/authbff/api/internal/svc"
+	"ylink/bff/authbff/api/internal/types"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func csLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CsAuthReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := logic.NewCsLoginLogic(r.Context(), svcCtx)
+		resp, err := l.CsLogin(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
bff/authbff/api/internal/handler/playerloginhandler.go

@@ -0,0 +1,25 @@
+package handler
+
+import (
+	"net/http"
+	"ylink/bff/authbff/api/internal/logic"
+	"ylink/bff/authbff/api/internal/svc"
+	"ylink/bff/authbff/api/internal/types"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func playerLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.PlayerAuthReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := logic.NewPlayerLoginLogic(r.Context(), svcCtx)
+		resp, err := l.PlayerLogin(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 6 - 11
bff/authbff/internal/handler/routes.go → bff/authbff/api/internal/handler/routes.go

@@ -4,7 +4,7 @@ package handler
 import (
 	"net/http"
 
-	"ylink/bff/authbff/internal/svc"
+	"ylink/bff/authbff/api/internal/svc"
 
 	"github.com/zeromicro/go-zero/rest"
 )
@@ -14,20 +14,15 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 		[]rest.Route{
 			{
 				Method:  http.MethodPost,
-				Path:    "/player/auth",
-				Handler: playerAuthHandler(serverCtx),
+				Path:    "/player-login",
+				Handler: playerLoginHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/cs/auth",
-				Handler: csAuthHandler(serverCtx),
-			},
-			{
-				Method:  http.MethodPost,
-				Path:    "/check_auth",
-				Handler: checkAuthHandler(serverCtx),
+				Path:    "/cs-login",
+				Handler: csLoginHandler(serverCtx),
 			},
 		},
-		rest.WithPrefix("/api/v1"),
+		rest.WithPrefix("/api/v1/auth"),
 	)
 }

+ 35 - 0
bff/authbff/api/internal/logic/csloginlogic.go

@@ -0,0 +1,35 @@
+package logic
+
+import (
+	"context"
+	"github.com/zeromicro/go-zero/core/logx"
+	"ylink/bff/authbff/api/internal/svc"
+	"ylink/bff/authbff/api/internal/types"
+	"ylink/core/auth/rpc/auth"
+)
+
+type CsLoginLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewCsLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsLoginLogic {
+	return &CsLoginLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *CsLoginLogic) CsLogin(req *types.CsAuthReq) (resp *types.AuthResp, err error) {
+	authResp, err := l.svcCtx.AuthRpc.CsAuth(l.ctx, &auth.CsAuthReq{
+		CsId: req.CsId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.AuthResp{
+		AccessToken: authResp.AccessToken,
+	}, nil
+}

+ 36 - 0
bff/authbff/api/internal/logic/playerloginlogic.go

@@ -0,0 +1,36 @@
+package logic
+
+import (
+	"context"
+	"github.com/zeromicro/go-zero/core/logx"
+	"ylink/bff/authbff/api/internal/svc"
+	"ylink/bff/authbff/api/internal/types"
+	"ylink/core/auth/rpc/auth"
+)
+
+type PlayerLoginLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewPlayerLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PlayerLoginLogic {
+	return &PlayerLoginLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *PlayerLoginLogic) PlayerLogin(req *types.PlayerAuthReq) (resp *types.AuthResp, err error) {
+	authResp, err := l.svcCtx.AuthRpc.PlayerAuth(l.ctx, &auth.PlayerAuthReq{
+		PlayerId: req.PlayerId,
+		GameId:   req.GameId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.AuthResp{
+		AccessToken: authResp.AccessToken,
+	}, nil
+}

+ 2 - 2
bff/rpcbff/internal/svc/servicecontext.go → bff/authbff/api/internal/svc/servicecontext.go

@@ -2,8 +2,8 @@ package svc
 
 import (
 	"github.com/zeromicro/go-zero/zrpc"
-	"ylink/apis/auth/auth"
-	"ylink/bff/rpcbff/internal/config"
+	"ylink/bff/authbff/api/internal/config"
+	"ylink/core/auth/rpc/auth"
 )
 
 type ServiceContext struct {

+ 1 - 7
bff/authbff/internal/types/types.go → bff/authbff/api/internal/types/types.go

@@ -10,12 +10,6 @@ type CsAuthReq struct {
 	CsId string `json:"cs_id"`
 }
 
-type CheckAuthReq struct {
-	AccessToken string `json:"access_token"`
-}
-
 type AuthResp struct {
-	Code int64       `json:"code"`
-	Msg  string      `json:"msg"`
-	Data interface{} `json:"data"`
+	AccessToken string `json:"access_token"`
 }

+ 0 - 44
bff/authbff/desc/authbff.api

@@ -1,44 +0,0 @@
-syntax = "v1"
-
-info(
-	title: "api前端服务"
-	desc: "api前端服务 "
-	author: "#Suyghur"
-	version: "v1"
-)
-
-type PlayerAuthReq {
-	PlayerId string `json:"player_id"`
-	GameId   string `json:"game_id"`
-}
-
-type CsAuthReq {
-	CsId string `json:"cs_id"`
-}
-
-type CheckAuthReq {
-	AccessToken string `json:"access_token"`
-}
-
-type AuthResp {
-	Code int64       `json:"code"`
-	Msg  string      `json:"msg"`
-	Data interface{} `json:"data"`
-}
-
-@server(
-	prefix: api/v1
-)
-service Authbff {
-	@doc "玩家认证"
-	@handler playerAuth
-	post /player/auth (PlayerAuthReq) returns (AuthResp)
-	
-	@doc "客服认证"
-	@handler csAuth
-	post /cs/auth (CsAuthReq) returns (AuthResp)
-	
-	@doc "测试token"
-	@handler checkAuth
-	post /check_auth (CheckAuthReq) returns (AuthResp)
-}

+ 0 - 28
bff/authbff/internal/handler/checkauthhandler.go

@@ -1,28 +0,0 @@
-package handler
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/authbff/internal/logic"
-	"ylink/bff/authbff/internal/svc"
-	"ylink/bff/authbff/internal/types"
-)
-
-func checkAuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CheckAuthReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := logic.NewCheckAuthLogic(r.Context(), svcCtx)
-		resp, err := l.CheckAuth(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 35
bff/authbff/internal/handler/csauthhandler.go

@@ -1,35 +0,0 @@
-package handler
-
-import (
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"net/http"
-	"ylink/bff/authbff/internal/logic"
-	"ylink/bff/authbff/internal/svc"
-	"ylink/bff/authbff/internal/types"
-)
-
-func csAuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.CsAuthReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.OkJson(w, &types.AuthResp{
-				Code: 1,
-				Msg:  err.Error(),
-				Data: map[string]interface{}{},
-			})
-			return
-		}
-
-		l := logic.NewCsAuthLogic(r.Context(), svcCtx)
-		resp, err := l.CsAuth(&req)
-		if err != nil {
-			httpx.OkJson(w, &types.AuthResp{
-				Code: 1,
-				Msg:  err.Error(),
-				Data: map[string]interface{}{},
-			})
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 28
bff/authbff/internal/handler/playerauthhandler.go

@@ -1,28 +0,0 @@
-package handler
-
-import (
-	"net/http"
-
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/authbff/internal/logic"
-	"ylink/bff/authbff/internal/svc"
-	"ylink/bff/authbff/internal/types"
-)
-
-func playerAuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.PlayerAuthReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := logic.NewPlayerAuthLogic(r.Context(), svcCtx)
-		resp, err := l.PlayerAuth(&req)
-		if err != nil {
-			httpx.Error(w, err)
-		} else {
-			httpx.OkJson(w, resp)
-		}
-	}
-}

+ 0 - 43
bff/authbff/internal/logic/checkauthlogic.go

@@ -1,43 +0,0 @@
-package logic
-
-import (
-	"context"
-	"ylink/apis/auth/pb"
-
-	"ylink/bff/authbff/internal/svc"
-	"ylink/bff/authbff/internal/types"
-
-	"github.com/zeromicro/go-zero/core/logx"
-)
-
-type CheckAuthLogic struct {
-	logx.Logger
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-}
-
-func NewCheckAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CheckAuthLogic {
-	return &CheckAuthLogic{
-		Logger: logx.WithContext(ctx),
-		ctx:    ctx,
-		svcCtx: svcCtx,
-	}
-}
-
-func (l *CheckAuthLogic) CheckAuth(req *types.CheckAuthReq) (resp *types.AuthResp, err error) {
-	if authResp, err := l.svcCtx.AuthRpc.CheckAuth(l.ctx, &pb.CheckAuthReq{
-		AccessToken: req.AccessToken,
-	}); err != nil {
-		return &types.AuthResp{
-			Code: authResp.Code,
-			Msg:  authResp.Msg,
-			Data: map[string]interface{}{},
-		}, err
-	} else {
-		return &types.AuthResp{
-			Code: authResp.Code,
-			Msg:  authResp.Msg,
-			Data: authResp.Data,
-		}, nil
-	}
-}

+ 0 - 43
bff/authbff/internal/logic/csauthlogic.go

@@ -1,43 +0,0 @@
-package logic
-
-import (
-	"context"
-	"ylink/apis/auth/pb"
-
-	"ylink/bff/authbff/internal/svc"
-	"ylink/bff/authbff/internal/types"
-
-	"github.com/zeromicro/go-zero/core/logx"
-)
-
-type CsAuthLogic struct {
-	logx.Logger
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-}
-
-func NewCsAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsAuthLogic {
-	return &CsAuthLogic{
-		Logger: logx.WithContext(ctx),
-		ctx:    ctx,
-		svcCtx: svcCtx,
-	}
-}
-
-func (l *CsAuthLogic) CsAuth(req *types.CsAuthReq) (resp *types.AuthResp, err error) {
-	if authResp, err := l.svcCtx.AuthRpc.CsAuth(l.ctx, &pb.CsAuthReq{
-		CsId: req.CsId,
-	}); err != nil {
-		return &types.AuthResp{
-			Code: authResp.Code,
-			Msg:  authResp.Msg,
-			Data: map[string]interface{}{},
-		}, err
-	} else {
-		return &types.AuthResp{
-			Code: authResp.Code,
-			Msg:  authResp.Msg,
-			Data: authResp.Data,
-		}, nil
-	}
-}

+ 0 - 44
bff/authbff/internal/logic/playerauthlogic.go

@@ -1,44 +0,0 @@
-package logic
-
-import (
-	"context"
-	"ylink/apis/auth/pb"
-
-	"ylink/bff/authbff/internal/svc"
-	"ylink/bff/authbff/internal/types"
-
-	"github.com/zeromicro/go-zero/core/logx"
-)
-
-type PlayerAuthLogic struct {
-	logx.Logger
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
-}
-
-func NewPlayerAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PlayerAuthLogic {
-	return &PlayerAuthLogic{
-		Logger: logx.WithContext(ctx),
-		ctx:    ctx,
-		svcCtx: svcCtx,
-	}
-}
-
-func (l *PlayerAuthLogic) PlayerAuth(req *types.PlayerAuthReq) (resp *types.AuthResp, err error) {
-	if authResp, err := l.svcCtx.AuthRpc.PlayerAuth(l.ctx, &pb.PlayerAuthReq{
-		PlayerId: req.PlayerId,
-		GameId:   req.GameId,
-	}); err != nil {
-		return &types.AuthResp{
-			Code: authResp.Code,
-			Msg:  authResp.Msg,
-			Data: map[string]interface{}{},
-		}, err
-	} else {
-		return &types.AuthResp{
-			Code: authResp.Code,
-			Msg:  authResp.Msg,
-			Data: authResp.Data,
-		}, nil
-	}
-}

+ 5 - 4
bff/apibff/apibff.go → bff/cmdbff/api/cmdbff.go

@@ -3,15 +3,16 @@ package main
 import (
 	"flag"
 	"fmt"
-	"ylink/bff/apibff/internal/config"
-	"ylink/bff/apibff/internal/handler"
-	"ylink/bff/apibff/internal/svc"
+
+	"ylink/bff/cmdbff/api/internal/config"
+	"ylink/bff/cmdbff/api/internal/handler"
+	"ylink/bff/cmdbff/api/internal/svc"
 
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/rest"
 )
 
-var configFile = flag.String("f", "etc/apibff.yaml", "the config file")
+var configFile = flag.String("f", "etc/cmdbff.yaml", "the config file")
 
 func main() {
 	flag.Parse()

+ 0 - 0
bff/apibff/desc/bean.api → bff/cmdbff/api/desc/bean.api


+ 17 - 17
bff/apibff/desc/apibff.api → bff/cmdbff/api/desc/cmdbff.api

@@ -12,59 +12,59 @@ import (
 )
 
 @server(
-	group: player/cmd
-	prefix: api/v1
+	group: player
+	prefix: api/v1/cmd
 	jwt: JwtAuth
 )
-service apibff {
+service cmdbff {
 	@doc "玩家获取客服信息"
-	@handler playerFetchCsInfo
+	@handler fetchCsInfo
 	post /player/fetch-cs-info (PlayerFetchCsInfoReq) returns (PlayerFetchCsInfoResp)
 	
 	@doc "玩家获取历史消息"
-	@handler playerFetchHistoryMsg
+	@handler fetchHistoryMsg
 	post /player/fetch-history-msg (PlayerFetchHistoryMsgReq) returns (PlayerFetchHistoryMsgResp)
 	
 	@doc "玩家获取消息"
-	@handler playerFetchMsg
+	@handler fetchMsg
 	post /player/fetch-msg returns (PlayerFetchMsgResp)
 	
 	@doc "玩家发送消息"
-	@handler playerSendMsg
+	@handler sendMsg
 	post /player/send-msg (PlayerSendMsgReq)
 	
 	@doc "玩家断开连接客服"
-	@handler playerDisconnect
+	@handler disconnect
 	post /player/disconnect
 }
 
 @server(
-	group : cs/cmd
-	prefix : api/v1
+	group : cs
+	prefix : api/v1/cmd
 	jwt : JwtAuth
 )
-service apibff {
+service cmdbff {
 	@doc "客服获取玩家等待队列"
-	@handler csFetchPlayerQueue
+	@handler fetchPlayerQueue
 	post /cs/fetch-player-queue (CsFetchPlayerQueueReq) returns (CsFetchPlayerQueueResp)
 	
 	@doc "客服连接玩家"
-	@handler csConnectPlayer
+	@handler connectPlayer
 	post /cs/connect-player (CsConnectPlayerReq)
 	
 	@doc "客服获取历史会话列表"
-	@handler csFetchHistoryList
+	@handler fetchHistoryList
 	post /cs/fetch-history-list (CsFetchHistoryChatReq) returns (CsFetchHistoryChatResp)
 	
 	@doc "客服获取历史消息"
-	@handler csFetchHistoryMsg
+	@handler fetchHistoryMsg
 	post /cs/fetch-history-msg (CsFetchHistoryMsgReq) returns (CsFetchHistoryMsgResp)
 	
 	@doc "客服获取消息"
-	@handler csFetchMsg
+	@handler fetchMsg
 	post /cs/fetch-msg (CsFetchMsgReq) returns (CsFetchMsgResp)
 	
 	@doc "客服发送消息"
-	@handler csSendMsg
+	@handler sendMsg
 	post /cs/send-msg (CsSendMsgReq)
 }

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

@@ -1,4 +1,4 @@
-Name: apibff
+Name: cmdbff
 Host: 0.0.0.0
 Port: 10001
 

+ 0 - 0
bff/apibff/internal/config/config.go → bff/cmdbff/api/internal/config/config.go


+ 8 - 7
bff/apibff/internal/handler/cs/cmd/csconnectplayerhandler.go → bff/cmdbff/api/internal/handler/cs/connectplayerhandler.go

@@ -1,24 +1,25 @@
-package cmd
+package cs
 
 import (
 	"net/http"
 	"ylink/ext/result"
 
 	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/cs/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/logic/cs"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 )
 
-func CsConnectPlayerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+func ConnectPlayerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 		var req types.CsConnectPlayerReq
 		if err := httpx.Parse(r, &req); err != nil {
 			result.ParamErrorResult(r, w, err)
+			return
 		}
 
-		l := cmd.NewCsConnectPlayerLogic(r.Context(), svcCtx)
-		err := l.CsConnectPlayer(&req)
+		l := cs.NewConnectPlayerLogic(r.Context(), svcCtx)
+		err := l.ConnectPlayer(&req)
 		result.HttpResult(r, w, nil, err)
 	}
 }

+ 25 - 0
bff/cmdbff/api/internal/handler/cs/fetchhistorylisthandler.go

@@ -0,0 +1,25 @@
+package cs
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"ylink/bff/cmdbff/api/internal/logic/cs"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+)
+
+func FetchHistoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CsFetchHistoryChatReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := cs.NewFetchHistoryListLogic(r.Context(), svcCtx)
+		resp, err := l.FetchHistoryList(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
bff/cmdbff/api/internal/handler/cs/fetchhistorymsghandler.go

@@ -0,0 +1,25 @@
+package cs
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"ylink/bff/cmdbff/api/internal/logic/cs"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+)
+
+func FetchHistoryMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CsFetchHistoryMsgReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := cs.NewFetchHistoryMsgLogic(r.Context(), svcCtx)
+		resp, err := l.FetchHistoryMsg(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
bff/cmdbff/api/internal/handler/cs/fetchmsghandler.go

@@ -0,0 +1,25 @@
+package cs
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"ylink/bff/cmdbff/api/internal/logic/cs"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+)
+
+func FetchMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CsFetchMsgReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := cs.NewFetchMsgLogic(r.Context(), svcCtx)
+		resp, err := l.FetchMsg(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
bff/cmdbff/api/internal/handler/cs/fetchplayerqueuehandler.go

@@ -0,0 +1,25 @@
+package cs
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"ylink/bff/cmdbff/api/internal/logic/cs"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+)
+
+func FetchPlayerQueueHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CsFetchPlayerQueueReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := cs.NewFetchPlayerQueueLogic(r.Context(), svcCtx)
+		resp, err := l.FetchPlayerQueue(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 25 - 0
bff/cmdbff/api/internal/handler/cs/sendmsghandler.go

@@ -0,0 +1,25 @@
+package cs
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"ylink/bff/cmdbff/api/internal/logic/cs"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+)
+
+func SendMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CsSendMsgReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := cs.NewSendMsgLogic(r.Context(), svcCtx)
+		err := l.SendMsg(&req)
+		result.HttpResult(r, w, nil, err)
+	}
+}

+ 17 - 0
bff/cmdbff/api/internal/handler/player/disconnecthandler.go

@@ -0,0 +1,17 @@
+package player
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"ylink/bff/cmdbff/api/internal/logic/player"
+	"ylink/bff/cmdbff/api/internal/svc"
+)
+
+func DisconnectHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		l := player.NewDisconnectLogic(r.Context(), svcCtx)
+		err := l.Disconnect()
+		result.HttpResult(r, w, nil, err)
+	}
+}

+ 8 - 7
bff/apibff/internal/handler/player/cmd/playerfetchcsinfohandler.go → bff/cmdbff/api/internal/handler/player/fetchcsinfohandler.go

@@ -1,24 +1,25 @@
-package cmd
+package player
 
 import (
 	"net/http"
 	"ylink/ext/result"
 
 	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/player/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/logic/player"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 )
 
-func PlayerFetchCsInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+func FetchCsInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 		var req types.PlayerFetchCsInfoReq
 		if err := httpx.Parse(r, &req); err != nil {
 			result.ParamErrorResult(r, w, err)
+			return
 		}
 
-		l := cmd.NewPlayerFetchCsInfoLogic(r.Context(), svcCtx)
-		resp, err := l.PlayerFetchCsInfo(&req)
+		l := player.NewFetchCsInfoLogic(r.Context(), svcCtx)
+		resp, err := l.FetchCsInfo(&req)
 		result.HttpResult(r, w, resp, err)
 	}
 }

+ 25 - 0
bff/cmdbff/api/internal/handler/player/fetchhistorymsghandler.go

@@ -0,0 +1,25 @@
+package player
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"ylink/bff/cmdbff/api/internal/logic/player"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+)
+
+func FetchHistoryMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.PlayerFetchHistoryMsgReq
+		if err := httpx.Parse(r, &req); err != nil {
+			result.ParamErrorResult(r, w, err)
+			return
+		}
+
+		l := player.NewFetchHistoryMsgLogic(r.Context(), svcCtx)
+		resp, err := l.FetchHistoryMsg(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 17 - 0
bff/cmdbff/api/internal/handler/player/fetchmsghandler.go

@@ -0,0 +1,17 @@
+package player
+
+import (
+	"net/http"
+	"ylink/ext/result"
+
+	"ylink/bff/cmdbff/api/internal/logic/player"
+	"ylink/bff/cmdbff/api/internal/svc"
+)
+
+func FetchMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		l := player.NewFetchMsgLogic(r.Context(), svcCtx)
+		resp, err := l.FetchMsg()
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 8 - 7
bff/apibff/internal/handler/player/cmd/playersendmsghandler.go → bff/cmdbff/api/internal/handler/player/sendmsghandler.go

@@ -1,24 +1,25 @@
-package cmd
+package player
 
 import (
 	"net/http"
 	"ylink/ext/result"
 
 	"github.com/zeromicro/go-zero/rest/httpx"
-	"ylink/bff/apibff/internal/logic/player/cmd"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/logic/player"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 )
 
-func PlayerSendMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+func SendMsgHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
 		var req types.PlayerSendMsgReq
 		if err := httpx.Parse(r, &req); err != nil {
 			result.ParamErrorResult(r, w, err)
+			return
 		}
 
-		l := cmd.NewPlayerSendMsgLogic(r.Context(), svcCtx)
-		err := l.PlayerSendMsg(&req)
+		l := player.NewSendMsgLogic(r.Context(), svcCtx)
+		err := l.SendMsg(&req)
 		result.HttpResult(r, w, nil, err)
 	}
 }

+ 16 - 16
bff/apibff/internal/handler/routes.go → bff/cmdbff/api/internal/handler/routes.go

@@ -4,9 +4,9 @@ package handler
 import (
 	"net/http"
 
-	cscmd "ylink/bff/apibff/internal/handler/cs/cmd"
-	playercmd "ylink/bff/apibff/internal/handler/player/cmd"
-	"ylink/bff/apibff/internal/svc"
+	cs "ylink/bff/cmdbff/api/internal/handler/cs"
+	player "ylink/bff/cmdbff/api/internal/handler/player"
+	"ylink/bff/cmdbff/api/internal/svc"
 
 	"github.com/zeromicro/go-zero/rest"
 )
@@ -17,31 +17,31 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			{
 				Method:  http.MethodPost,
 				Path:    "/player/fetch-cs-info",
-				Handler: playercmd.PlayerFetchCsInfoHandler(serverCtx),
+				Handler: player.FetchCsInfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/player/fetch-history-msg",
-				Handler: playercmd.PlayerFetchHistoryMsgHandler(serverCtx),
+				Handler: player.FetchHistoryMsgHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/player/fetch-msg",
-				Handler: playercmd.PlayerFetchMsgHandler(serverCtx),
+				Handler: player.FetchMsgHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/player/send-msg",
-				Handler: playercmd.PlayerSendMsgHandler(serverCtx),
+				Handler: player.SendMsgHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/player/disconnect",
-				Handler: playercmd.PlayerDisconnectHandler(serverCtx),
+				Handler: player.DisconnectHandler(serverCtx),
 			},
 		},
 		rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
-		rest.WithPrefix("/api/v1"),
+		rest.WithPrefix("/api/v1/cmd"),
 	)
 
 	server.AddRoutes(
@@ -49,35 +49,35 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			{
 				Method:  http.MethodPost,
 				Path:    "/cs/fetch-player-queue",
-				Handler: cscmd.CsFetchPlayerQueueHandler(serverCtx),
+				Handler: cs.FetchPlayerQueueHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/cs/connect-player",
-				Handler: cscmd.CsConnectPlayerHandler(serverCtx),
+				Handler: cs.ConnectPlayerHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/cs/fetch-history-list",
-				Handler: cscmd.CsFetchHistoryListHandler(serverCtx),
+				Handler: cs.FetchHistoryListHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/cs/fetch-history-msg",
-				Handler: cscmd.CsFetchHistoryMsgHandler(serverCtx),
+				Handler: cs.FetchHistoryMsgHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/cs/fetch-msg",
-				Handler: cscmd.CsFetchMsgHandler(serverCtx),
+				Handler: cs.FetchMsgHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/cs/send-msg",
-				Handler: cscmd.CsSendMsgHandler(serverCtx),
+				Handler: cs.SendMsgHandler(serverCtx),
 			},
 		},
 		rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
-		rest.WithPrefix("/api/v1"),
+		rest.WithPrefix("/api/v1/cmd"),
 	)
 }

+ 30 - 0
bff/cmdbff/api/internal/logic/cs/connectplayerlogic.go

@@ -0,0 +1,30 @@
+package cs
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ConnectPlayerLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewConnectPlayerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConnectPlayerLogic {
+	return &ConnectPlayerLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ConnectPlayerLogic) ConnectPlayer(req *types.CsConnectPlayerReq) error {
+	// todo: add your logic here and delete this line
+
+	return nil
+}

+ 4 - 4
bff/apibff/internal/logic/cs/cmd/csconnectplayerlogic.go → bff/cmdbff/api/internal/logic/cs/csconnectplayerlogic.go

@@ -1,11 +1,11 @@
-package cmd
+package cs
 
 import (
 	"context"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/pb"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
bff/apibff/internal/logic/cs/cmd/csfetchhistorylistlogic.go → bff/cmdbff/api/internal/logic/cs/csfetchhistorylistlogic.go

@@ -1,10 +1,10 @@
-package cmd
+package cs
 
 import (
 	"context"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
bff/apibff/internal/logic/cs/cmd/csfetchhistorymsglogic.go → bff/cmdbff/api/internal/logic/cs/csfetchhistorymsglogic.go

@@ -1,10 +1,10 @@
-package cmd
+package cs
 
 import (
 	"context"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
bff/apibff/internal/logic/cs/cmd/csfetchmsglogic.go → bff/cmdbff/api/internal/logic/cs/csfetchmsglogic.go

@@ -1,10 +1,10 @@
-package cmd
+package cs
 
 import (
 	"context"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
bff/apibff/internal/logic/cs/cmd/csfetchplayerqueuelogic.go → bff/cmdbff/api/internal/logic/cs/csfetchplayerqueuelogic.go

@@ -1,10 +1,10 @@
-package cmd
+package cs
 
 import (
 	"context"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
bff/apibff/internal/logic/cs/cmd/cssendmsglogic.go → bff/cmdbff/api/internal/logic/cs/cssendmsglogic.go

@@ -1,10 +1,10 @@
-package cmd
+package cs
 
 import (
 	"context"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 30 - 0
bff/cmdbff/api/internal/logic/cs/fetchhistorylistlogic.go

@@ -0,0 +1,30 @@
+package cs
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchHistoryListLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchHistoryListLogic {
+	return &FetchHistoryListLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchHistoryListLogic) FetchHistoryList(req *types.CsFetchHistoryChatReq) (resp *types.CsFetchHistoryChatResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/cs/fetchhistorymsglogic.go

@@ -0,0 +1,30 @@
+package cs
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchHistoryMsgLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchHistoryMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchHistoryMsgLogic {
+	return &FetchHistoryMsgLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchHistoryMsgLogic) FetchHistoryMsg(req *types.CsFetchHistoryMsgReq) (resp *types.CsFetchHistoryMsgResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/cs/fetchmsglogic.go

@@ -0,0 +1,30 @@
+package cs
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchMsgLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchMsgLogic {
+	return &FetchMsgLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchMsgLogic) FetchMsg(req *types.CsFetchMsgReq) (resp *types.CsFetchMsgResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/cs/fetchplayerqueuelogic.go

@@ -0,0 +1,30 @@
+package cs
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchPlayerQueueLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchPlayerQueueLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchPlayerQueueLogic {
+	return &FetchPlayerQueueLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchPlayerQueueLogic) FetchPlayerQueue(req *types.CsFetchPlayerQueueReq) (resp *types.CsFetchPlayerQueueResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/cs/sendmsglogic.go

@@ -0,0 +1,30 @@
+package cs
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type SendMsgLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewSendMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendMsgLogic {
+	return &SendMsgLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *SendMsgLogic) SendMsg(req *types.CsSendMsgReq) error {
+	// todo: add your logic here and delete this line
+
+	return nil
+}

+ 28 - 0
bff/cmdbff/api/internal/logic/player/disconnectlogic.go

@@ -0,0 +1,28 @@
+package player
+
+import (
+	"context"
+
+	"github.com/zeromicro/go-zero/core/logx"
+	"ylink/bff/cmdbff/api/internal/svc"
+)
+
+type DisconnectLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewDisconnectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DisconnectLogic {
+	return &DisconnectLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *DisconnectLogic) Disconnect() error {
+	// todo: add your logic here and delete this line
+
+	return nil
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/player/fetchcsinfologic.go

@@ -0,0 +1,30 @@
+package player
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchCsInfoLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchCsInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchCsInfoLogic {
+	return &FetchCsInfoLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchCsInfoLogic) FetchCsInfo(req *types.PlayerFetchCsInfoReq) (resp *types.PlayerFetchCsInfoResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/player/fetchhistorymsglogic.go

@@ -0,0 +1,30 @@
+package player
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchHistoryMsgLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchHistoryMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchHistoryMsgLogic {
+	return &FetchHistoryMsgLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchHistoryMsgLogic) FetchHistoryMsg(req *types.PlayerFetchHistoryMsgReq) (resp *types.PlayerFetchHistoryMsgResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 30 - 0
bff/cmdbff/api/internal/logic/player/fetchmsglogic.go

@@ -0,0 +1,30 @@
+package player
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type FetchMsgLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewFetchMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FetchMsgLogic {
+	return &FetchMsgLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *FetchMsgLogic) FetchMsg() (resp *types.PlayerFetchMsgResp, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 3 - 3
bff/apibff/internal/logic/player/cmd/playerdisconnectlogic.go → bff/cmdbff/api/internal/logic/player/playerdisconnectlogic.go

@@ -1,12 +1,12 @@
-package cmd
+package player
 
 import (
 	"context"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/pb"
 	"ylink/ext/ctxdata"
 
 	"github.com/zeromicro/go-zero/core/logx"
-	"ylink/bff/apibff/internal/svc"
+	"ylink/bff/cmdbff/api/internal/svc"
 )
 
 type PlayerDisconnectLogic struct {

+ 4 - 4
bff/apibff/internal/logic/player/cmd/playerfetchcsinfologic.go → bff/cmdbff/api/internal/logic/player/playerfetchcsinfologic.go

@@ -1,11 +1,11 @@
-package cmd
+package player
 
 import (
 	"context"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/pb"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 5 - 4
bff/apibff/internal/logic/player/cmd/playerfetchhistorymsglogic.go → bff/cmdbff/api/internal/logic/player/playerfetchhistorymsglogic.go

@@ -1,12 +1,13 @@
-package cmd
+package player
 
 import (
 	"context"
-	"ylink/apis/cmd/pb"
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/core/cmd/rpc/pb"
 	"ylink/ext/ctxdata"
 
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
 	"github.com/zeromicro/go-zero/core/logx"
 )
 

+ 4 - 4
bff/apibff/internal/logic/player/cmd/playerfetchmsglogic.go → bff/cmdbff/api/internal/logic/player/playerfetchmsglogic.go

@@ -1,12 +1,12 @@
-package cmd
+package player
 
 import (
 	"context"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/pb"
 	"ylink/ext/ctxdata"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 4 - 4
bff/apibff/internal/logic/player/cmd/playersendmsglogic.go → bff/cmdbff/api/internal/logic/player/playersendmsglogic.go

@@ -1,12 +1,12 @@
-package cmd
+package player
 
 import (
 	"context"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/pb"
 	"ylink/ext/ctxdata"
 
-	"ylink/bff/apibff/internal/svc"
-	"ylink/bff/apibff/internal/types"
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 30 - 0
bff/cmdbff/api/internal/logic/player/sendmsglogic.go

@@ -0,0 +1,30 @@
+package player
+
+import (
+	"context"
+
+	"ylink/bff/cmdbff/api/internal/svc"
+	"ylink/bff/cmdbff/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type SendMsgLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewSendMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendMsgLogic {
+	return &SendMsgLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *SendMsgLogic) SendMsg(req *types.PlayerSendMsgReq) error {
+	// todo: add your logic here and delete this line
+
+	return nil
+}

+ 2 - 2
bff/apibff/internal/svc/servicecontext.go → bff/cmdbff/api/internal/svc/servicecontext.go

@@ -2,8 +2,8 @@ package svc
 
 import (
 	"github.com/zeromicro/go-zero/zrpc"
-	"ylink/apis/cmd/cmd"
-	"ylink/bff/apibff/internal/config"
+	"ylink/bff/cmdbff/api/internal/config"
+	"ylink/core/cmd/rpc/cmd"
 )
 
 type ServiceContext struct {

+ 0 - 0
bff/apibff/internal/types/types.go → bff/cmdbff/api/internal/types/types.go


+ 2 - 2
bff/rpcbff/etc/rpcbff.yaml → bff/rpcbff/rpc/etc/rpcbff.yaml

@@ -1,12 +1,12 @@
 Name: rpcbff.rpc
-ListenOn: 0.0.0.0:10100
+ListenOn: 0.0.0.0:10200
 
 Etcd:
   Hosts:
     - 127.0.0.1:2379
   Key: rpcbff.rpc
 
-AuthRpc:
+AuthRpcConf:
   Etcd:
     Hosts:
       - 127.0.0.1:2379

+ 1 - 1
bff/rpcbff/internal/config/config.go → bff/rpcbff/rpc/internal/config/config.go

@@ -4,5 +4,5 @@ import "github.com/zeromicro/go-zero/zrpc"
 
 type Config struct {
 	zrpc.RpcServerConf
-	AuthRpc zrpc.RpcClientConf
+	AuthRpcConf zrpc.RpcClientConf
 }

+ 15 - 17
bff/rpcbff/internal/logic/connectlogic.go → bff/rpcbff/rpc/internal/logic/connectlogic.go

@@ -2,12 +2,13 @@ package logic
 
 import (
 	"context"
-	"google.golang.org/protobuf/types/known/structpb"
-	"ylink/apis/auth/auth"
+	"ylink/core/auth/rpc/auth"
+	"ylink/ext/result"
+
+	"ylink/bff/rpcbff/rpc/internal/svc"
+	"ylink/bff/rpcbff/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
-	"ylink/bff/rpcbff/internal/svc"
-	"ylink/bff/rpcbff/pb"
 )
 
 type ConnectLogic struct {
@@ -25,23 +26,20 @@ func NewConnectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConnectLo
 }
 
 func (l *ConnectLogic) Connect(in *pb.CommandReq, stream pb.Rpcbff_ConnectServer) error {
-	// todo: 验证token
-	// todo: 把stream放入资源pool
-	if authResp, err := l.svcCtx.AuthRpc.CheckAuth(l.ctx, &auth.CheckAuthReq{
+	_, err := l.svcCtx.AuthRpc.CheckAuth(l.ctx, &auth.CheckAuthReq{
 		AccessToken: in.AccessToken,
-	}); err != nil {
+	})
+	//data, _ := structpb.NewStruct(map[string]interface{}{})
+	if err != nil {
 		return stream.Send(&pb.CommandResp{
-			CommandCode: authResp.Code,
-			CommandMsg:  authResp.Msg,
-			CommandData: authResp.Data,
+			Code: result.TokenParseError,
+			Msg:  err.Error(),
+			Data: nil,
 		})
 	}
-
-	data, _ := structpb.NewStruct(map[string]interface{}{})
-
 	return stream.Send(&pb.CommandResp{
-		CommandCode: 0,
-		CommandMsg:  "success",
-		CommandData: data,
+		Code: result.Ok,
+		Msg:  "success",
+		Data: nil,
 	})
 }

+ 18 - 13
bff/rpcbff/internal/logic/disconnectlogic.go → bff/rpcbff/rpc/internal/logic/disconnectlogic.go

@@ -2,10 +2,11 @@ package logic
 
 import (
 	"context"
-	"google.golang.org/protobuf/types/known/structpb"
+	"ylink/core/auth/rpc/auth"
+	"ylink/ext/result"
 
-	"ylink/bff/rpcbff/internal/svc"
-	"ylink/bff/rpcbff/pb"
+	"ylink/bff/rpcbff/rpc/internal/svc"
+	"ylink/bff/rpcbff/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -25,16 +26,20 @@ func NewDisconnectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Discon
 }
 
 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.AccessToken)
-
-	data, _ := structpb.NewStruct(map[string]interface{}{})
+	_, err := l.svcCtx.AuthRpc.CheckAuth(l.ctx, &auth.CheckAuthReq{
+		AccessToken: in.AccessToken,
+	})
+	//data, _ := structpb.NewStruct(map[string]interface{}{})
+	if err != nil {
+		return &pb.CommandResp{
+			Code: result.TokenParseError,
+			Msg:  err.Error(),
+			Data: nil,
+		}, err
+	}
 	return &pb.CommandResp{
-		CommandCode: 0,
-		CommandMsg:  "success",
-		CommandData: data,
+		Code: result.Ok,
+		Msg:  "success",
+		Data: nil,
 	}, nil
 }

+ 3 - 3
bff/rpcbff/internal/server/rpcbffserver.go → bff/rpcbff/rpc/internal/server/rpcbffserver.go

@@ -6,9 +6,9 @@ package server
 import (
 	"context"
 
-	"ylink/bff/rpcbff/internal/logic"
-	"ylink/bff/rpcbff/internal/svc"
-	"ylink/bff/rpcbff/pb"
+	"ylink/bff/rpcbff/rpc/internal/logic"
+	"ylink/bff/rpcbff/rpc/internal/svc"
+	"ylink/bff/rpcbff/rpc/pb"
 )
 
 type RpcbffServer struct {

+ 3 - 3
bff/authbff/internal/svc/servicecontext.go → bff/rpcbff/rpc/internal/svc/servicecontext.go

@@ -2,8 +2,8 @@ package svc
 
 import (
 	"github.com/zeromicro/go-zero/zrpc"
-	"ylink/apis/auth/auth"
-	"ylink/bff/authbff/internal/config"
+	"ylink/bff/rpcbff/rpc/internal/config"
+	"ylink/core/auth/rpc/auth"
 )
 
 type ServiceContext struct {
@@ -14,6 +14,6 @@ type ServiceContext struct {
 func NewServiceContext(c config.Config) *ServiceContext {
 	return &ServiceContext{
 		Config:  c,
-		AuthRpc: auth.NewAuth(zrpc.MustNewClient(c.AuthRpc)),
+		AuthRpc: auth.NewAuth(zrpc.MustNewClient(c.AuthRpcConf)),
 	}
 }

+ 129 - 69
bff/rpcbff/pb/rpcbff.pb.go → bff/rpcbff/rpc/pb/rpcbff.pb.go

@@ -21,18 +21,63 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
-type CommandResp struct {
+type ConnectType int32
+
+const (
+	ConnectType_PLAYER ConnectType = 0
+	ConnectType_CS     ConnectType = 1
+)
+
+// Enum value maps for ConnectType.
+var (
+	ConnectType_name = map[int32]string{
+		0: "PLAYER",
+		1: "CS",
+	}
+	ConnectType_value = map[string]int32{
+		"PLAYER": 0,
+		"CS":     1,
+	}
+)
+
+func (x ConnectType) Enum() *ConnectType {
+	p := new(ConnectType)
+	*p = x
+	return p
+}
+
+func (x ConnectType) String() string {
+	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (ConnectType) Descriptor() protoreflect.EnumDescriptor {
+	return file_pb_rpcbff_proto_enumTypes[0].Descriptor()
+}
+
+func (ConnectType) Type() protoreflect.EnumType {
+	return &file_pb_rpcbff_proto_enumTypes[0]
+}
+
+func (x ConnectType) Number() protoreflect.EnumNumber {
+	return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use ConnectType.Descriptor instead.
+func (ConnectType) EnumDescriptor() ([]byte, []int) {
+	return file_pb_rpcbff_proto_rawDescGZIP(), []int{0}
+}
+
+type CommandReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	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"`
+	Type        ConnectType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.ConnectType" json:"type,omitempty"`
+	AccessToken string      `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
 }
 
-func (x *CommandResp) Reset() {
-	*x = CommandResp{}
+func (x *CommandReq) Reset() {
+	*x = CommandReq{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_pb_rpcbff_proto_msgTypes[0]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -40,13 +85,13 @@ func (x *CommandResp) Reset() {
 	}
 }
 
-func (x *CommandResp) String() string {
+func (x *CommandReq) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*CommandResp) ProtoMessage() {}
+func (*CommandReq) ProtoMessage() {}
 
-func (x *CommandResp) ProtoReflect() protoreflect.Message {
+func (x *CommandReq) ProtoReflect() protoreflect.Message {
 	mi := &file_pb_rpcbff_proto_msgTypes[0]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -58,42 +103,37 @@ func (x *CommandResp) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use CommandResp.ProtoReflect.Descriptor instead.
-func (*CommandResp) Descriptor() ([]byte, []int) {
+// Deprecated: Use CommandReq.ProtoReflect.Descriptor instead.
+func (*CommandReq) Descriptor() ([]byte, []int) {
 	return file_pb_rpcbff_proto_rawDescGZIP(), []int{0}
 }
 
-func (x *CommandResp) GetCommandCode() int64 {
+func (x *CommandReq) GetType() ConnectType {
 	if x != nil {
-		return x.CommandCode
+		return x.Type
 	}
-	return 0
+	return ConnectType_PLAYER
 }
 
-func (x *CommandResp) GetCommandMsg() string {
+func (x *CommandReq) GetAccessToken() string {
 	if x != nil {
-		return x.CommandMsg
+		return x.AccessToken
 	}
 	return ""
 }
 
-func (x *CommandResp) GetCommandData() *structpb.Struct {
-	if x != nil {
-		return x.CommandData
-	}
-	return nil
-}
-
-type CommandReq struct {
+type CommandResp 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"`
+	Code int64            `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
+	Msg  string           `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
+	Data *structpb.Struct `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
 }
 
-func (x *CommandReq) Reset() {
-	*x = CommandReq{}
+func (x *CommandResp) Reset() {
+	*x = CommandResp{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_pb_rpcbff_proto_msgTypes[1]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -101,13 +141,13 @@ func (x *CommandReq) Reset() {
 	}
 }
 
-func (x *CommandReq) String() string {
+func (x *CommandResp) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*CommandReq) ProtoMessage() {}
+func (*CommandResp) ProtoMessage() {}
 
-func (x *CommandReq) ProtoReflect() protoreflect.Message {
+func (x *CommandResp) ProtoReflect() protoreflect.Message {
 	mi := &file_pb_rpcbff_proto_msgTypes[1]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -119,44 +159,60 @@ func (x *CommandReq) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use CommandReq.ProtoReflect.Descriptor instead.
-func (*CommandReq) Descriptor() ([]byte, []int) {
+// Deprecated: Use CommandResp.ProtoReflect.Descriptor instead.
+func (*CommandResp) Descriptor() ([]byte, []int) {
 	return file_pb_rpcbff_proto_rawDescGZIP(), []int{1}
 }
 
-func (x *CommandReq) GetAccessToken() string {
+func (x *CommandResp) GetCode() int64 {
 	if x != nil {
-		return x.AccessToken
+		return x.Code
+	}
+	return 0
+}
+
+func (x *CommandResp) GetMsg() string {
+	if x != nil {
+		return x.Msg
 	}
 	return ""
 }
 
+func (x *CommandResp) GetData() *structpb.Struct {
+	if x != nil {
+		return x.Data
+	}
+	return nil
+}
+
 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, 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, 0x2f, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65,
-	0x71, 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, 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,
+	0x6f, 0x74, 0x6f, 0x22, 0x54, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65,
+	0x71, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
+	0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65,
+	0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
+	0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63,
+	0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x60, 0x0a, 0x0b, 0x43, 0x6f, 0x6d,
+	0x6d, 0x61, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03,
+	0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x2b,
+	0x0a, 0x04, 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, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x21, 0x0a, 0x0b, 0x43,
+	0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x4c,
+	0x41, 0x59, 0x45, 0x52, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x43, 0x53, 0x10, 0x01, 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 (
@@ -171,23 +227,26 @@ func file_pb_rpcbff_proto_rawDescGZIP() []byte {
 	return file_pb_rpcbff_proto_rawDescData
 }
 
+var file_pb_rpcbff_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
 var file_pb_rpcbff_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
 var file_pb_rpcbff_proto_goTypes = []interface{}{
-	(*CommandResp)(nil),     // 0: pb.CommandResp
+	(ConnectType)(0),        // 0: pb.ConnectType
 	(*CommandReq)(nil),      // 1: pb.CommandReq
-	(*structpb.Struct)(nil), // 2: google.protobuf.Struct
+	(*CommandResp)(nil),     // 2: pb.CommandResp
+	(*structpb.Struct)(nil), // 3: google.protobuf.Struct
 }
 var file_pb_rpcbff_proto_depIdxs = []int32{
-	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
+	0, // 0: pb.CommandReq.type:type_name -> pb.ConnectType
+	3, // 1: pb.CommandResp.data:type_name -> google.protobuf.Struct
+	1, // 2: pb.Rpcbff.connect:input_type -> pb.CommandReq
+	1, // 3: pb.Rpcbff.disconnect:input_type -> pb.CommandReq
+	2, // 4: pb.Rpcbff.connect:output_type -> pb.CommandResp
+	2, // 5: pb.Rpcbff.disconnect:output_type -> pb.CommandResp
+	4, // [4:6] is the sub-list for method output_type
+	2, // [2:4] is the sub-list for method input_type
+	2, // [2:2] is the sub-list for extension type_name
+	2, // [2:2] is the sub-list for extension extendee
+	0, // [0:2] is the sub-list for field type_name
 }
 
 func init() { file_pb_rpcbff_proto_init() }
@@ -197,7 +256,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.(*CommandResp); i {
+			switch v := v.(*CommandReq); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -209,7 +268,7 @@ func file_pb_rpcbff_proto_init() {
 			}
 		}
 		file_pb_rpcbff_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CommandReq); i {
+			switch v := v.(*CommandResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -226,13 +285,14 @@ func file_pb_rpcbff_proto_init() {
 		File: protoimpl.DescBuilder{
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_pb_rpcbff_proto_rawDesc,
-			NumEnums:      0,
+			NumEnums:      1,
 			NumMessages:   2,
 			NumExtensions: 0,
 			NumServices:   1,
 		},
 		GoTypes:           file_pb_rpcbff_proto_goTypes,
 		DependencyIndexes: file_pb_rpcbff_proto_depIdxs,
+		EnumInfos:         file_pb_rpcbff_proto_enumTypes,
 		MessageInfos:      file_pb_rpcbff_proto_msgTypes,
 	}.Build()
 	File_pb_rpcbff_proto = out.File

+ 11 - 5
bff/rpcbff/pb/rpcbff.proto → bff/rpcbff/rpc/pb/rpcbff.proto

@@ -6,14 +6,20 @@ package pb;
 
 import "google/protobuf/struct.proto";
 
-message CommandResp {
-  int64 command_code = 1;
-  string  command_msg = 2;
-  google.protobuf.Struct command_data = 3;
+enum ConnectType{
+  PLAYER = 0;
+  CS = 1;
 }
 
 message CommandReq {
-  string access_token = 1;
+  ConnectType type = 1;
+  string access_token = 2;
+}
+
+message CommandResp {
+  int64 code = 1;
+  string  msg = 2;
+  google.protobuf.Struct data = 3;
 }
 
 service Rpcbff {

+ 0 - 0
bff/rpcbff/pb/rpcbff_grpc.pb.go → bff/rpcbff/rpc/pb/rpcbff_grpc.pb.go


+ 4 - 4
bff/rpcbff/rpcbff.go → bff/rpcbff/rpc/rpcbff.go

@@ -4,10 +4,10 @@ import (
 	"flag"
 	"fmt"
 
-	"ylink/bff/rpcbff/internal/config"
-	"ylink/bff/rpcbff/internal/server"
-	"ylink/bff/rpcbff/internal/svc"
-	"ylink/bff/rpcbff/pb"
+	"ylink/bff/rpcbff/rpc/internal/config"
+	"ylink/bff/rpcbff/rpc/internal/server"
+	"ylink/bff/rpcbff/rpc/internal/svc"
+	"ylink/bff/rpcbff/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/service"

+ 1 - 1
bff/rpcbff/rpcbff/rpcbff.go → bff/rpcbff/rpc/rpcbff/rpcbff.go

@@ -6,7 +6,7 @@ package rpcbff
 import (
 	"context"
 
-	"ylink/bff/rpcbff/pb"
+	"ylink/bff/rpcbff/rpc/pb"
 
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"

+ 4 - 4
apis/auth/auth.go → core/auth/rpc/auth.go

@@ -4,10 +4,10 @@ import (
 	"flag"
 	"fmt"
 
-	"ylink/apis/auth/internal/config"
-	"ylink/apis/auth/internal/server"
-	"ylink/apis/auth/internal/svc"
-	"ylink/apis/auth/pb"
+	"ylink/core/auth/rpc/internal/config"
+	"ylink/core/auth/rpc/internal/server"
+	"ylink/core/auth/rpc/internal/svc"
+	"ylink/core/auth/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/service"

+ 4 - 3
apis/auth/auth/auth.go → core/auth/rpc/auth/auth.go

@@ -6,7 +6,7 @@ package auth
 import (
 	"context"
 
-	"ylink/apis/auth/pb"
+	"ylink/core/auth/rpc/pb"
 
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
@@ -15,13 +15,14 @@ import (
 type (
 	AuthResp      = pb.AuthResp
 	CheckAuthReq  = pb.CheckAuthReq
+	CheckAuthResp = pb.CheckAuthResp
 	CsAuthReq     = pb.CsAuthReq
 	PlayerAuthReq = pb.PlayerAuthReq
 
 	Auth interface {
 		PlayerAuth(ctx context.Context, in *PlayerAuthReq, opts ...grpc.CallOption) (*AuthResp, error)
 		CsAuth(ctx context.Context, in *CsAuthReq, opts ...grpc.CallOption) (*AuthResp, error)
-		CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*AuthResp, error)
+		CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*CheckAuthResp, error)
 	}
 
 	defaultAuth struct {
@@ -45,7 +46,7 @@ func (m *defaultAuth) CsAuth(ctx context.Context, in *CsAuthReq, opts ...grpc.Ca
 	return client.CsAuth(ctx, in, opts...)
 }
 
-func (m *defaultAuth) CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*AuthResp, error) {
+func (m *defaultAuth) CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*CheckAuthResp, error) {
 	client := pb.NewAuthClient(m.cli.Conn())
 	return client.CheckAuth(ctx, in, opts...)
 }

+ 0 - 0
apis/auth/etc/auth.yaml → core/auth/rpc/etc/auth.yaml


+ 0 - 0
apis/auth/internal/config/config.go → core/auth/rpc/internal/config/config.go


+ 48 - 0
core/auth/rpc/internal/logic/checkauthlogic.go

@@ -0,0 +1,48 @@
+package logic
+
+import (
+	"context"
+	"github.com/golang-jwt/jwt/v4"
+	"github.com/pkg/errors"
+	"ylink/ext/result"
+
+	"ylink/core/auth/rpc/internal/svc"
+	"ylink/core/auth/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type CheckAuthLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewCheckAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CheckAuthLogic {
+	return &CheckAuthLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *CheckAuthLogic) CheckAuth(in *pb.CheckAuthReq) (*pb.CheckAuthResp, error) {
+	token, err := jwt.Parse(in.AccessToken, func(token *jwt.Token) (i interface{}, err error) {
+		return []byte(l.svcCtx.Config.JwtAuth.AccessSecret), nil
+	})
+
+	if token.Valid {
+		return &pb.CheckAuthResp{}, nil
+	} else if ve, ok := err.(*jwt.ValidationError); ok {
+		if ve.Errors&jwt.ValidationErrorMalformed != 0 {
+			return nil, errors.Wrap(result.NewErrCode(result.TokenParseError), "")
+		} else if ve.Errors&(jwt.ValidationErrorExpired|jwt.ValidationErrorNotValidYet) != 0 {
+			// Token is either expired or not active yet
+			return nil, errors.Wrap(result.NewErrCode(result.TokenExpireError), "")
+		} else {
+			return nil, errors.Wrap(result.NewErrCode(result.TokenParseError), "")
+		}
+	} else {
+		return nil, errors.Wrap(result.NewErrCode(result.TokenParseError), "")
+	}
+}

+ 6 - 13
apis/auth/internal/logic/csauthlogic.go → core/auth/rpc/internal/logic/csauthlogic.go

@@ -3,12 +3,13 @@ package logic
 import (
 	"context"
 	"github.com/golang-jwt/jwt/v4"
-	"google.golang.org/protobuf/types/known/structpb"
+	"github.com/pkg/errors"
 	"time"
 	"ylink/ext/jwtkey"
+	"ylink/ext/result"
 
-	"ylink/apis/auth/internal/svc"
-	"ylink/apis/auth/pb"
+	"ylink/core/auth/rpc/internal/svc"
+	"ylink/core/auth/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -31,18 +32,10 @@ func (l *CsAuthLogic) CsAuth(in *pb.CsAuthReq) (*pb.AuthResp, error) {
 	now := time.Now().Unix()
 	token, err := l.generateCsToken(now, in.CsId)
 	if err != nil {
-		return nil, err
-	}
-	data, err := structpb.NewStruct(map[string]interface{}{
-		"access_token": token,
-	})
-	if err != nil {
-		return nil, err
+		return nil, errors.Wrap(result.NewErrCode(result.TokenGenerateError), "")
 	}
 	return &pb.AuthResp{
-		Code: 0,
-		Msg:  "success",
-		Data: data,
+		AccessToken: token,
 	}, nil
 }
 

+ 6 - 15
apis/auth/internal/logic/playerauthlogic.go → core/auth/rpc/internal/logic/playerauthlogic.go

@@ -3,12 +3,13 @@ package logic
 import (
 	"context"
 	"github.com/golang-jwt/jwt/v4"
-	"google.golang.org/protobuf/types/known/structpb"
+	"github.com/pkg/errors"
 	"time"
 	"ylink/ext/jwtkey"
+	"ylink/ext/result"
 
-	"ylink/apis/auth/internal/svc"
-	"ylink/apis/auth/pb"
+	"ylink/core/auth/rpc/internal/svc"
+	"ylink/core/auth/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -31,20 +32,10 @@ func (l *PlayerAuthLogic) PlayerAuth(in *pb.PlayerAuthReq) (*pb.AuthResp, error)
 	now := time.Now().Unix()
 	token, err := l.generatePlayerToken(now, in.PlayerId, in.GameId)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrap(result.NewErrCode(result.TokenGenerateError), "")
 	}
-
-	data, err := structpb.NewStruct(map[string]interface{}{
-		"access_token": token,
-	})
-	if err != nil {
-		return nil, err
-	}
-
 	return &pb.AuthResp{
-		Code: 0,
-		Msg:  "success",
-		Data: data,
+		AccessToken: token,
 	}, nil
 }
 

+ 4 - 4
apis/auth/internal/server/authserver.go → core/auth/rpc/internal/server/authserver.go

@@ -6,9 +6,9 @@ package server
 import (
 	"context"
 
-	"ylink/apis/auth/internal/logic"
-	"ylink/apis/auth/internal/svc"
-	"ylink/apis/auth/pb"
+	"ylink/core/auth/rpc/internal/logic"
+	"ylink/core/auth/rpc/internal/svc"
+	"ylink/core/auth/rpc/pb"
 )
 
 type AuthServer struct {
@@ -32,7 +32,7 @@ func (s *AuthServer) CsAuth(ctx context.Context, in *pb.CsAuthReq) (*pb.AuthResp
 	return l.CsAuth(in)
 }
 
-func (s *AuthServer) CheckAuth(ctx context.Context, in *pb.CheckAuthReq) (*pb.AuthResp, error) {
+func (s *AuthServer) CheckAuth(ctx context.Context, in *pb.CheckAuthReq) (*pb.CheckAuthResp, error) {
 	l := logic.NewCheckAuthLogic(ctx, s.svcCtx)
 	return l.CheckAuth(in)
 }

+ 1 - 3
apis/auth/internal/svc/servicecontext.go → core/auth/rpc/internal/svc/servicecontext.go

@@ -1,8 +1,6 @@
 package svc
 
-import (
-	"ylink/apis/auth/internal/config"
-)
+import "ylink/core/auth/rpc/internal/config"
 
 type ServiceContext struct {
 	Config config.Config

+ 109 - 81
apis/auth/pb/auth.pb.go → core/auth/rpc/pb/auth.pb.go

@@ -9,7 +9,6 @@ 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"
 )
@@ -123,7 +122,7 @@ func (x *CsAuthReq) GetCsId() string {
 	return ""
 }
 
-type CheckAuthReq struct {
+type AuthResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
@@ -131,8 +130,8 @@ type CheckAuthReq struct {
 	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
 }
 
-func (x *CheckAuthReq) Reset() {
-	*x = CheckAuthReq{}
+func (x *AuthResp) Reset() {
+	*x = AuthResp{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_pb_auth_proto_msgTypes[2]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -140,13 +139,13 @@ func (x *CheckAuthReq) Reset() {
 	}
 }
 
-func (x *CheckAuthReq) String() string {
+func (x *AuthResp) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*CheckAuthReq) ProtoMessage() {}
+func (*AuthResp) ProtoMessage() {}
 
-func (x *CheckAuthReq) ProtoReflect() protoreflect.Message {
+func (x *AuthResp) ProtoReflect() protoreflect.Message {
 	mi := &file_pb_auth_proto_msgTypes[2]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -158,30 +157,28 @@ func (x *CheckAuthReq) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use CheckAuthReq.ProtoReflect.Descriptor instead.
-func (*CheckAuthReq) Descriptor() ([]byte, []int) {
+// Deprecated: Use AuthResp.ProtoReflect.Descriptor instead.
+func (*AuthResp) Descriptor() ([]byte, []int) {
 	return file_pb_auth_proto_rawDescGZIP(), []int{2}
 }
 
-func (x *CheckAuthReq) GetAccessToken() string {
+func (x *AuthResp) GetAccessToken() string {
 	if x != nil {
 		return x.AccessToken
 	}
 	return ""
 }
 
-type AuthResp struct {
+type CheckAuthReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Code int64            `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
-	Msg  string           `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
-	Data *structpb.Struct `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
+	AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
 }
 
-func (x *AuthResp) Reset() {
-	*x = AuthResp{}
+func (x *CheckAuthReq) Reset() {
+	*x = CheckAuthReq{}
 	if protoimpl.UnsafeEnabled {
 		mi := &file_pb_auth_proto_msgTypes[3]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -189,13 +186,13 @@ func (x *AuthResp) Reset() {
 	}
 }
 
-func (x *AuthResp) String() string {
+func (x *CheckAuthReq) String() string {
 	return protoimpl.X.MessageStringOf(x)
 }
 
-func (*AuthResp) ProtoMessage() {}
+func (*CheckAuthReq) ProtoMessage() {}
 
-func (x *AuthResp) ProtoReflect() protoreflect.Message {
+func (x *CheckAuthReq) ProtoReflect() protoreflect.Message {
 	mi := &file_pb_auth_proto_msgTypes[3]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -207,64 +204,84 @@ func (x *AuthResp) ProtoReflect() protoreflect.Message {
 	return mi.MessageOf(x)
 }
 
-// Deprecated: Use AuthResp.ProtoReflect.Descriptor instead.
-func (*AuthResp) Descriptor() ([]byte, []int) {
+// Deprecated: Use CheckAuthReq.ProtoReflect.Descriptor instead.
+func (*CheckAuthReq) Descriptor() ([]byte, []int) {
 	return file_pb_auth_proto_rawDescGZIP(), []int{3}
 }
 
-func (x *AuthResp) GetCode() int64 {
+func (x *CheckAuthReq) GetAccessToken() string {
 	if x != nil {
-		return x.Code
+		return x.AccessToken
 	}
-	return 0
+	return ""
 }
 
-func (x *AuthResp) GetMsg() string {
-	if x != nil {
-		return x.Msg
+type CheckAuthResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+}
+
+func (x *CheckAuthResp) Reset() {
+	*x = CheckAuthResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_pb_auth_proto_msgTypes[4]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
 	}
-	return ""
 }
 
-func (x *AuthResp) GetData() *structpb.Struct {
-	if x != nil {
-		return x.Data
+func (x *CheckAuthResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CheckAuthResp) ProtoMessage() {}
+
+func (x *CheckAuthResp) ProtoReflect() protoreflect.Message {
+	mi := &file_pb_auth_proto_msgTypes[4]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
 	}
-	return nil
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use CheckAuthResp.ProtoReflect.Descriptor instead.
+func (*CheckAuthResp) Descriptor() ([]byte, []int) {
+	return file_pb_auth_proto_rawDescGZIP(), []int{4}
 }
 
 var File_pb_auth_proto protoreflect.FileDescriptor
 
 var file_pb_auth_proto_rawDesc = []byte{
 	0x0a, 0x0d, 0x70, 0x62, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 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, 0x45, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 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, 0x20, 0x0a, 0x09, 0x43, 0x73, 0x41, 0x75,
-	0x74, 0x68, 0x52, 0x65, 0x71, 0x12, 0x13, 0x0a, 0x05, 0x63, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x73, 0x49, 0x64, 0x22, 0x31, 0x0a, 0x0c, 0x43, 0x68,
-	0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 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, 0x22, 0x5d, 0x0a,
-	0x08, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
-	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a,
-	0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12,
-	0x2b, 0x0a, 0x04, 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, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x89, 0x01, 0x0a,
-	0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x0a, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x41,
-	0x75, 0x74, 0x68, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x41,
-	0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x75, 0x74, 0x68,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x06, 0x63, 0x73, 0x41, 0x75, 0x74, 0x68, 0x12, 0x0d,
-	0x2e, 0x70, 0x62, 0x2e, 0x43, 0x73, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e,
-	0x70, 0x62, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x09, 0x63,
-	0x68, 0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68,
-	0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x70, 0x62, 0x2e,
-	0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
-	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x02, 0x70, 0x62, 0x22, 0x45, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x41, 0x75, 0x74,
+	0x68, 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, 0x20, 0x0a, 0x09, 0x43, 0x73,
+	0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x12, 0x13, 0x0a, 0x05, 0x63, 0x73, 0x5f, 0x69, 0x64,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x73, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x08,
+	0x41, 0x75, 0x74, 0x68, 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, 0x22, 0x31, 0x0a, 0x0c, 0x43,
+	0x68, 0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 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, 0x22, 0x0f,
+	0x0a, 0x0d, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x32,
+	0x8e, 0x01, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x0a, 0x70, 0x6c, 0x61, 0x79,
+	0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x79,
+	0x65, 0x72, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x41,
+	0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x06, 0x63, 0x73, 0x41, 0x75, 0x74,
+	0x68, 0x12, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x73, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71,
+	0x1a, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30,
+	0x0a, 0x09, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x12, 0x10, 0x2e, 0x70, 0x62,
+	0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e,
+	0x70, 0x62, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70,
+	0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -279,27 +296,26 @@ func file_pb_auth_proto_rawDescGZIP() []byte {
 	return file_pb_auth_proto_rawDescData
 }
 
-var file_pb_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_pb_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
 var file_pb_auth_proto_goTypes = []interface{}{
-	(*PlayerAuthReq)(nil),   // 0: pb.PlayerAuthReq
-	(*CsAuthReq)(nil),       // 1: pb.CsAuthReq
-	(*CheckAuthReq)(nil),    // 2: pb.CheckAuthReq
-	(*AuthResp)(nil),        // 3: pb.AuthResp
-	(*structpb.Struct)(nil), // 4: google.protobuf.Struct
+	(*PlayerAuthReq)(nil), // 0: pb.PlayerAuthReq
+	(*CsAuthReq)(nil),     // 1: pb.CsAuthReq
+	(*AuthResp)(nil),      // 2: pb.AuthResp
+	(*CheckAuthReq)(nil),  // 3: pb.CheckAuthReq
+	(*CheckAuthResp)(nil), // 4: pb.CheckAuthResp
 }
 var file_pb_auth_proto_depIdxs = []int32{
-	4, // 0: pb.AuthResp.data:type_name -> google.protobuf.Struct
-	0, // 1: pb.Auth.playerAuth:input_type -> pb.PlayerAuthReq
-	1, // 2: pb.Auth.csAuth:input_type -> pb.CsAuthReq
-	2, // 3: pb.Auth.checkAuth:input_type -> pb.CheckAuthReq
-	3, // 4: pb.Auth.playerAuth:output_type -> pb.AuthResp
-	3, // 5: pb.Auth.csAuth:output_type -> pb.AuthResp
-	3, // 6: pb.Auth.checkAuth:output_type -> pb.AuthResp
-	4, // [4:7] is the sub-list for method output_type
-	1, // [1:4] 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
+	0, // 0: pb.Auth.playerAuth:input_type -> pb.PlayerAuthReq
+	1, // 1: pb.Auth.csAuth:input_type -> pb.CsAuthReq
+	3, // 2: pb.Auth.checkAuth:input_type -> pb.CheckAuthReq
+	2, // 3: pb.Auth.playerAuth:output_type -> pb.AuthResp
+	2, // 4: pb.Auth.csAuth:output_type -> pb.AuthResp
+	4, // 5: pb.Auth.checkAuth:output_type -> pb.CheckAuthResp
+	3, // [3:6] is the sub-list for method output_type
+	0, // [0:3] 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_auth_proto_init() }
@@ -333,7 +349,7 @@ func file_pb_auth_proto_init() {
 			}
 		}
 		file_pb_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CheckAuthReq); i {
+			switch v := v.(*AuthResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -345,7 +361,19 @@ func file_pb_auth_proto_init() {
 			}
 		}
 		file_pb_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*AuthResp); i {
+			switch v := v.(*CheckAuthReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_pb_auth_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*CheckAuthResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -363,7 +391,7 @@ func file_pb_auth_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_pb_auth_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   4,
+			NumMessages:   5,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 6 - 8
apis/auth/pb/auth.proto → core/auth/rpc/pb/auth.proto

@@ -4,8 +4,6 @@ option go_package = "./pb";
 
 package pb;
 
-import "google/protobuf/struct.proto";
-
 message PlayerAuthReq{
   string player_id = 1;
   string game_id = 2;
@@ -15,18 +13,18 @@ message CsAuthReq{
   string cs_id = 1;
 }
 
+message AuthResp{
+  string access_token = 1;
+}
+
 message CheckAuthReq{
   string  access_token = 1;
 }
 
-message AuthResp{
-  int64 code = 1;
-  string msg = 2;
-  google.protobuf.Struct data = 3;
-}
+message CheckAuthResp{}
 
 service Auth{
   rpc playerAuth (PlayerAuthReq) returns (AuthResp);
   rpc csAuth (CsAuthReq) returns (AuthResp);
-  rpc checkAuth (CheckAuthReq) returns (AuthResp);
+  rpc checkAuth (CheckAuthReq) returns (CheckAuthResp);
 }

+ 5 - 5
apis/auth/pb/auth_grpc.pb.go → core/auth/rpc/pb/auth_grpc.pb.go

@@ -24,7 +24,7 @@ const _ = grpc.SupportPackageIsVersion7
 type AuthClient interface {
 	PlayerAuth(ctx context.Context, in *PlayerAuthReq, opts ...grpc.CallOption) (*AuthResp, error)
 	CsAuth(ctx context.Context, in *CsAuthReq, opts ...grpc.CallOption) (*AuthResp, error)
-	CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*AuthResp, error)
+	CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*CheckAuthResp, error)
 }
 
 type authClient struct {
@@ -53,8 +53,8 @@ func (c *authClient) CsAuth(ctx context.Context, in *CsAuthReq, opts ...grpc.Cal
 	return out, nil
 }
 
-func (c *authClient) CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*AuthResp, error) {
-	out := new(AuthResp)
+func (c *authClient) CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...grpc.CallOption) (*CheckAuthResp, error) {
+	out := new(CheckAuthResp)
 	err := c.cc.Invoke(ctx, "/pb.Auth/checkAuth", in, out, opts...)
 	if err != nil {
 		return nil, err
@@ -68,7 +68,7 @@ func (c *authClient) CheckAuth(ctx context.Context, in *CheckAuthReq, opts ...gr
 type AuthServer interface {
 	PlayerAuth(context.Context, *PlayerAuthReq) (*AuthResp, error)
 	CsAuth(context.Context, *CsAuthReq) (*AuthResp, error)
-	CheckAuth(context.Context, *CheckAuthReq) (*AuthResp, error)
+	CheckAuth(context.Context, *CheckAuthReq) (*CheckAuthResp, error)
 	mustEmbedUnimplementedAuthServer()
 }
 
@@ -82,7 +82,7 @@ func (UnimplementedAuthServer) PlayerAuth(context.Context, *PlayerAuthReq) (*Aut
 func (UnimplementedAuthServer) CsAuth(context.Context, *CsAuthReq) (*AuthResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method CsAuth not implemented")
 }
-func (UnimplementedAuthServer) CheckAuth(context.Context, *CheckAuthReq) (*AuthResp, error) {
+func (UnimplementedAuthServer) CheckAuth(context.Context, *CheckAuthReq) (*CheckAuthResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method CheckAuth not implemented")
 }
 func (UnimplementedAuthServer) mustEmbedUnimplementedAuthServer() {}

+ 4 - 4
apis/cmd/cmd.go → core/cmd/rpc/cmd.go

@@ -4,10 +4,10 @@ import (
 	"flag"
 	"fmt"
 
-	"ylink/apis/cmd/internal/config"
-	"ylink/apis/cmd/internal/server"
-	"ylink/apis/cmd/internal/svc"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/internal/config"
+	"ylink/core/cmd/rpc/internal/server"
+	"ylink/core/cmd/rpc/internal/svc"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/service"

+ 1 - 2
apis/cmd/cmd/cmd.go → core/cmd/rpc/cmd/cmd.go

@@ -6,14 +6,13 @@ package cmd
 import (
 	"context"
 
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/zrpc"
 	"google.golang.org/grpc"
 )
 
 type (
-	CmdResp                   = pb.CmdResp
 	CsConnectPlayerReq        = pb.CsConnectPlayerReq
 	CsConnectPlayerResp       = pb.CsConnectPlayerResp
 	CsFetchHistoryChatReq     = pb.CsFetchHistoryChatReq

+ 0 - 0
apis/cmd/etc/cmd.yaml → core/cmd/rpc/etc/cmd.yaml


+ 0 - 0
apis/cmd/internal/config/config.go → core/cmd/rpc/internal/config/config.go


+ 2 - 2
apis/cmd/internal/logic/csconnectplayerlogic.go → core/cmd/rpc/internal/logic/csconnectplayerlogic.go

@@ -3,8 +3,8 @@ package logic
 import (
 	"context"
 
-	"ylink/apis/cmd/internal/svc"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/internal/svc"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 2 - 2
apis/cmd/internal/logic/csfetchhistorychatlogic.go → core/cmd/rpc/internal/logic/csfetchhistorychatlogic.go

@@ -6,8 +6,8 @@ import (
 	"google.golang.org/protobuf/types/known/structpb"
 	"ylink/ext/result"
 
-	"ylink/apis/cmd/internal/svc"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/internal/svc"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 2 - 2
apis/cmd/internal/logic/csfetchhistorymsglogic.go → core/cmd/rpc/internal/logic/csfetchhistorymsglogic.go

@@ -6,8 +6,8 @@ import (
 	"google.golang.org/protobuf/types/known/structpb"
 	"ylink/ext/result"
 
-	"ylink/apis/cmd/internal/svc"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/internal/svc"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 2 - 2
apis/cmd/internal/logic/csfetchmsglogic.go → core/cmd/rpc/internal/logic/csfetchmsglogic.go

@@ -6,8 +6,8 @@ import (
 	"google.golang.org/protobuf/types/known/structpb"
 	"ylink/ext/result"
 
-	"ylink/apis/cmd/internal/svc"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/internal/svc"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 2 - 2
apis/cmd/internal/logic/csfetchplayerqueuelogic.go → core/cmd/rpc/internal/logic/csfetchplayerqueuelogic.go

@@ -6,8 +6,8 @@ import (
 	"google.golang.org/protobuf/types/known/structpb"
 	"ylink/ext/result"
 
-	"ylink/apis/cmd/internal/svc"
-	"ylink/apis/cmd/pb"
+	"ylink/core/cmd/rpc/internal/svc"
+	"ylink/core/cmd/rpc/pb"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

Some files were not shown because too many files changed in this diff