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
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")
}