csfetchplayerqueuelogic.go 890 B

12345678910111213141516171819202122232425262728293031323334353637
  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 CsFetchPlayerQueueLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewCsFetchPlayerQueueLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsFetchPlayerQueueLogic {
  15. return &CsFetchPlayerQueueLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. func (l *CsFetchPlayerQueueLogic) CsFetchPlayerQueue(in *pb.CsFetchPlayerQueueReq) (*pb.CsFetchPlayerQueueResp, error) {
  22. // 调用inner服务查询等待用户的队列
  23. innerResp, err := l.svcCtx.InnerRpc.CsFetchPlayerQueue(l.ctx, &inner.InnerCsFetchPlayerQueueReq{
  24. Limit: in.Limit,
  25. })
  26. if err != nil {
  27. return nil, err
  28. }
  29. return &pb.CsFetchPlayerQueueResp{
  30. List: innerResp.List,
  31. }, nil
  32. }