playerdisconnectlogic.go 805 B

1234567891011121314151617181920212223242526272829303132
  1. package logic
  2. import (
  3. "context"
  4. "ylink/core/inner/rpc/inner"
  5. "ylink/core/cmd/rpc/internal/svc"
  6. "ylink/core/cmd/rpc/pb"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type PlayerDisconnectLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewPlayerDisconnectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PlayerDisconnectLogic {
  15. return &PlayerDisconnectLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. func (l *PlayerDisconnectLogic) PlayerDisconnect(in *pb.PlayerDisconnectReq) (*pb.PlayerDisconnectResp, error) {
  22. if _, err := l.svcCtx.InnerRpc.PlayerDisconnect(l.ctx, &inner.InnerPlayerDisconnectReq{GameId: in.GameId, PlayerId: in.PlayerId}); err != nil {
  23. return nil, err
  24. }
  25. return &pb.PlayerDisconnectResp{}, nil
  26. }