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
7a73e2c8
Commit
7a73e2c8
authored
Jul 08, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/airdrop' into 'master'
Feature/airdrop See merge request
!346
parents
b87f07cd
896cfbfe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
CoinAirDropTransfer.php
common/models/psources/CoinAirDropTransfer.php
+3
-0
AirDropController.php
console/controllers/AirDropController.php
+17
-7
No files found.
common/models/psources/CoinAirDropTransfer.php
View file @
7a73e2c8
...
...
@@ -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 @
7a73e2c8
...
...
@@ -250,7 +250,7 @@ class AirDropController extends Controller
}
/**
*
获取游戏状态
*
自定义空投
* @return
*/
public
function
actionAutoAirDrop
()
...
...
@@ -260,6 +260,7 @@ class AirDropController extends Controller
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无空投计划'
.
PHP_EOL
;
return
0
;
}
foreach
(
$model
as
$key
=>
$val
)
{
go
(
function
()
use
(
$val
)
{
\Co
::
sleep
(
0.5
);
...
...
@@ -268,11 +269,20 @@ class AirDropController extends Controller
$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'
])
{
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'primary'
];
$service
=
new
Chain33Service
(
$node_params
);
$execer
=
'coins'
;
$createRawTransaction
=
$service
->
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
);
}
if
(
CoinAirDropTransfer
::
TYPE_TOKEN
==
$val
[
'type'
])
{
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'parallel'
];
$service
=
new
Chain33Service
(
$node_params
);
$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 +291,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