Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
share
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张振华
share
Commits
bca40bb8
Commit
bca40bb8
authored
Dec 17, 2018
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a2690b38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
23 deletions
+35
-23
Guess-State.mdj
Guess-State.mdj
+14
-14
predict.go
predict.go
+21
-9
No files found.
Guess-State.mdj
View file @
bca40bb8
...
@@ -644,11 +644,11 @@
...
@@ -644,11 +644,11 @@
},
},
"font": "Arial;13;0",
"font": "Arial;13;0",
"left": 96,
"left": 96,
"top": 5
15
,
"top": 5
27
,
"width": 113.46435546875,
"width": 113.46435546875,
"height": 13,
"height": 13,
"alpha": 0.
888105730380102
5,
"alpha": 0.
1493020709785165
5,
"distance": 1
1.40175425099138
,
"distance": 1
8.601075237738275
,
"hostEdge": {
"hostEdge": {
"$ref": "AAAAAAFnU9ToGQuaBII="
"$ref": "AAAAAAFnU9ToGQuaBII="
},
},
...
@@ -2372,12 +2372,12 @@
...
@@ -2372,12 +2372,12 @@
},
},
"fontColor": "#ff0000",
"fontColor": "#ff0000",
"font": "Arial;13;0",
"font": "Arial;13;0",
"left":
511
,
"left":
496
,
"top": 3
76
,
"top": 3
83
,
"width": 89,
"width": 89,
"height": 13,
"height": 13,
"alpha": 0.
5797154799347988
,
"alpha": 0.
33266536401287555
,
"distance":
54.45181356024793
,
"distance":
40.85339643163099
,
"hostEdge": {
"hostEdge": {
"$ref": "AAAAAAFnU+sx4g1ZC00="
"$ref": "AAAAAAFnU+sx4g1ZC00="
},
},
...
@@ -2635,12 +2635,12 @@
...
@@ -2635,12 +2635,12 @@
},
},
"fontColor": "#00d600",
"fontColor": "#00d600",
"font": "Arial;13;0",
"font": "Arial;13;0",
"left": 2
70
,
"left": 2
14
,
"top": 4
20
,
"top": 4
15
,
"width": 44.08447265625,
"width": 44.08447265625,
"height": 13,
"height": 13,
"alpha":
1.802649048826961
,
"alpha":
-0.9391717284139225
,
"distance":
25.96150997149434
,
"distance":
31.144823004794873
,
"hostEdge": {
"hostEdge": {
"$ref": "AAAAAAFnc16P7Kaa5nw="
"$ref": "AAAAAAFnc16P7Kaa5nw="
},
},
...
@@ -2733,12 +2733,12 @@
...
@@ -2733,12 +2733,12 @@
},
},
"fontColor": "#00d600",
"fontColor": "#00d600",
"font": "Arial;13;0",
"font": "Arial;13;0",
"left": 2
53
,
"left": 2
64
,
"top": 487,
"top": 487,
"width": 41.1962890625,
"width": 41.1962890625,
"height": 13,
"height": 13,
"alpha": 1.
570796326794896
6,
"alpha": 1.
711454296737051
6,
"distance":
1
5,
"distance":
2
5,
"hostEdge": {
"hostEdge": {
"$ref": "AAAAAAFnduBlUKbHO2o="
"$ref": "AAAAAAFnduBlUKbHO2o="
},
},
...
...
predict.go
View file @
bca40bb8
...
@@ -117,7 +117,9 @@ func main() {
...
@@ -117,7 +117,9 @@ func main() {
status
,
_
:=
strconv
.
Atoi
(
os
.
Args
[
3
])
status
,
_
:=
strconv
.
Atoi
(
os
.
Args
[
3
])
index
,
_
:=
strconv
.
ParseInt
(
os
.
Args
[
4
],
10
,
64
)
index
,
_
:=
strconv
.
ParseInt
(
os
.
Args
[
4
],
10
,
64
)
testQueryGamesByCategoryStatus
(
os
.
Args
[
2
],
int32
(
status
),
index
)
testQueryGamesByCategoryStatus
(
os
.
Args
[
2
],
int32
(
status
),
index
)
}
}
else
if
os
.
Args
[
1
]
==
"testQueryGamesByIds"
{
testQueryGamesByIds
(
os
.
Args
[
2
:
])
}
}
}
...
@@ -155,7 +157,7 @@ func constructTx(poststr string) (string, error) {
...
@@ -155,7 +157,7 @@ func constructTx(poststr string) (string, error) {
}
}
func
createGuessGameStartTx
()
(
string
,
error
)
{
func
createGuessGameStartTx
()
(
string
,
error
)
{
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction","params":[{"execer":"guess","actionName":"GuessStart", "payload":{"topic":"%v","options":"%v", "category":"%v","maxBets":%v,"maxBetsNumber":%v,"fee":%v
}}]}`
,
"WorldCup Final"
,
"A:France;B:Claodia"
,
"football"
,
int64
(
100e8
),
int64
(
1000e8
),
fee
)
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction","params":[{"execer":"guess","actionName":"GuessStart", "payload":{"topic":"%v","options":"%v", "category":"%v","maxBets":%v,"maxBetsNumber":%v,"fee":%v
,"devFeeFactor":%v,"devFeeAddr":"%v","platFeeFactor":%v, "platFeeAddr":"%v"}}]}`
,
"WorldCup Final"
,
"A:France;B:Claodia"
,
"football"
,
int64
(
100e8
),
int64
(
1000e8
),
fee
,
5
,
"1D6RFZNp2rh6QdbcZ1d7RWuBUz61We6SD7"
,
5
,
"1PHtChNt3UcfssR7v7trKSk3WJtAWjKjjX"
)
fmt
.
Println
(
poststr
)
fmt
.
Println
(
poststr
)
return
constructTx
(
poststr
)
return
constructTx
(
poststr
)
}
}
...
@@ -307,6 +309,7 @@ func SendTx(hexTx string) {
...
@@ -307,6 +309,7 @@ func SendTx(hexTx string) {
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":2,"method":"Chain33.SendTransaction","params":[{"data":"%v"}]}`
,
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":2,"method":"Chain33.SendTransaction","params":[{"data":"%v"}]}`
,
hexTx
)
hexTx
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -319,10 +322,15 @@ func SendTx(hexTx string) {
...
@@ -319,10 +322,15 @@ func SendTx(hexTx string) {
fmt
.
Printf
(
"returned JSON: %s
\n
"
,
string
(
b
))
fmt
.
Printf
(
"returned JSON: %s
\n
"
,
string
(
b
))
}
}
func
testQueryGamesByIds
(
gameId
string
)
{
func
testQueryGamesByIds
(
gameIds
[]
string
)
{
str
:=
fmt
.
Sprintf
(
"{%s}"
,
gameIds
[
0
])
for
i
:=
1
;
i
<
len
(
gameIds
);
i
++
{
str
=
fmt
.
Sprintf
(
",{
\"
%s
\"
}"
,
gameIds
[
i
])
}
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByIds","payload":{"gameIds":[
{"%v"}]}}]}`
,
gameId
)
"params":[{"execer":"guess","funcName":"QueryGamesByIds","payload":{"gameIds":[
%v]}}]}`
,
gameId
,
str
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -347,6 +355,8 @@ func testQueryGameById(gameId string) {
...
@@ -347,6 +355,8 @@ func testQueryGameById(gameId string) {
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGameById","payload":{"gameId":"%v"}}]}`
,
gameId
)
"params":[{"execer":"guess","funcName":"QueryGameById","payload":{"gameId":"%v"}}]}`
,
gameId
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -371,6 +381,7 @@ func testQueryGamesByAddr(addr string,index int64) {
...
@@ -371,6 +381,7 @@ func testQueryGamesByAddr(addr string,index int64) {
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAddr","payload":{"addr":"%v","index":"%v"}}]}`
,
addr
,
index
)
"params":[{"execer":"guess","funcName":"QueryGamesByAddr","payload":{"addr":"%v","index":"%v"}}]}`
,
addr
,
index
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -394,7 +405,7 @@ func testQueryGamesByAddr(addr string,index int64) {
...
@@ -394,7 +405,7 @@ func testQueryGamesByAddr(addr string,index int64) {
func
testQueryGamesByStatus
(
status
int32
,
index
int64
)
{
func
testQueryGamesByStatus
(
status
int32
,
index
int64
)
{
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByStatus","payload":{"status":"%v","index":"%v"}}]}`
,
status
,
index
)
"params":[{"execer":"guess","funcName":"QueryGamesByStatus","payload":{"status":"%v","index":"%v"}}]}`
,
status
,
index
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -418,7 +429,7 @@ func testQueryGamesByStatus(status int32, index int64) {
...
@@ -418,7 +429,7 @@ func testQueryGamesByStatus(status int32, index int64) {
func
testQueryGamesByAdminAddr
(
addr
string
,
index
int64
)
{
func
testQueryGamesByAdminAddr
(
addr
string
,
index
int64
)
{
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAdminAddr","payload":{"adminAddr":"%v","index":"%v"}}]}`
,
addr
,
index
)
"params":[{"execer":"guess","funcName":"QueryGamesByAdminAddr","payload":{"adminAddr":"%v","index":"%v"}}]}`
,
addr
,
index
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -443,7 +454,7 @@ func testQueryGamesByAdminAddr(addr string,index int64) {
...
@@ -443,7 +454,7 @@ func testQueryGamesByAdminAddr(addr string,index int64) {
func
testQueryGamesByAddrStatus
(
addr
string
,
status
int32
,
index
int64
)
{
func
testQueryGamesByAddrStatus
(
addr
string
,
status
int32
,
index
int64
)
{
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAddrStatus","payload":{"addr":"%v","status":"%v","index":"%v"}}]}`
,
addr
,
status
,
index
)
"params":[{"execer":"guess","funcName":"QueryGamesByAddrStatus","payload":{"addr":"%v","status":"%v","index":"%v"}}]}`
,
addr
,
status
,
index
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -467,7 +478,7 @@ func testQueryGamesByAddrStatus(addr string,status int32, index int64) {
...
@@ -467,7 +478,7 @@ func testQueryGamesByAddrStatus(addr string,status int32, index int64) {
func
testQueryGamesByAdminStatus
(
addr
string
,
status
int32
,
index
int64
)
{
func
testQueryGamesByAdminStatus
(
addr
string
,
status
int32
,
index
int64
)
{
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByAdminStatus","payload":{"adminAddr":"%v","status":"%v","index":"%v"}}]}`
,
addr
,
status
,
index
)
"params":[{"execer":"guess","funcName":"QueryGamesByAdminStatus","payload":{"adminAddr":"%v","status":"%v","index":"%v"}}]}`
,
addr
,
status
,
index
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -491,7 +502,7 @@ func testQueryGamesByAdminStatus(addr string,status int32, index int64) {
...
@@ -491,7 +502,7 @@ func testQueryGamesByAdminStatus(addr string,status int32, index int64) {
func
testQueryGamesByCategoryStatus
(
category
string
,
status
int32
,
index
int64
)
{
func
testQueryGamesByCategoryStatus
(
category
string
,
status
int32
,
index
int64
)
{
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
poststr
:=
fmt
.
Sprintf
(
`{"jsonrpc":"2.0","id":0,"method":"Chain33.Query",
"params":[{"execer":"guess","funcName":"QueryGamesByCategoryStatus","payload":{"category":"%v","status":"%v","index":"%v"}}]}`
,
category
,
status
,
index
)
"params":[{"execer":"guess","funcName":"QueryGamesByCategoryStatus","payload":{"category":"%v","status":"%v","index":"%v"}}]}`
,
category
,
status
,
index
)
fmt
.
Println
(
"post data:"
,
poststr
)
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
resp
,
err
:=
http
.
Post
(
getJrpc
(),
"application/json"
,
bytes
.
NewBufferString
(
poststr
))
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
@@ -511,3 +522,4 @@ func testQueryGamesByCategoryStatus(category string,status int32, index int64) {
...
@@ -511,3 +522,4 @@ func testQueryGamesByCategoryStatus(category string,status int32, index int64) {
return
return
}
}
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