This commit is contained in:
laodaming
2023-09-20 16:46:30 +08:00
parent 5042971472
commit be80525878
5 changed files with 44 additions and 2 deletions

View File

@@ -17,6 +17,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/product-template-tag/get_product_template_tags",
Handler: GetProductTemplateTagsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/product-template-tag/get_template_tag_color",
Handler: GetTemplateTagColorHandler(serverCtx),
},
},
)
}

View File

@@ -36,7 +36,7 @@ func NewGetProductTemplateTagsLogic(ctx context.Context, svcCtx *svc.ServiceCont
// func (l *GetProductTemplateTagsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }
type logoSelect struct {
type LogoSelect struct {
LogoSelected struct {
LogoSelectedId int `json:"logo_selected_id"`
TemplateTagSelected struct {
@@ -83,7 +83,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
mapSelectColor := make(map[string]int) //key是模板标签val是选中的索引
if logoInfo.UserInfoMetadata != nil && *logoInfo.UserInfoMetadata != "" {
//解析用户信息元数据
var logoSelectInfo logoSelect
var logoSelectInfo LogoSelect
if err = json.Unmarshal([]byte(*logoInfo.UserInfoMetadata), &logoSelectInfo); err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user info metadata")

View File

@@ -20,6 +20,17 @@ type GetProductTemplateTagsRsp struct {
SelectedColorIndex int `json:"selected_color_index"`
}
type GetTemplateTagColorReq struct {
Logo string `json:"logo"`
TemplateTag string `json:"template_tag"`
SelectedColorIndex int `json:"selected_color_index"`
}
type GetTemplateTagColorRsp struct {
Colors [][]string `json:"colors"`
SelectedColorIndex int `json:"selected_color_index"`
}
type Request struct {
}