Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nft-event
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
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
duanjinfei
nft-event
Commits
ccf12b48
Commit
ccf12b48
authored
Jun 14, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change getPoolInfo Api
parent
d33ea02d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
5 deletions
+101
-5
app.conf
conf/app.conf
+3
-3
LotteryController.go
controllers/LotteryController.go
+24
-2
Lottery_Duration.json
sync/Lottery_Duration.json
+74
-0
No files found.
conf/app.conf
View file @
ccf12b48
appname
=
nft
-
event
-
test
httpport
=
900
1
httpport
=
900
0
runmode
=
test
mysql
=
debian
-
sys
-
maint
:
H4khSGKhjhMJogpE
@
tcp
(
127
.
0
.
0
.
1
:
3306
)/
nftEventTest
?
charset
=
utf8
mysql
=
root
:
mysql2022
@
tcp
(
127
.
0
.
0
.
1
:
3306
)/
nftEventTest
?
charset
=
utf8
rpcUrl
=
https
://
eth
-
mainnet
.
g
.
alchemy
.
com
/
v2
/
1
GbX5zRzYZHK
-
ZoFbbI2zQM2WOjafq2s
deployedBlock
=
17475300
isSyncLog
=
true
...
...
@@ -16,5 +16,5 @@ signAccPrv = 84ffa1fd6216691a968ad3ce78ca66a5d3d2c56772fcd78b6b8e2a7976487e0f
collectionName
=
redis
conn
=
127
.
0
.
0
.
1
:
6379
dbNum
=
1
password
=
c4HNxt6nyUoqzMby
password
=
123456
controllers/LotteryController.go
View file @
ccf12b48
...
...
@@ -173,6 +173,7 @@ func (c *LotteryController) ForwardReq() {
}
func
(
c
*
LotteryController
)
GetPoolInfo
()
{
maxHistory
:=
c
.
GetString
(
"maxHistory"
)
contractStr
:=
c
.
GetString
(
"lotteryContract"
)
if
!
utils
.
IsNilString
(
contractStr
)
{
c
.
ResponseInfo
(
500
,
models
.
PARAM_ERR
,
nil
)
...
...
@@ -190,7 +191,12 @@ func (c *LotteryController) GetPoolInfo() {
return
}
defer
client
.
Close
()
abiBytes
,
err
:=
os
.
Open
(
"./sync/Lottery_Func.json"
)
abiBytes
:=
&
os
.
File
{}
if
maxHistory
!=
""
{
abiBytes
,
err
=
os
.
Open
(
"./sync/Lottery_Duration.json"
)
}
else
{
abiBytes
,
err
=
os
.
Open
(
"./sync/Lottery_Func.json"
)
}
if
err
!=
nil
{
log
.
Error
(
models
.
READ_ABI_ERR
,
err
)
c
.
ResponseInfo
(
500
,
models
.
READ_ABI_ERR
,
err
.
Error
())
...
...
@@ -203,7 +209,23 @@ func (c *LotteryController) GetPoolInfo() {
c
.
ResponseInfo
(
500
,
models
.
PARSE_ABI_ERR
,
err
.
Error
())
return
}
data
,
err
:=
contractAbi
.
Pack
(
"getPoolInfo"
)
data
:=
make
([]
byte
,
0
)
if
maxHistory
!=
""
{
maxHistoryParam
:=
big
.
NewInt
(
0
)
_
,
setRes
:=
maxHistoryParam
.
SetString
(
maxHistory
,
10
)
if
!
setRes
{
c
.
ResponseInfo
(
500
,
models
.
PARAM_ERR
,
nil
)
return
}
data
,
err
=
contractAbi
.
Pack
(
"getPoolInfo"
,
maxHistoryParam
)
if
err
!=
nil
{
log
.
Error
(
models
.
PACK_ABI_ERR
,
err
)
c
.
ResponseInfo
(
500
,
models
.
PACK_ABI_ERR
,
err
.
Error
())
return
}
}
else
{
data
,
err
=
contractAbi
.
Pack
(
"getPoolInfo"
)
}
if
err
!=
nil
{
log
.
Error
(
models
.
PACK_ABI_ERR
,
err
)
c
.
ResponseInfo
(
500
,
models
.
PACK_ABI_ERR
,
err
.
Error
())
...
...
sync/Lottery_Duration.json
0 → 100644
View file @
ccf12b48
[
{
"inputs"
:
[
{
"internalType"
:
"address"
,
"name"
:
"_pool"
,
"type"
:
"address"
},
{
"internalType"
:
"uint256[]"
,
"name"
:
"duration_"
,
"type"
:
"uint256[]"
},
{
"internalType"
:
"address payable[][]"
,
"name"
:
"winner_"
,
"type"
:
"address[][]"
},
{
"internalType"
:
"string[][]"
,
"name"
:
"tx_hash_"
,
"type"
:
"string[][]"
},
{
"internalType"
:
"bytes[][]"
,
"name"
:
"sign_"
,
"type"
:
"bytes[][]"
}
],
"name"
:
"drawLottery"
,
"outputs"
:
[],
"stateMutability"
:
"payable"
,
"type"
:
"function"
},
{
"inputs"
:
[
{
"internalType"
:
"uint256"
,
"name"
:
"maxHistory_"
,
"type"
:
"uint256"
}
],
"name"
:
"getPoolInfo"
,
"outputs"
:
[
{
"internalType"
:
"bool[]"
,
"name"
:
"started_"
,
"type"
:
"bool[]"
},
{
"internalType"
:
"address[]"
,
"name"
:
"nftAddrs_"
,
"type"
:
"address[]"
},
{
"internalType"
:
"string[][]"
,
"name"
:
"nftInfo_"
,
"type"
:
"string[][]"
},
{
"internalType"
:
"uint256[][]"
,
"name"
:
"poolInfo_"
,
"type"
:
"uint256[][]"
},
{
"internalType"
:
"uint256[][]"
,
"name"
:
"poolHistory_"
,
"type"
:
"uint256[][]"
}
],
"stateMutability"
:
"view"
,
"type"
:
"function"
}
]
\ No newline at end of file
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