package share import ( "context" "muyu-apiserver/gateway/internal/svc" "muyu-apiserver/gateway/internal/types" "muyu-apiserver/pkg/ctxdata" "muyu-apiserver/rpc/production/productionservice" "github.com/zeromicro/go-zero/core/logx" ) type GetShareLinkPlanViewLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGetShareLinkPlanViewLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetShareLinkPlanViewLogic { return &GetShareLinkPlanViewLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *GetShareLinkPlanViewLogic) GetShareLinkPlanView() (*types.ShareLinkPlanViewResp, error) { shortCode := ctxdata.GetPathId(l.ctx) resp, err := l.svcCtx.ProductionRpc.GetShareLinkPlanView(l.ctx, &productionservice.GetShareLinkReq{ ShortCode: shortCode, }) if err != nil { return nil, err } result := &types.ShareLinkPlanViewResp{} if resp.Plan != nil { plan := productionPlanInfoFromPB(resp.Plan) result.Plan = plan } if resp.Link != nil { result.Link = shareLinkInfoFromPB(resp.Link) } return result, nil }