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
1b1030cc
Commit
1b1030cc
authored
Jan 09, 2019
by
张振华
Committed by
33cn
Jan 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize
parent
209dceff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
exec_local.go
plugin/dapp/guess/executor/exec_local.go
+2
-2
guessdb.go
plugin/dapp/guess/executor/guessdb.go
+15
-2
No files found.
plugin/dapp/guess/executor/exec_local.go
View file @
1b1030cc
...
@@ -37,12 +37,12 @@ func (g *Guess) updateIndex(log *gty.ReceiptGuessGame) (kvs []*types.KeyValue) {
...
@@ -37,12 +37,12 @@ func (g *Guess) updateIndex(log *gty.ReceiptGuessGame) (kvs []*types.KeyValue) {
game
:=
log
.
Game
game
:=
log
.
Game
log
.
Game
=
nil
log
.
Game
=
nil
err
=
tablejoin
.
MustGetTable
(
"game"
)
.
Replace
(
game
)
err
=
gameTable
.
Add
(
game
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
return
nil
}
}
kvs
,
_
=
tablejoin
.
Save
()
kvs
,
_
=
gameTable
.
Save
()
return
kvs
return
kvs
}
else
if
log
.
Status
==
gty
.
GuessGameStatusBet
{
}
else
if
log
.
Status
==
gty
.
GuessGameStatusBet
{
//用户下注,game表发生更新(game中下注信息有更新),user表新增下注记录
//用户下注,game表发生更新(game中下注信息有更新),user表新增下注记录
...
...
plugin/dapp/guess/executor/guessdb.go
View file @
1b1030cc
...
@@ -32,7 +32,7 @@ const (
...
@@ -32,7 +32,7 @@ const (
ListASC
=
int32
(
1
)
ListASC
=
int32
(
1
)
//DefaultCount 默认一次获取的记录数
//DefaultCount 默认一次获取的记录数
DefaultCount
=
int32
(
6
)
DefaultCount
=
int32
(
10
)
//DefaultCategory 默认分类
//DefaultCategory 默认分类
DefaultCategory
=
"default"
DefaultCategory
=
"default"
...
@@ -768,6 +768,10 @@ func (action *Action) GameAbort(pbend *gty.GuessGameAbort) (*types.Receipt, erro
...
@@ -768,6 +768,10 @@ func (action *Action) GameAbort(pbend *gty.GuessGameAbort) (*types.Receipt, erro
//getOptions 获得竞猜选项,并判断是否符合约定格式,类似"A:xxxx;B:xxxx;C:xxx",“:”前为选项名称,不能重复,":"后为选项说明。
//getOptions 获得竞猜选项,并判断是否符合约定格式,类似"A:xxxx;B:xxxx;C:xxx",“:”前为选项名称,不能重复,":"后为选项说明。
func
getOptions
(
strOptions
string
)
(
options
[]
string
,
legal
bool
)
{
func
getOptions
(
strOptions
string
)
(
options
[]
string
,
legal
bool
)
{
if
len
(
strOptions
)
==
0
{
return
nil
,
false
}
legal
=
true
legal
=
true
items
:=
strings
.
Split
(
strOptions
,
";"
)
items
:=
strings
.
Split
(
strOptions
,
";"
)
for
i
:=
0
;
i
<
len
(
items
);
i
++
{
for
i
:=
0
;
i
<
len
(
items
);
i
++
{
...
@@ -779,14 +783,23 @@ func getOptions(strOptions string) (options []string, legal bool) {
...
@@ -779,14 +783,23 @@ func getOptions(strOptions string) (options []string, legal bool) {
}
}
}
}
options
=
append
(
options
,
item
[
0
]
)
options
=
append
(
options
,
trimStr
(
item
[
0
])
)
}
}
return
options
,
legal
return
options
,
legal
}
}
//trimStr 去除字符串中的空格、制表符、换行符
func
trimStr
(
str
string
)
string
{
str
=
strings
.
Replace
(
str
,
" "
,
""
,
-
1
)
str
=
strings
.
Replace
(
str
,
"
\t
"
,
""
,
-
1
)
str
=
strings
.
Replace
(
str
,
"
\n
"
,
""
,
-
1
)
return
str
}
//isLegalOption 判断选项是否为合法选项
//isLegalOption 判断选项是否为合法选项
func
isLegalOption
(
options
[]
string
,
option
string
)
bool
{
func
isLegalOption
(
options
[]
string
,
option
string
)
bool
{
option
=
trimStr
(
option
)
for
i
:=
0
;
i
<
len
(
options
);
i
++
{
for
i
:=
0
;
i
<
len
(
options
);
i
++
{
if
options
[
i
]
==
option
{
if
options
[
i
]
==
option
{
return
true
return
true
...
...
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