作者 Administrator

合并分支 'test' 到 'master'

模板导入权重精度



查看合并请求 !15
... ... @@ -5,6 +5,7 @@ import (
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils"
"math"
)
type UpdateTemplateCommand struct {
... ... @@ -34,6 +35,7 @@ func (in *UpdateTemplateCommand) Valid(validation *validation.Validation) {
for i2 := range linkNode.NodeContents {
weightTotal += linkNode.NodeContents[i2].Weight
}
weightTotal = math.Round(weightTotal*100) / 100
if weightTotal != 100 {
formatWeightTotal := utils.FormatFloatDecimal(weightTotal, 2)
validation.SetError("linkNodes", fmt.Sprintf("总权重值错误,当前%s的总权重值为:%s%%(必须等于100%%)", linkNode.Name, formatWeightTotal))
... ...