Files
sundynix-micro-be/app/plant/api/internal/logic/post/getmypostlistlogic.go
T
2026-05-23 13:55:05 +08:00

28 lines
823 B
Go

package post
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"sundynix-micro-go/app/plant/api/internal/svc"
"sundynix-micro-go/app/plant/api/internal/types"
plantPb "sundynix-micro-go/app/plant/rpc/plant"
)
type GetMyPostListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetMyPostListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetMyPostListLogic {
return &GetMyPostListLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *GetMyPostListLogic) GetMyPostList(req *types.PostListReq) (*plantPb.PostListResp, error) {
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
return l.svcCtx.PlantRpc.GetPostList(l.ctx, &plantPb.PostListReq{
UserId: userId, Current: int32(req.Current), PageSize: int32(req.PageSize),
})
}