diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index f683df49..d751b8af 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -117,16 +117,28 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq moduleDataMap["materialList"] = materialList // 查询logo最新基础信息 + var metadata *string userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn) userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId) if err != nil { - logx.Error(err) - return nil, err + if errors.Is(err, gorm.ErrRecordNotFound) { + userMaterialInfoDefault, err := userMaterialModel.FindOneById(ctx, 0) + if err != nil { + logx.Error(err) + return nil, err + } + metadata = userMaterialInfoDefault.Metadata + } else { + logx.Error(err) + return nil, err + } + } else { + metadata = userMaterialInfo.Metadata } var combineParam map[string]interface{} - json.Unmarshal([]byte(*userMaterialInfo.Metadata), &combineParam) + json.Unmarshal([]byte(*metadata), &combineParam) combineParam["template_tagid"] = in.TemplateTag combineParam["website"] = in.Website combineParam["slogan"] = in.Slogan