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
a43ae0f0
Commit
a43ae0f0
authored
Jun 22, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
075d786e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
CoinAirDropTransfer.php
common/models/psources/CoinAirDropTransfer.php
+3
-0
AirDropController.php
console/controllers/AirDropController.php
+15
-8
No files found.
common/models/psources/CoinAirDropTransfer.php
View file @
a43ae0f0
...
...
@@ -11,6 +11,9 @@ class CoinAirDropTransfer extends BaseActiveRecord
const
ORIGIN_ADD
=
2
;
const
ORIGIN_API
=
3
;
const
TYPE_COINS
=
1
;
const
TYPE_TOKEN
=
2
;
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
...
...
console/controllers/AirDropController.php
View file @
a43ae0f0
...
...
@@ -250,7 +250,7 @@ class AirDropController extends Controller
}
/**
*
获取游戏状态
*
自定义空投
* @return
*/
public
function
actionAutoAirDrop
()
...
...
@@ -260,19 +260,26 @@ class AirDropController extends Controller
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无空投计划'
.
PHP_EOL
;
return
0
;
}
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'primary'
];
$service
=
new
Chain33Service
(
$node_params
);
foreach
(
$model
as
$key
=>
$val
)
{
go
(
function
()
use
(
$val
)
{
go
(
function
()
use
(
$val
,
$service
)
{
\Co
::
sleep
(
0.5
);
$id
=
$val
[
'id'
];
$to
=
$val
[
'to_address'
];
$amount
=
$val
[
'amount'
]
*
1e8
;
$fee
=
100000
;
$note
=
''
;
$execer
=
isset
(
Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
][
$val
[
'coin_name'
]
.
'_wallet'
])
?
Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
][
$val
[
'coin_name'
]
.
'_wallet'
][
'execer'
]
:
null
;
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'wasm'
][
$val
[
'coin_name'
]
.
'_wallet'
];
$service
=
new
Chain33Service
(
$node_params
);
$createRawTransaction
=
$service
->
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
);
if
(
CoinAirDropTransfer
::
TYPE_COINS
==
$val
[
'type'
])
{
$execer
=
'coins'
;
$createRawTransaction
=
$service
->
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
);
}
if
(
CoinAirDropTransfer
::
TYPE_TOKEN
==
$val
[
'type'
])
{
$execer
=
'user.p.mall.token'
;
$isToken
=
true
;
$tokenSymbol
=
$val
[
'coin_name'
];
$createRawTransaction
=
$service
->
createTokenRawTransaction
(
$to
,
$amount
,
$isToken
,
$tokenSymbol
,
$fee
,
$note
,
$execer
);
}
if
(
0
!=
$createRawTransaction
[
'code'
])
{
$txhash
=
'0'
;
...
...
@@ -281,7 +288,7 @@ class AirDropController extends Controller
}
$txHex
=
$createRawTransaction
[
'result'
];
$privkey
=
'72c3879f1f9b523f266a9545b69bd41c0251483a93e21e348e85118afe17a5e2
1
'
;
$privkey
=
'72c3879f1f9b523f266a9545b69bd41c0251483a93e21e348e85118afe17a5e2'
;
$expire
=
'1m'
;
$signRawTx
=
$service
->
signRawTx
(
$privkey
,
$txHex
,
$expire
);
...
...
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