From 078b797c94c609ac001acb2d1106b0e57fb3f31c Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Tue, 19 Sep 2023 15:59:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=90=88=E5=9B=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/userlogotemplatetagsetlogic.go | 4 +- .../internal/logic/logocombinelogic.go | 1 - server/resource/internal/types/types.go | 25 ++++++------ server_api/resource.api | 17 ++++---- service/repositories/image_handle.go | 39 +++++++------------ 5 files changed, 39 insertions(+), 47 deletions(-) diff --git a/server/home-user-auth/internal/logic/userlogotemplatetagsetlogic.go b/server/home-user-auth/internal/logic/userlogotemplatetagsetlogic.go index 59c7e3ca..e9288415 100644 --- a/server/home-user-auth/internal/logic/userlogotemplatetagsetlogic.go +++ b/server/home-user-auth/internal/logic/userlogotemplatetagsetlogic.go @@ -45,10 +45,10 @@ func (l *UserLogoTemplateTagSetLogic) UserLogoTemplateTagSet(req *types.UserLogo return resp.SetStatus(basic.CodeUnAuth) } if req.LogoSelectedId == 0 { - return resp.SetStatus(basic.CodeLogoSetTemplateErr, "logo logo_selected_id not null") + return resp.SetStatus(basic.CodeApiErr, "logo logo_selected_id not null") } if req.TemplateTag == "" { - return resp.SetStatus(basic.CodeLogoSetTemplateErr, "logo template tag not null") + return resp.SetStatus(basic.CodeApiErr, "logo template tag not null") } var userId int64 var guestId int64 diff --git a/server/resource/internal/logic/logocombinelogic.go b/server/resource/internal/logic/logocombinelogic.go index dcfd7e63..69c517e9 100644 --- a/server/resource/internal/logic/logocombinelogic.go +++ b/server/resource/internal/logic/logocombinelogic.go @@ -95,7 +95,6 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{ UserId: userId, GuestId: guestId, - TemplateId: req.TemplateId, TemplateTag: req.TemplateTag, Website: req.Website, Slogan: req.Slogan, diff --git a/server/resource/internal/types/types.go b/server/resource/internal/types/types.go index ce02c1b4..58c4950c 100644 --- a/server/resource/internal/types/types.go +++ b/server/resource/internal/types/types.go @@ -28,13 +28,16 @@ type ResourceInfoReq struct { } type LogoCombineReq struct { - 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"` // 合图参数 - Qrcode string `form:"qrcode,optional"` // 合图参数 + LogoUrl string `json:"logo_url"` // 合图参数 + TemplateId int64 `json:"template_id"` // 合图参数 + TemplateTag string `json:"template_tag"` // 合图参数 + Color [][]string `json:"color"` // 颜色组合 + SelectedIndex int `json:"selected_index"` // 主色的下标索引 + Website string `json:"website,optional"` // 合图参数 + Slogan string `json:"slogan,optional"` // 合图参数 + Address string `json:"address,optional"` // 合图参数 + Phone string `json:"phone,optional"` // 合图参数 + Qrcode string `json:"qrcode,optional"` // 合图参数 } type Request struct { @@ -60,10 +63,10 @@ type File struct { } type Meta struct { - TotalCount int64 `json:"totalCount"` - PageCount int64 `json:"pageCount"` - CurrentPage int `json:"currentPage"` - PerPage int `json:"perPage"` + TotalCount int64 `json:"total_count"` + PageCount int64 `json:"page_count"` + CurrentPage int `json:"current_page"` + PerPage int `json:"per_page"` } // Set 设置Response的Code和Message值 diff --git a/server_api/resource.api b/server_api/resource.api index 51404295..1510e8c3 100644 --- a/server_api/resource.api +++ b/server_api/resource.api @@ -55,12 +55,15 @@ type ( type ( LogoCombineReq { - 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"` // 合图参数 - Qrcode string `form:"qrcode,optional"` // 合图参数 + LogoUrl string `json:"logo_url"` // 合图参数 + TemplateId int64 `json:"template_id"` // 合图参数 + TemplateTag string `json:"template_tag"` // 合图参数 + Color [][]string `json:"color"` // 颜色组合 + SelectedIndex int `json:"selected_index"` // 主色的下标索引 + Website string `json:"website,optional"` // 合图参数 + Slogan string `json:"slogan,optional"` // 合图参数 + Address string `json:"address,optional"` // 合图参数 + Phone string `json:"phone,optional"` // 合图参数 + Qrcode string `json:"qrcode,optional"` // 合图参数 } ) \ No newline at end of file diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index 6fc53b36..052d7ca4 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -195,17 +195,18 @@ func (l *defaultImageHandle) LogoInfoSet(ctx context.Context, in *LogoInfoSetReq /* logo合图 */ type ( LogoCombineReq struct { - UserId int64 `json:"user_id"` - GuestId int64 `json:"guest_id"` - ProductTemplateV2Info *gmodel.FsProductTemplateV2 `json:"product_template_v2_info"` - TemplateTag string `json:"template_tag"` - Website string `json:"website"` // 合图参数 - Slogan string `json:"slogan"` // 合图参数 - Address string `json:"address"` // 合图参数 - Phone string `json:"phone"` // 合图参数 - Qrcode string `json:"qrcode"` // 合图参数 - LogoUrl string `json:"logo_url"` // 合图参数 - TemplateTagColor TemplateTagColor `json:"template_tag_color"` //合图颜色 + UserId int64 `json:"user_id"` + GuestId int64 `json:"guest_id"` + ProductTemplateV2Info *gmodel.FsProductTemplateV2 `json:"product_template_v2_info"` + ProductTemplateTagGroups interface{} `json:"product_template_tag_groups"` + TemplateTag string `json:"template_tag"` + Website string `json:"website"` // 合图参数 + Slogan string `json:"slogan"` // 合图参数 + Address string `json:"address"` // 合图参数 + Phone string `json:"phone"` // 合图参数 + Qrcode string `json:"qrcode"` // 合图参数 + LogoUrl string `json:"logo_url"` // 合图参数 + TemplateTagColor TemplateTagColor `json:"template_tag_color"` //合图颜色 } LogoCombineRes struct { ResourceId string @@ -257,13 +258,6 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq } } - productTemplateTagInfo, err := gmodel.NewFsProductTemplateTagsModel(l.MysqlConn).FindOneByTagName(ctx, in.TemplateTag, "groups") - - if err != nil { - logc.Errorf(ctx, "NewFsProductTemplateTagsModel.FindOneByTagName:%v", err) - return nil, err - } - var groupOptions map[string]interface{} var materialList []interface{} if in.ProductTemplateV2Info.TemplateInfo != nil { @@ -297,13 +291,6 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq moduleDataMap["groupOptions"] = groupOptions moduleDataMap["materialList"] = materialList - var tagDataMap []interface{} - err = json.Unmarshal([]byte(*productTemplateTagInfo.Groups), &tagDataMap) - if err != nil { - logc.Errorf(ctx, "Unmarshal tagDataMap:%v", err) - return nil, err - } - var combineParam map[string]interface{} json.Unmarshal([]byte(*resLogoInfo.Metadata), &combineParam) combineParam["template_tagid"] = in.TemplateTag @@ -319,7 +306,7 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq } var postMap = make(map[string]interface{}, 2) postMap["module_data"] = moduleDataMap - postMap["tag_data"] = tagDataMap + postMap["tag_data"] = in.ProductTemplateTagGroups postMap["param_data"] = combineParam logc.Infof(ctx, "合图--算法请求--合图--开始时间:%v", time.Now().UTC())