package logic import ( "app.yhyue.com/moapp/jy_docs/rpc/userlib/internal/svc" "app.yhyue.com/moapp/jy_docs/rpc/userlib/userlib" "app.yhyue.com/moapp/jy_docs/services/model" userLibService "app.yhyue.com/moapp/jy_docs/services/userlib" "context" "log" "github.com/tal-tech/go-zero/core/logx" ) type DocDownloadLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewDocDownloadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DocDownloadLogic { return &DocDownloadLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } //转存操作 func (l *DocDownloadLogic) DocDownload(in *userlib.UserCollectRequest) (*userlib.UserCollectResponse, error) { b, msg := userLibService.UserDocDownload( &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) if b { return &userlib.UserCollectResponse{ Code: int32(1), Message: msg, }, nil } else { return &userlib.UserCollectResponse{ Code: int32(0), Message: msg, }, nil } }