From 5198ee0cdae746a70343184f9806004371b1a19e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 21 Sep 2023 11:35:00 +0800 Subject: [PATCH] fix --- service/repositories/image_handle.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index 052d7ca4..acf1f0c2 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -9,6 +9,7 @@ import ( "fusenapi/utils/curl" "fusenapi/utils/file" "fusenapi/utils/hash" + "strings" "time" "github.com/aws/aws-sdk-go/aws/session" @@ -222,21 +223,22 @@ type TemplateTagColor struct { } func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) { - // 查询logo最新基础信息 - resLogoInfo, err := l.LogoInfo(ctx, &LogoInfoReq{ - UserId: in.UserId, - GuestId: in.GuestId, - }) + s := strings.Split(in.LogoUrl, "/") + if len(s) <= 1 { + return nil, errors.New("无效的logo") + } + logoResourceId := s[len(s)-1] + userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn) + resLogoInfo, err := userMaterialModel.FindOneByLogoResourceId(ctx, logoResourceId) if err != nil { logx.Error(err) return nil, err } - // 根据hash 查询数据资源 var hashKeyData = *in hashKeyData.GuestId = 0 hashKeyData.UserId = 0 - hashKeyData.LogoUrl = *resLogoInfo.LogoUrl + hashKeyData.LogoUrl = in.LogoUrl var hashKeyDataMap map[string]interface{} hashKeyDataB, _ := json.Marshal(hashKeyData) json.Unmarshal(hashKeyDataB, &hashKeyDataMap)