You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
654 B
28 lines
654 B
package setting
|
|
|
|
import (
|
|
"base/app/model"
|
|
"errors"
|
|
"git.oa00.com/go/mysql"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
var ParameterLogic = ¶meterLogic{}
|
|
|
|
type parameterLogic struct {
|
|
}
|
|
|
|
// Edit @Title 编辑
|
|
func (p *parameterLogic) Edit(rate decimal.Decimal) error {
|
|
if rate.LessThanOrEqual(decimal.NewFromFloat(0.00)) || rate.GreaterThanOrEqual(decimal.NewFromFloat(1.00)) {
|
|
return errors.New("系数不合法")
|
|
}
|
|
system := SystemLogic.GetSystem()
|
|
if mysql.Db.Model(&model.SettingSystem{}).Where(system).UpdateColumns(map[string]interface{}{
|
|
"car_price_rate": rate,
|
|
}).RowsAffected != 1 {
|
|
return errors.New("编辑失败")
|
|
}
|
|
return nil
|
|
}
|