소스 검색

update 一个圈圈

master
DengBiao 9 달 전
부모
커밋
14a60bbdc7
2개의 변경된 파일5개의 추가작업 그리고 9개의 파일을 삭제
  1. +3
    -3
      rule/one_circles/one_circles_available_green_energy_settlement.go
  2. +2
    -6
      rule/one_circles/one_circles_deal_available_green_energy_points.go

+ 3
- 3
rule/one_circles/one_circles_available_green_energy_settlement.go 파일 보기

@@ -23,7 +23,7 @@ func CalcPriceIncreaseFormula(engine *xorm.Engine, userAmountValue string) (err
userAmount, _ := decimal.NewFromString(userAmountValue) //用户资金
nowPrice, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.NowPrice) //当前价格
originalQuantityNums, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalQuantityNums) //原始数量
originalQuantityFunds := originalQuantityNums.Mul(nowPrice) //原始资金
originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
afterPrice := (userAmount.Add(originalQuantityFunds)).Div(originalQuantityNums).Truncate(8) //涨价后的价格

values = userAmount.Div(afterPrice).Truncate(8).String() //用户得到绿色能量个数
@@ -37,7 +37,7 @@ func NewCalcPriceIncreaseFormula(userAmountValue string, oneCirclesGreenEnergyBa
userAmount, _ := decimal.NewFromString(userAmountValue) //用户资金
nowPrice, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.NowPrice) //当前价格
originalQuantityNums, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalQuantityNums) //原始数量
originalQuantityFunds := originalQuantityNums.Mul(nowPrice) //原始资金
originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
afterPrice := (userAmount.Add(originalQuantityFunds)).Div(originalQuantityNums).Truncate(8) //涨价后的价格

values = userAmount.Div(afterPrice).Truncate(8).String() //用户得到绿色能量个数
@@ -76,7 +76,7 @@ func CalcPriceReductionFormula(engine *xorm.Engine, userExchangeNumsValue string
userExchangeNums, _ := decimal.NewFromString(userExchangeNumsValue) //用户兑换绿色能量
originalQuantityNums, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalQuantityNums) //原始数量
nowPrice, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.NowPrice) //当前价格
originalQuantityFunds := originalQuantityNums.Mul(nowPrice) //原始资金
originalQuantityFunds, _ := decimal.NewFromString(oneCirclesGreenEnergyBasicSetting.OriginalFunds) //原始资金
afterPrice := originalQuantityFunds.Div(userExchangeNums.Add(originalQuantityNums)) //降价后的价格

greenEnergyValues := userExchangeNums.Mul(afterPrice) //绿色能量个数


+ 2
- 6
rule/one_circles/one_circles_deal_available_green_energy_points.go 파일 보기

@@ -254,12 +254,8 @@ func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amoun
chain.StarLevelDividends = oneCirclesAvailableGreenEnergyPointsFlow.AfterStarLevelDividendsValues //星级分红
chain.DestructionQuantityNums = oneCirclesAvailableGreenEnergyPointsFlow.AfterDestructionQuantityValues //销毁数量

originalQuantityNums, _ := decimal.NewFromString(chain.OriginalQuantityNums)
originalFunds := originalQuantityNums.Mul(nowPrice).RoundFloor(8).String()
chain.OriginalFunds = originalFunds //原始资金
marketplaceMerchantNums, _ := decimal.NewFromString(chain.MarketplaceMerchantNums)
marketplaceMerchantFunds := marketplaceMerchantNums.Mul(nowPrice).RoundFloor(8).String()
chain.MarketplaceMerchantFunds = marketplaceMerchantFunds //市商资金
chain.OriginalFunds = oneCirclesAvailableGreenEnergyPointsFlow.AfterOriginalQuantityFundValues //原始资金
chain.MarketplaceMerchantFunds = oneCirclesAvailableGreenEnergyPointsFlow.AfterMarketplaceMerchantFundValues //市商资金
//更新 `one_circles_green_energy_basic_setting` 表
if chain.NowPrice != nowPriceValue {
chain.NowPrice = nowPriceValue


불러오는 중...
취소
저장