getpostcommentlistlogic.go 982 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. "context"
  4. "slow_wild_api/apps/internal/svc"
  5. "slow_wild_api/apps/internal/types"
  6. "git.banshen.xyz/huangguangrong/slow_wild_protobuff/slowwild/slowwildserver"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type GetPostCommentListLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. // 获取评论列表
  15. func NewGetPostCommentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPostCommentListLogic {
  16. return &GetPostCommentListLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetPostCommentListLogic) GetPostCommentList(req *types.GetPostCommentListReq) (resp *types.BaseReturnData, err error) {
  23. resp = &types.BaseReturnData{}
  24. rpcResp, err := l.svcCtx.SlowWildPb.GetPostCommentList(l.ctx, &slowwildserver.GetPostCommentListReq{
  25. PostId: req.PostId,
  26. Page: req.Page,
  27. PageSize: req.PageSize,
  28. })
  29. if err != nil {
  30. return nil, err
  31. }
  32. resp.Data = rpcResp
  33. return
  34. }