playerdisconnectlogic.go 720 B

123456789101112131415161718192021222324252627282930
  1. package logic
  2. import (
  3. "context"
  4. "ylink/core/inner/rpc/internal/ext"
  5. "ylink/core/inner/rpc/internal/svc"
  6. "ylink/core/inner/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.InnerPlayerDisconnectReq) (*pb.InnerPlayerDisconnectResp, error) {
  22. ext.RemoveConnectedPlayerInfo(in.GameId, in.PlayerId)
  23. return &pb.InnerPlayerDisconnectResp{}, nil
  24. }