Browse Source

更新

master
huangjiajun 11 months ago
parent
commit
ac77576b97
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      rule/appreciation.go

+ 18
- 0
rule/appreciation.go View File

@@ -17,6 +17,24 @@ func InitForAppreciation(redisAddr string) (err error) {
_, err = cache.SelectDb(md.RedisDataBase) _, err = cache.SelectDb(md.RedisDataBase)
return return
} }
func CalcAppreciationValueEg(eg *xorm.Engine) (err error, value float64) {
var appreciationBase model.AppreciationBase
//1、查询增值积分资产总值
has, err := eg.Table("appreciation_base").Where("is_use =1").Get(&appreciationBase)
if err != nil {
return err, value
}
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).RoundFloor(4).Float64()
return
}


/* /*
计算增值积分当前价值 计算增值积分当前价值


Loading…
Cancel
Save