diff --git a/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go b/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go index de9d34da..3653614b 100644 --- a/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go +++ b/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go @@ -1,6 +1,7 @@ package logic import ( + "context" "encoding/json" "errors" "fusenapi/model/gmodel" @@ -8,8 +9,6 @@ import ( "fusenapi/utils/basic" "gorm.io/gorm" - "context" - "fusenapi/server/product-template-tag/internal/svc" "fusenapi/server/product-template-tag/internal/types" @@ -67,9 +66,11 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu logx.Error(err) return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user metadata") } - templateTagNameList, ok := metaData["template_tagid"].([]string) - if !ok { - return resp.SetStatusWithMessage(basic.CodeJsonErr, "invalid format of metadata`template_tagid") + var templateTagNameList []string + b, _ := json.Marshal(metaData["template_tagid"]) + if err = json.Unmarshal(b, &templateTagNameList); err != nil { + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeJsonErr, "invalid format of metadata`s template_tagid") } productTemplateTags, err = l.svcCtx.AllModels.FsProductTemplateTags.GetListByTitles(l.ctx, templateTagNameList, req.Limit, "id DESC") }