This commit is contained in:
laodaming 2023-10-08 10:22:00 +08:00
parent 3f78cfd824
commit 414a3f8507
2 changed files with 9 additions and 12 deletions

View File

@ -1,15 +1,14 @@
package logic
import (
"context"
"encoding/json"
"errors"
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/s3url_to_s3id"
"gorm.io/gorm"
"strings"
"context"
"fusenapi/server/product-template-tag/internal/svc"
"fusenapi/server/product-template-tag/internal/types"
@ -40,11 +39,10 @@ func (l *GetTemplateTagColorLogic) GetTemplateTagColor(req *types.GetTemplateTag
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "param selected_color_index is invalid")
}
//根据logo查询素材资源
s := strings.Split(req.Logo, "/")
if len(s) <= 1 {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid logo")
resourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(req.Logo)
if resourceId == "" {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "param logo is invalid")
}
resourceId := s[len(s)-1]
var (
userMaterial *gmodel.FsUserMaterial
templateTagInfo *gmodel.FsProductTemplateTags

View File

@ -9,7 +9,7 @@ import (
"fusenapi/utils/curl"
"fusenapi/utils/file"
"fusenapi/utils/hash"
"strings"
"fusenapi/utils/s3url_to_s3id"
"time"
"github.com/aws/aws-sdk-go/aws/session"
@ -225,11 +225,10 @@ type TemplateTagColor struct {
}
func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) {
s := strings.Split(in.LogoUrl, "/")
if len(s) <= 1 {
return nil, errors.New("无效的logo")
logoResourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(in.LogoUrl)
if logoResourceId == "" {
return nil, errors.New("invalid logo url")
}
logoResourceId := s[len(s)-1]
userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn)
resLogoInfo, err := userMaterialModel.FindOneByLogoResourceId(ctx, logoResourceId)
if err != nil {