Commit 929cdc00 authored by pengjun's avatar pengjun Committed by vipwzw

pokerbull调整游戏结束状态

parent c18f93fb
...@@ -794,6 +794,11 @@ func (action *Action) GameQuit(pbend *pkt.PBGameQuit) (*types.Receipt, error) { ...@@ -794,6 +794,11 @@ func (action *Action) GameQuit(pbend *pkt.PBGameQuit) (*types.Receipt, error) {
return nil, err return nil, err
} }
if game.Status == pkt.PBGameActionQuit {
logger.Error("Quit pokerbull game","GameID", pbend.GetGameId(), "value", game.Value, "err", "already game over")
return nil, fmt.Errorf("already game over")
}
if !action.checkPlayerAddressExist(game.Players) { if !action.checkPlayerAddressExist(game.Players) {
if action.fromaddr != pkt.PlatformSignAddress { if action.fromaddr != pkt.PlatformSignAddress {
logger.Error("GameEnd", "GameID", pbend.GetGameId(), "addr", action.fromaddr, "execaddr", logger.Error("GameEnd", "GameID", pbend.GetGameId(), "addr", action.fromaddr, "execaddr",
...@@ -939,8 +944,10 @@ func (action *Action) GamePlay(pbplay *pkt.PBGamePlay) (*types.Receipt, error) { ...@@ -939,8 +944,10 @@ func (action *Action) GamePlay(pbplay *pkt.PBGamePlay) (*types.Receipt, error) {
game.Players = append(game.Players, player) game.Players = append(game.Players, player)
} }
game.Status = pkt.PBGameActionContinue // 更新游戏状态 game.Status = pkt.PBGameActionQuit // 更新游戏状态
game.PreStatus = pkt.PBGameActionStart game.PreStatus = pkt.PBGameActionStart
game.QuitTime = time.Unix(action.blocktime, 0).Format("2006-01-02 15:04:05")
game.QuitTxHash = common.ToHex(action.txhash)
} }
logger.Info(fmt.Sprintf("Game starting: %s round: %d", game.GameId, game.Round)) logger.Info(fmt.Sprintf("Game starting: %s round: %d", game.GameId, game.Round))
......
...@@ -87,7 +87,7 @@ const ( ...@@ -87,7 +87,7 @@ const (
// DeveloperFee 开发者佣金 // DeveloperFee 开发者佣金
DeveloperFee = int64(0.005 * float64(types.Coin)) DeveloperFee = int64(0.005 * float64(types.Coin))
// WinnerReturn 赢家回报率 // WinnerReturn 赢家回报率
WinnerReturn = types.Coin - DeveloperFee WinnerReturn = types.Coin - DeveloperFee - PlatformFee
// PlatformSignAddress 平台签名地址 // PlatformSignAddress 平台签名地址
PlatformSignAddress = "1Geb4ppNiAwMKKyrJgcis3JA57FkqsXvdR" PlatformSignAddress = "1Geb4ppNiAwMKKyrJgcis3JA57FkqsXvdR"
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment