csconnectplayerlogic.go 865 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package logic
  2. import (
  3. "context"
  4. "ylink/core/cmd/rpc/internal/svc"
  5. "ylink/core/cmd/rpc/pb"
  6. "ylink/core/inner/rpc/inner"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type CsConnectPlayerLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewCsConnectPlayerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsConnectPlayerLogic {
  15. return &CsConnectPlayerLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. func (l *CsConnectPlayerLogic) CsConnectPlayer(in *pb.CsConnectPlayerReq) (*pb.CsConnectPlayerResp, error) {
  22. // 调用inner服务建立映射关系
  23. _, err := l.svcCtx.InnerRpc.CsConnectPlayer(l.ctx, &inner.InnerCsConnectPlayerReq{
  24. CsId: in.CsId,
  25. GameId: in.GameId,
  26. PlayerId: in.PlayerId,
  27. })
  28. if err != nil {
  29. return nil, err
  30. }
  31. return &pb.CsConnectPlayerResp{}, nil
  32. }