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
8b921d64
Commit
8b921d64
authored
May 05, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/airdrop' into 'master'
Feature/airdrop See merge request
!5
parents
29f13137
ff5d170d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
AirDropController.php
api/controllers/AirDropController.php
+39
-0
CoinAirDropTrade.php
common/models/psources/CoinAirDropTrade.php
+3
-3
No files found.
api/controllers/AirDropController.php
View file @
8b921d64
...
@@ -67,4 +67,42 @@ class AirDropController extends BaseController
...
@@ -67,4 +67,42 @@ class AirDropController extends BaseController
return
[
'code'
=>
$code
,
'msg'
=>
$msg
];
return
[
'code'
=>
$code
,
'msg'
=>
$msg
];
}
}
public
function
actionGameTradeUpdate
()
{
$coinAirDropTrade
=
CoinAirDropTrade
::
find
()
->
where
([
'attach'
=>
0
])
->
limit
(
30
)
->
all
();
foreach
(
$coinAirDropTrade
as
$val
){
$fee
=
100000
;
$amount
=
1
*
1e8
;
$execer
=
'coins'
;
$note
=
''
;
$service
=
new
Chain33Service
();
$createRawTransaction
=
$service
->
createRawTransaction
(
$val
->
coins_address
,
$amount
,
$fee
,
$note
,
$execer
);
if
(
0
!=
$createRawTransaction
[
'code'
]){
continue
;
}
$txHex
=
$createRawTransaction
[
'result'
];
$privkey
=
'72c3879f1f9b523f266a9545b69bd41c0251483a93e21e348e85118afe17a5e2'
;
$expire
=
'1m'
;
$signRawTx
=
$service
->
signRawTx
(
$privkey
,
$txHex
,
$expire
);
if
(
0
!=
$signRawTx
[
'code'
]){
continue
;
}
$sign_str
=
$signRawTx
[
'result'
];
$result
=
$service
->
sendTransaction
(
$sign_str
);
if
(
0
!=
$result
[
'code'
]){
continue
;
}
$currentModel
=
CoinAirDropTrade
::
findOne
(
$val
->
id
);
$currentModel
->
attach
=
1
;
$currentModel
->
msg
=
json_encode
([
$currentModel
->
msg
,
$result
[
'code'
]]);
$currentModel
->
save
();
}
return
[
'code'
=>
1
,
'msg'
=>
'ok'
];
}
}
}
\ No newline at end of file
common/models/psources/CoinAirDropTrade.php
View file @
8b921d64
...
@@ -10,7 +10,7 @@ class CoinAirDropTrade extends BaseActiveRecord
...
@@ -10,7 +10,7 @@ class CoinAirDropTrade extends BaseActiveRecord
{
{
const
TYPE_GAME
=
1
;
const
TYPE_GAME
=
1
;
const
AMOUNT_GAME
=
0.
2
;
const
AMOUNT_GAME
=
0.
5
;
public
static
function
getDb
()
public
static
function
getDb
()
{
{
...
@@ -29,13 +29,13 @@ class CoinAirDropTrade extends BaseActiveRecord
...
@@ -29,13 +29,13 @@ class CoinAirDropTrade extends BaseActiveRecord
public
function
rules
()
{
public
function
rules
()
{
return
[
return
[
[[
'coins_address'
,
'msg'
,
'amount'
,
'type'
],
'required'
],
[[
'coins_address'
,
'msg'
,
'amount'
,
'type'
,
'attach'
],
'required'
],
];
];
}
}
public
function
scenarios
()
{
public
function
scenarios
()
{
$scenarios
=
[
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'coins_address'
,
'msg'
,
'amount'
,
'type'
],
self
::
SCENARIOS_CREATE
=>
[
'coins_address'
,
'msg'
,
'amount'
,
'type'
,
'attach'
],
];
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
...
...
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