作者 庄敏学

导入精度

@@ -16,6 +16,7 @@ import ( @@ -16,6 +16,7 @@ import (
16 "golang.org/x/text/transform" 16 "golang.org/x/text/transform"
17 "io" 17 "io"
18 "io/ioutil" 18 "io/ioutil"
  19 + "math"
19 "mime/multipart" 20 "mime/multipart"
20 "os" 21 "os"
21 "path" 22 "path"
@@ -168,7 +169,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf @@ -168,7 +169,7 @@ func (controller *ImportController) parseTemplateNodeContent(data []*domain.Perf
168 nodeContents = append(nodeContents, nc) 169 nodeContents = append(nodeContents, nc)
169 } 170 }
170 } 171 }
171 - 172 + weightTotal = math.Round(weightTotal*100) / 100
172 // 权重总数不等于100%,提示报错 173 // 权重总数不等于100%,提示报错
173 if weightTotal != 100 { 174 if weightTotal != 100 {
174 sprintf := fmt.Sprintf("当前导入的总权重值为:%s%%(必须等于100%%)", utils.FormatFloatDecimal(weightTotal, 2)) 175 sprintf := fmt.Sprintf("当前导入的总权重值为:%s%%(必须等于100%%)", utils.FormatFloatDecimal(weightTotal, 2))