From c1de53c098f8e742959d8c5a0cc24d28bb2180f8 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 5 Jul 2023 18:08:18 +0800 Subject: [PATCH] fix --- .../internal/logic/gettemplatevdetaillogic.go | 2 +- utils/format/str_to_int_slice.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/product-template/internal/logic/gettemplatevdetaillogic.go b/server/product-template/internal/logic/gettemplatevdetaillogic.go index 892ab9a5..dcce87fb 100644 --- a/server/product-template/internal/logic/gettemplatevdetaillogic.go +++ b/server/product-template/internal/logic/gettemplatevdetaillogic.go @@ -161,7 +161,7 @@ func (l *GetTemplatevDetailLogic) GetTemplatevDetail(req *types.GetTemplatevDeta optionModelInfoList := make([]interface{}, 0, len(model3dList)) for _, v := range model3dList { info := make(map[string]interface{}) - if v.ModelInfo != nil { + if v.ModelInfo != nil && *v.ModelInfo != "" { if err = json.Unmarshal([]byte(*v.ModelInfo), &info); err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to parse model info") diff --git a/utils/format/str_to_int_slice.go b/utils/format/str_to_int_slice.go index 8ddfc4b5..eadf497a 100644 --- a/utils/format/str_to_int_slice.go +++ b/utils/format/str_to_int_slice.go @@ -7,11 +7,11 @@ import ( // 字符串切片转int切片 func StrSlicToIntSlice(input []string) ([]int, error) { newSlic := make([]int, 0, len(input)) - for _, p := range input { - if p == "" { + for _, element := range input { + if element == "" { continue } - val, err := strconv.Atoi(p) + val, err := strconv.Atoi(element) if err != nil { return nil, err } @@ -23,11 +23,11 @@ func StrSlicToIntSlice(input []string) ([]int, error) { // 字符串切片转int64切片 func StrSlicToInt64Slice(input []string) ([]int64, error) { newSlic := make([]int64, 0, len(input)) - for _, p := range input { - if p == "" { + for _, element := range input { + if element == "" { continue } - val, err := strconv.ParseInt(p, 10, 64) + val, err := strconv.ParseInt(element, 10, 64) if err != nil { return nil, err }