瀏覽代碼

update

master
dengbiao 6 月之前
父節點
當前提交
2ab34a3471
共有 2 個檔案被更改,包括 12 行新增8 行删除
  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 查看文件

@@ -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 查看文件

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


Loading…
取消
儲存