Compare commits

..

No commits in common. "9d57cb0188173992fb7bd1943c98d157ea274456" and "c5459886630f1496c6539cf65ca48ae8cecd724a" have entirely different histories.

2 changed files with 7 additions and 10 deletions

View File

@ -150,16 +150,13 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
return res, errors.New("语言不能为空") return res, errors.New("语言不能为空")
} }
var options model.PriceOptions var options model.PriceOptions
var originalPrice float64 if in.PriceMode == 1 && in.OriginalPrice == "" {
if in.PriceMode == 1 {
if in.OriginalPrice == "" {
return res, errors.New("原价不能为空") return res, errors.New("原价不能为空")
} }
originalPrice, err = strconv.ParseFloat(in.OriginalPrice, 32) originalPrice, parseErr := strconv.ParseFloat(in.OriginalPrice, 32)
if err != nil { if parseErr != nil {
return res, errors.New("原价格式转换失败") return res, errors.New("原价格式转换失败")
} }
}
index := 1 index := 1
for _, option := range in.Options { for _, option := range in.Options {
price, parseErr1 := strconv.ParseFloat(option.Price, 32) price, parseErr1 := strconv.ParseFloat(option.Price, 32)

View File

@ -130,7 +130,7 @@ func ValidateOptions(options PriceOptions) (bool, error) {
} }
for _, n := range nums { for _, n := range nums {
if _, exist := cover[n]; exist { if _, exist := cover[n]; exist {
return false, errors.New("条件存在冲突,请重新设置") return false, errors.New("条件冲突")
} }
cover[n] = struct{}{} cover[n] = struct{}{}