Merge branch 'sxy' into dev

This commit is contained in:
孙肖扬 2025-06-20 15:27:01 +08:00
commit 9d57cb0188
2 changed files with 10 additions and 7 deletions

View File

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

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