This commit is contained in:
laodaming
2023-10-25 12:30:37 +08:00
parent 56f4460995
commit 12c9732fa8
2 changed files with 47 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import (
"fusenapi/utils/s3url_to_s3id"
"fusenapi/utils/template_switch_info"
"gorm.io/gorm"
"reflect"
"strings"
"context"
@@ -343,6 +344,22 @@ func (l *GetProductDetailLogic) GetTemplateTagColor(req *types.GetProductDetailR
if req.SelectedColorIndex < 0 {
return types.TemplateTagColorInfo{}, errors.New("param selected_color_index is invalid")
}
if req.Logo == "" {
//颜色选择置0
req.SelectedColorIndex = 0
//获取默认profile从中获取logo
profile, err := l.svcCtx.AllModels.FsUserInfo.GetProfileByUserIdGuestId(l.ctx, "logo_selected.logo_url", 0, 0)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return types.TemplateTagColorInfo{}, errors.New("the default profile info is not exists")
}
logx.Error(err)
return types.TemplateTagColorInfo{}, errors.New("failed to get default profile info for without logo")
}
if profile["logo_url"] != nil && reflect.TypeOf(profile["logo_url"]).String() == "string" {
req.Logo = profile["logo_url"].(string)
}
}
//根据logo查询素材资源
resourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(req.Logo)
if resourceId == "" {