Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
74531d56
Commit
74531d56
authored
Dec 10, 2018
by
pengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pokerbull player check
parent
e6b843b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
pokerbulldb.go
plugin/dapp/pokerbull/executor/pokerbulldb.go
+22
-21
No files found.
plugin/dapp/pokerbull/executor/pokerbulldb.go
View file @
74531d56
...
...
@@ -530,23 +530,23 @@ func (action *Action) selectGameFromIds(ids []string, value int64) *pkt.PokerBul
return
gameRet
}
func
(
action
*
Action
)
checkPlayerExistInGame
()
bool
{
values
,
err
:=
action
.
localDB
.
List
(
calcPBGameAddrPrefix
(
action
.
fromaddr
),
nil
,
pkt
.
DefaultCount
,
pkt
.
ListDESC
)
if
err
==
types
.
ErrNotFound
{
return
false
}
var
value
pkt
.
PBGameRecord
length
:=
len
(
values
)
if
length
!=
0
{
valueBytes
:=
values
[
length
-
1
]
err
:=
types
.
Decode
(
valueBytes
,
&
value
)
if
err
==
nil
&&
value
.
Status
==
pkt
.
PBGameActionQuit
{
return
false
}
}
return
true
}
//
func (action *Action) checkPlayerExistInGame() bool {
//
values, err := action.localDB.List(calcPBGameAddrPrefix(action.fromaddr), nil, pkt.DefaultCount, pkt.ListDESC)
//
if err == types.ErrNotFound {
//
return false
//
}
//
//
var value pkt.PBGameRecord
//
length := len(values)
//
if length != 0 {
//
valueBytes := values[length-1]
//
err := types.Decode(valueBytes, &value)
//
if err == nil && value.Status == pkt.PBGameActionQuit {
//
return false
//
}
//
}
//
return true
//
}
// GameStart 游戏开始
func
(
action
*
Action
)
GameStart
(
start
*
pkt
.
PBGameStart
)
(
*
types
.
Receipt
,
error
)
{
...
...
@@ -566,10 +566,11 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)
return
nil
,
types
.
ErrNoBalance
}
if
action
.
checkPlayerExistInGame
()
{
logger
.
Error
(
"GameStart"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"err"
,
"Address is already in a game"
)
return
nil
,
fmt
.
Errorf
(
"Address is already in a game"
)
}
// 由应用平台限制
//if action.checkPlayerExistInGame() {
// logger.Error("GameStart", "addr", action.fromaddr, "execaddr", action.execaddr, "err", "Address is already in a game")
// return nil, fmt.Errorf("Address is already in a game")
//}
var
game
*
pkt
.
PokerBull
ids
,
err
:=
queryGameListByStatusAndPlayer
(
action
.
localDB
,
pkt
.
PBGameActionStart
,
start
.
PlayerNum
,
start
.
Value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment