123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package logic
- import (
- "app.yhyue.com/moapp/jy_docs/services/model"
- "context"
- "log"
- "app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc"
- "app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib"
- userLibService "app.yhyue.com/moapp/jy_docs/services/userlib"
- "github.com/tal-tech/go-zero/core/logx"
- )
- type DocCollectLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewDocCollectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocCollectLogic {
- return &DocCollectLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *DocCollectLogic) DocCollect(in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) {
- // todo: add your logic here and delete this line
- b := userLibService.UserDocCollect(
- &model.UserDoc{
- UserId: in.UserId,
- DocId: in.DocId,
- AppId: in.AppId,
- }, int(in.Cost))
- log.Printf("用户文档收藏,userId:[%s],docId:[%s] 是否成功:[%v]", in.UserId, in.DocId, b)
- return &userlib.UserCollectResponse{
- Code: 200,
- Message: "success",
- }, nil
- }
|