From 0d598e624b757d631012743b84a819a0bdc4e159 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 23 Nov 2023 17:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rule/appreciation.go | 4 ++++ 1 file changed, 4 insertions(+) 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()