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
74f663ec
Commit
74f663ec
authored
May 09, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/airdrop' into 'master'
fix See merge request
!11
parents
1faba804
7b444cdd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
AirDropController.php
api/controllers/AirDropController.php
+27
-3
CoinAirDropTrade.php
common/models/psources/CoinAirDropTrade.php
+2
-2
Chain33Service.php
common/service/chain33/Chain33Service.php
+9
-0
No files found.
api/controllers/AirDropController.php
View file @
74f663ec
...
...
@@ -71,7 +71,7 @@ class AirDropController extends BaseController
public
function
actionGameTradeUpdate
()
{
$coinAirDropTrade
=
CoinAirDropTrade
::
find
()
->
where
([
'attach'
=>
0
])
->
limit
(
30
)
->
all
();
$coinAirDropTrade
=
CoinAirDropTrade
::
find
()
->
where
([
'attach'
=>
2
])
->
limit
(
30
)
->
all
();
foreach
(
$coinAirDropTrade
as
$val
){
$fee
=
100000
;
$amount
=
1
*
1e8
;
...
...
@@ -100,10 +100,33 @@ class AirDropController extends BaseController
}
$currentModel
=
CoinAirDropTrade
::
findOne
(
$val
->
id
);
$currentModel
->
attach
=
1
;
$currentModel
->
msg
=
json_encode
([
$currentModel
->
msg
,
$result
[
'code'
]]);
$currentModel
->
attach
=
2
;
$currentModel
->
balance
=
0
;
$currentModel
->
msg
=
$result
[
'code'
];
$currentModel
->
save
();
}
return
[
'code'
=>
1
,
'msg'
=>
'ok'
];
}
public
function
actionGetBalance
()
{
$coinAirDropTrade
=
CoinAirDropTrade
::
find
()
->
where
([
'balance'
=>
0
])
->
limit
(
60
)
->
all
();
$address
=
[];
foreach
(
$coinAirDropTrade
as
$val
){
$address
[]
=
$val
->
coins_address
;
}
$service
=
new
Chain33Service
();
$execer
=
'coins'
;
$result
=
$service
->
getBalance
(
$address
,
$execer
);
if
(
0
==
$result
[
'code'
]){
$result_balance
=
$result
[
'result'
];
foreach
(
$result_balance
as
$val
){
$coinAirDropTrade
=
CoinAirDropTrade
::
find
()
->
where
([
'coins_address'
=>
$val
[
'addr'
]])
->
one
();
if
(
empty
(
$coinAirDropTrade
))
continue
;
$coinAirDropTrade
->
balance
=
$val
[
'balance'
];
$coinAirDropTrade
->
save
();
}
}
return
[
'code'
=>
1
,
'msg'
=>
'ok'
];
}
}
\ No newline at end of file
common/models/psources/CoinAirDropTrade.php
View file @
74f663ec
...
...
@@ -29,13 +29,13 @@ class CoinAirDropTrade extends BaseActiveRecord
public
function
rules
()
{
return
[
[[
'coins_address'
,
'msg'
,
'amount'
,
'type'
,
'attach'
],
'required'
],
[[
'coins_address'
,
'msg'
,
'amount'
,
'type'
,
'attach'
,
'balance'
],
'required'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'coins_address'
,
'msg'
,
'amount'
,
'type'
,
'attach'
],
self
::
SCENARIOS_CREATE
=>
[
'coins_address'
,
'msg'
,
'amount'
,
'type'
,
'attach'
,
'balance'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
...
...
common/service/chain33/Chain33Service.php
View file @
74f663ec
...
...
@@ -202,6 +202,15 @@ class Chain33Service
return
$this
->
send
(
$params
,
'Chain33.SendTransaction'
);
}
public
function
getBalance
(
$address
,
$execer
)
{
$params
=
[
'addresses'
=>
$address
,
'execer'
=>
$execer
];
return
$this
->
send
(
$params
,
'Chain33.GetBalance'
);
}
public
function
createNoBalanceTransaction
(
$txHex
,
$payAddr
,
$privkey
)
{
$params
=
[
...
...
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