From d1c6f5cdc5a1b41605b57a9d2bf6e2520bba2179 Mon Sep 17 00:00:00 2001 From: Hiven Date: Tue, 15 Aug 2023 10:58:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=87=8D=E6=9E=84=E5=90=88=E5=9B=BE?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/resource/etc/resource.yaml | 3 +- .../internal/logic/logocombinelogic.go | 13 +++++--- server/resource/internal/types/types.go | 9 +++-- server_api/resource.api | 9 +++-- service/repositories/image_handle.go | 33 +++++++++++++++---- 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/server/resource/etc/resource.yaml b/server/resource/etc/resource.yaml index 473ac3f3..a279336e 100644 --- a/server/resource/etc/resource.yaml +++ b/server/resource/etc/resource.yaml @@ -15,7 +15,8 @@ AWS: Secret: sjCEv0JxATnPCxno2KNLm0X8oDc7srUR+4vkYhvm Token: BLMService: - Url: "http://18.119.109.254:8999" + # Url: "http://18.119.109.254:8999" + Url: "http://192.168.1.7:8999" LogoCombine: #Url: "http://192.168.1.7:8999/LogoCombine" Url: "http://18.119.109.254:8999/LogoCombine" \ No newline at end of file diff --git a/server/resource/internal/logic/logocombinelogic.go b/server/resource/internal/logic/logocombinelogic.go index bad59cb9..72468f8e 100644 --- a/server/resource/internal/logic/logocombinelogic.go +++ b/server/resource/internal/logic/logocombinelogic.go @@ -57,11 +57,14 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth userId = userinfo.UserId } res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{ - ResourceKey: req.ResourceKey, - TemplateId: req.TemplateId, - CombineParam: req.CombineParam, - UserId: userId, - GuestId: guestId, + UserId: userId, + GuestId: guestId, + TemplateId: req.TemplateId, + TemplateTag: req.TemplateTag, + Website: req.Website, + Slogan: req.Slogan, + Phone: req.Phone, + Address: req.Address, }) if err != nil { diff --git a/server/resource/internal/types/types.go b/server/resource/internal/types/types.go index 47e38155..f397f7b7 100644 --- a/server/resource/internal/types/types.go +++ b/server/resource/internal/types/types.go @@ -11,9 +11,12 @@ type ResourceInfoReq struct { } type LogoCombineReq struct { - ResourceKey string `form:"resource_key"` // 资源唯一标识 - CombineParam string `form:"combine_param"` // 合图参数 - TemplateId int64 `form:"template_id"` // 合图参数 + TemplateId int64 `form:"template_id"` // 合图参数 + TemplateTag string `form:"template_tag"` // 合图参数 + Website string `form:"website,optional"` // 合图参数 + Slogan string `form:"slogan,optional"` // 合图参数 + Address string `form:"address,optional"` // 合图参数 + Phone string `form:"phone,optional"` // 合图参数 } type Request struct { diff --git a/server_api/resource.api b/server_api/resource.api index 0a37f93f..33cf915b 100644 --- a/server_api/resource.api +++ b/server_api/resource.api @@ -26,8 +26,11 @@ type ( type ( LogoCombineReq { - ResourceKey string `form:"resource_key"` // 资源唯一标识 - CombineParam string `form:"combine_param"` // 合图参数 - TemplateId int64 `form:"template_id"` // 合图参数 + TemplateId int64 `form:"template_id"` // 合图参数 + TemplateTag string `form:"template_tag"` // 合图参数 + Website string `form:"website,optional"` // 合图参数 + Slogan string `form:"slogan,optional"` // 合图参数 + Address string `form:"address,optional"` // 合图参数 + Phone string `form:"phone,optional"` // 合图参数 } ) \ No newline at end of file diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index 5e873b3f..574683ac 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -43,11 +43,14 @@ type ( /* logo合图 */ type ( LogoCombineReq struct { - ResourceKey string `json:"resource_key"` - TemplateId int64 `json:"template_id"` - CombineParam string `json:"combine_param"` - UserId int64 `json:"user_id"` - GuestId int64 `json:"guest_id"` + UserId int64 `json:"user_id"` + GuestId int64 `json:"guest_id"` + TemplateId int64 `json:"template_id"` + TemplateTag string `json:"resource_key"` + Website string `form:"website,optional"` // 合图参数 + Slogan string `form:"slogan,optional"` // 合图参数 + Address string `form:"address,optional"` // 合图参数 + Phone string `form:"phone,optional"` // 合图参数 } LogoCombineRes struct { ResourceId string @@ -58,7 +61,8 @@ type ( func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) { // 根据hash 查询数据资源 - var resourceId string = hash.JsonHashKey(in.ResourceKey) + var resourceId string = hash.JsonHashKey(in) + resourceModel := gmodel.NewFsResourceModel(l.MysqlConn) resourceInfo, err := resourceModel.FindOneById(ctx, resourceId) if err == nil && resourceInfo.ResourceId != "" { @@ -111,8 +115,23 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq moduleDataMap["groupOptions"] = groupOptions moduleDataMap["materialList"] = materialList + // 查询logo最新基础信息 + userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn) + userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId) + + if err != nil { + logx.Error(err) + return nil, err + } + var combineParam map[string]interface{} - json.Unmarshal([]byte(in.CombineParam), &combineParam) + json.Unmarshal([]byte(*userMaterialInfo.Metadata), &combineParam) + combineParam["template_tagid"] = in.TemplateTag + combineParam["website"] = in.Website + combineParam["slogan"] = in.Slogan + combineParam["phone"] = in.Phone + combineParam["address"] = in.Address + var postMap = make(map[string]interface{}, 2) postMap["module_data"] = moduleDataMap postMap["param_data"] = combineParam