Bladeren bron

add 区块星链

tags/v2.1.5
DengBiao 2 jaren geleden
bovenliggende
commit
7c2175bb97
1 gewijzigde bestanden met toevoegingen van 17 en 0 verwijderingen
  1. +17
    -0
      rule/block_star_chain_settlement.go

+ 17
- 0
rule/block_star_chain_settlement.go Bestand weergeven

@@ -37,6 +37,7 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
}() }()
session.Begin() session.Begin()
now := time.Now() now := time.Now()
today := now.Format("2006-01-02")


//1、查找 `block_star_chain` 基础设置 //1、查找 `block_star_chain` 基础设置
blockStarChain, err := db.BlockStarChainGetOneByParams(session, map[string]interface{}{ blockStarChain, err := db.BlockStarChainGetOneByParams(session, map[string]interface{}{
@@ -47,6 +48,10 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
_ = session.Rollback() _ = session.Rollback()
return err return err
} }
if blockStarChain.SettlementDate == today {
_ = session.Rollback()
return errors.New("今日“区块星链”已结算")
}
//initialCoinTotal := zhios_order_relate_utils.StrToFloat64(blockStarChain.InitialCoinTotal) //初始区块币总量 //initialCoinTotal := zhios_order_relate_utils.StrToFloat64(blockStarChain.InitialCoinTotal) //初始区块币总量
todayPublishCoin := zhios_order_relate_utils.StrToFloat64(blockStarChain.TodayPublishCoin) //今日区块币发行数量(若为0,则按当前每日区块币发行数量) todayPublishCoin := zhios_order_relate_utils.StrToFloat64(blockStarChain.TodayPublishCoin) //今日区块币发行数量(若为0,则按当前每日区块币发行数量)
nowEverydayPublishCoin := zhios_order_relate_utils.StrToFloat64(blockStarChain.NowEverydayPublishCoin) //当前每日区块币发行数量 nowEverydayPublishCoin := zhios_order_relate_utils.StrToFloat64(blockStarChain.NowEverydayPublishCoin) //当前每日区块币发行数量
@@ -145,6 +150,18 @@ func DailySettlementBlockStarChain(engine *xorm.Engine, mid string) (err error)
return err return err
} }


//7、更新 block_star_chain 中的 settlement_date 字段
blockStarChain.SettlementDate = today
updateAffected, err := db.BlockStarChainUpdate(session, blockStarChain.Id, blockStarChain, "settlement_date")
if err != nil {
_ = session.Rollback()
return err
}
if updateAffected == 0 {
_ = session.Rollback()
return errors.New("更新 block_star_chain 的 settlement_date 记录失败")
}

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


Laden…
Annuleren
Opslaan