getuserpostcollectionlistlogic.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 GetUserPostCollectionListLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. // 获取用户收藏的帖子列表
  15. func NewGetUserPostCollectionListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserPostCollectionListLogic {
  16. return &GetUserPostCollectionListLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *GetUserPostCollectionListLogic) GetUserPostCollectionList(req *types.GetUserPostCollectionListReq) (resp *types.BaseReturnData, err error) {
  23. resp = &types.BaseReturnData{}
  24. rpcResp, err := l.svcCtx.SlowWildPb.GetUserPostCollectionList(l.ctx, &slowwildserver.GetUserPostCollectionListReq{
  25. QueryUserId: req.QueryUserId,
  26. Page: req.Page,
  27. PageSize: req.PageSize,
  28. })
  29. if err != nil {
  30. return nil, err
  31. }
  32. resp.Data = map[string]interface{}{
  33. "list": rpcResp.GetList(),
  34. "total": rpcResp.GetTotal(),
  35. }
  36. return
  37. }