36 lines
937 B
Go
36 lines
937 B
Go
package storelink
|
|
|
|
import (
|
|
"context"
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/storeLink"
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
|
|
"gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type UploadLinkImageLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewUploadLinkImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadLinkImageLogic {
|
|
return &UploadLinkImageLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *UploadLinkImageLogic) UploadLinkImage(req *types.UploadLinkImageReq) (resp *types.UploadLinkImageResp, err error) {
|
|
storelink := storeLink.NewStoreLink(l.ctx, l.svcCtx, req.PartId)
|
|
img, err := storelink.ILinkage.UploadImage(req.FilePath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
imgResp := img.(types.UploadLinkImageResp)
|
|
return &imgResp, nil
|
|
}
|