修改增值服务保存逻辑

This commit is contained in:
孙肖扬 2025-06-20 15:26:35 +08:00
parent bff2938313
commit 952caaaf91
2 changed files with 10 additions and 7 deletions

View File

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

View File

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