Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop

This commit is contained in:
Hiven 2023-08-15 11:59:43 +08:00
commit 3ce253b1e5

View File

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