Bladeren bron

Merge remote-tracking branch 'origin/master'

master
huangjiajun 6 maanden geleden
bovenliggende
commit
6ceeadc047
2 gewijzigde bestanden met toevoegingen van 12 en 8 verwijderingen
  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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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()


Laden…
Annuleren
Opslaan