Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

master
huangjiajun 6 kuukautta sitten
vanhempi
commit
6ceeadc047
2 muutettua tiedostoa jossa 12 lisäystä ja 8 poistoa
  1. +12
    -2
      rule/one_circles/one_circles_available_green_energy_settlement.go
  2. +0
    -6
      rule/one_circles/one_circles_sign_in_green_energy_settlement.go

+ 12
- 2
rule/one_circles/one_circles_available_green_energy_settlement.go Näytä tiedosto

@@ -115,8 +115,18 @@ func CalcPriceReductionFormula(engine *xorm.Engine, userExchangeNumsValue string
userExchangeNums, _ := decimal.NewFromString(userExchangeNumsValue) //用户兑换绿色能量
originalQuantityNums, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalQuantityNums) //原始数量
nowPrice, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.NowPrice) //当前价格
originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
afterPrice := originalQuantityFunds.Div(userExchangeNums.Add(originalQuantityNums)) //降价后的价格
var priceSettingStruct *md2.PriceSettingStruct
err = json.Unmarshal([]byte(oneCirclesGreenEnergyBasicSetting.PriceSetting), &priceSettingStruct)
if err != nil {
return
}
priceHigherThanValue, _ := decimal.NewFromString(priceSettingStruct.PriceHigherThanValue)
if nowPrice.Cmp(priceHigherThanValue) == 1 {
err = errors.New("当前价格异常,请稍后重新兑换")
return
}
originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
afterPrice := originalQuantityFunds.Div(userExchangeNums.Add(originalQuantityNums)) //降价后的价格

greenEnergyValues := userExchangeNums.Mul(afterPrice) //绿色能量个数
greenEnergyFeeValues := greenEnergyValues.Mul(exchangeAccountBalanceFee.Div(decimalRate)) //绿色能量个数扣除手续费价值


+ 0
- 6
rule/one_circles/one_circles_sign_in_green_energy_settlement.go Näytä tiedosto

@@ -213,12 +213,6 @@ func HandleSettlementSignInGreenEnergy(engine *xorm.Engine, masterId string, id
}
}

if err != nil {
_ = session.Rollback()
fmt.Println("err:::::1111", err)
return
}

err = session.Commit()
if err != nil {
_ = session.Rollback()


Ladataan…
Peruuta
Tallenna