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