소스 검색

add 区块星链

tags/v2.1.5
DengBiao 2 년 전
부모
커밋
7c2175bb97
1개의 변경된 파일17개의 추가작업 그리고 0개의 파일을 삭제
  1. +17
    -0
      rule/block_star_chain_settlement.go

+ 17
- 0
rule/block_star_chain_settlement.go 파일 보기

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


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