Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
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
wallet
token
Commits
d6bc3581
Commit
d6bc3581
authored
Nov 01, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
09dede81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
15 deletions
+24
-15
LotteryService.php
common/service/chain33/LotteryService.php
+18
-9
LotteryController.php
console/controllers/LotteryController.php
+6
-6
No files found.
common/service/chain33/LotteryService.php
View file @
d6bc3581
...
...
@@ -81,13 +81,18 @@ class LotteryService
$config
=
Yii
::
$app
->
params
[
'lottery'
];
$lotterId
=
$config
[
'lotteryId'
];
$params
=
[
"lotteryId"
=>
$lotterId
,
"amount"
=>
$amount
,
"number"
=>
$number
,
"way"
=>
$way
,
"fee"
=>
$fee
,
"execer"
=>
"lottery"
,
"actionName"
=>
"LotteryBuy"
,
"payload"
=>
[
"lotteryId"
=>
$lotterId
,
"amount"
=>
$amount
,
"number"
=>
$number
,
"way"
=>
$way
,
"fee"
=>
$fee
,
]
];
return
$this
->
send
(
$params
,
'Chain33.Create
RawLotteryBuyTx
'
);
return
$this
->
send
(
$params
,
'Chain33.Create
Transaction
'
);
}
/**
...
...
@@ -98,10 +103,14 @@ class LotteryService
$config
=
Yii
::
$app
->
params
[
'lottery'
];
$lotterId
=
$config
[
'lotteryId'
];
$params
=
[
"lotteryId"
=>
$lotterId
,
"fee"
=>
$fee
"execer"
=>
"lottery"
,
"actionName"
=>
"LotteryDraw"
,
"payload"
=>
[
"lotteryId"
=>
$lotterId
,
"fee"
=>
$fee
]
];
return
$this
->
send
(
$params
,
'Chain33.Create
RawLotteryDrawTx
'
);
return
$this
->
send
(
$params
,
'Chain33.Create
Transaction
'
);
}
/**
...
...
console/controllers/LotteryController.php
View file @
d6bc3581
...
...
@@ -66,14 +66,13 @@ class LotteryController extends Controller
}
else
{
echo
date
(
'Y-m-d H:i:s'
)
.
': '
.
'开奖异常: '
.
$lottery_result
[
'msg'
]
.
PHP_EOL
;
}
sleep
(
10
);
}
else
{
if
(
$last
->
start_height
!=
$start_height
){
$last
->
start_height
=
$start_height
;
$last
->
round
=
$round
;
$last
->
save
();
echo
date
(
'Y-m-d H:i:s'
)
.
': '
.
'总期数:'
.
$round
.
" 交易数据更新成功!"
.
PHP_EOL
;
CoinLottery
::
addOneRecord
(
$start_height
,
$last_lottery_height
,
$last
->
stage
+
1
,
$round
,
$start_date
);
echo
date
(
'Y-m-d H:i:s'
)
.
': '
.
'总期数:'
.
$round
.
" 交易数据添加成功!"
.
PHP_EOL
;
}
sleep
(
2
);
sleep
(
10
);
continue
;
}
}
else
if
(
$lottery_current_result
[
'status'
]
==
3
){
//已开奖
...
...
@@ -88,7 +87,7 @@ class LotteryController extends Controller
$trade_result
=
LotteryBusiness
::
trade
(
1
,
12345
,
5
,
0
);
if
(
$trade_result
[
'code'
]
==
0
){
echo
date
(
'Y-m-d H:i:s'
)
.
': '
.
'交易成功 '
.
PHP_EOL
;
CoinLottery
::
addOneRecord
(
$start_height
,
$last_lottery_height
,
$last
->
stage
+
1
,
$round
,
$start_date
);
//
CoinLottery::addOneRecord($start_height,$last_lottery_height,$last->stage+1,$round,$start_date);
}
else
{
echo
date
(
'Y-m-d H:i:s'
)
.
': '
.
'参与交易异常: '
.
$trade_result
[
'msg'
]
.
PHP_EOL
;
}
...
...
@@ -107,6 +106,7 @@ class LotteryController extends Controller
}
else
{
echo
date
(
'Y-m-d H:i:s'
)
.
': '
.
'开奖异常: '
.
$lottery_result
[
'msg'
]
.
PHP_EOL
;
}
sleep
(
10
);
}
}
else
if
(
$lottery_current_result
[
'status'
]
==
3
){
//开完奖状态,等待交易进入下一期
if
(
$last_header
[
'height'
]
>
$last_lottery_height
){
//当前区块高度大于上期开奖高度,可以进行交易进入下一期
...
...
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