This commit is contained in:
laodaming 2023-07-05 18:08:18 +08:00
parent 83bfa8977c
commit c1de53c098
2 changed files with 7 additions and 7 deletions

View File

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

View File

@ -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
}