// Code scaffolded by goctl. Safe to edit. // goctl 1.10.1 package post import ( "context" "fmt" "sundynix-micro-go/app/plant/api/internal/svc" "sundynix-micro-go/app/plant/api/internal/types" "sundynix-micro-go/app/plant/rpc/plant" "github.com/zeromicro/go-zero/core/logx" ) type CommentPostLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } // 评论帖子 func NewCommentPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CommentPostLogic { return &CommentPostLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *CommentPostLogic) CommentPost(req *types.PostCommentReq) error { userId := fmt.Sprintf("%v", l.ctx.Value("userId")) _, err := l.svcCtx.PlantRpc.CommentPost(l.ctx, &plant.CommentPostReq{ PostId: req.PostId, UserId: userId, Content: req.Content, ParentId: req.ParentId, }) return err }