diff --git a/rule/appreciation.go b/rule/appreciation.go index 9476b4d..57344f6 100644 --- a/rule/appreciation.go +++ b/rule/appreciation.go @@ -3,6 +3,7 @@ package rule import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" + zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/cache" "errors" "github.com/shopspring/decimal" @@ -31,6 +32,9 @@ func CalcAppreciationValue(session *xorm.Session) (err error, value float64) { if !has { return errors.New("未查询到`增值积分资产总值`记录"), value } + if zhios_order_relate_utils.StrToFloat64(appreciationBase.Sum) == 0 { //默认是1 + return nil, 1 + } sum, _ := decimal.NewFromString(appreciationBase.Sum) //总资产 flowSum, _ := decimal.NewFromString(appreciationBase.FlowSum) //流通资产 value, _ = sum.Div(flowSum).Float64()