feat: 迁移plant
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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 StarPostLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewStarPostLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StarPostLogic {
|
||||
return &StarPostLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||||
}
|
||||
|
||||
func (l *StarPostLogic) StarPost(req *types.IdReq) error {
|
||||
userId := fmt.Sprintf("%v", l.ctx.Value("userId"))
|
||||
_, err := l.svcCtx.PlantRpc.StarPost(l.ctx, &plantPb.LikePostReq{UserId: userId, PostId: req.Id})
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user