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
78ec03c1
Commit
78ec03c1
authored
May 14, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coincheck update
parent
02ee0969
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
10 deletions
+28
-10
CoinReleaseCheckController.php
backend/controllers/CoinReleaseCheckController.php
+1
-0
Chain33Business.php
common/business/Chain33Business.php
+4
-4
CoinReleaseCheck.php
common/models/psources/CoinReleaseCheck.php
+9
-3
Chain33Service.php
common/service/chain33/Chain33Service.php
+14
-3
No files found.
backend/controllers/CoinReleaseCheckController.php
View file @
78ec03c1
...
...
@@ -89,6 +89,7 @@ class CoinReleaseCheckController extends BaseController
$addresses
=
array_values
(
array_unique
(
array_column
(
$datas
,
'to_address'
)));
$address_datas
=
CoinExtract
::
getAllByAddress
(
$addresses
);
foreach
(
$datas
as
$key
=>
&
$value
)
{
if
(
!
isset
(
$address_datas
[
$value
[
'to_address'
]]))
continue
;
$value
[
'today'
]
=
$address_datas
[
$value
[
'to_address'
]][
'today'
];
$value
[
'total'
]
=
$address_datas
[
$value
[
'to_address'
]][
'total'
];
}
...
...
common/business/Chain33Business.php
View file @
78ec03c1
...
...
@@ -99,9 +99,9 @@ class Chain33Business
return
[
'code'
=>
-
1
,
'msg'
=>
$result
[
'msg'
]];
}
public
static
function
tradeToken
(
$amount
,
$execName
,
$fee
,
$isToken
=
True
,
$to
,
$tokenSymbol
=
''
)
public
static
function
tradeToken
(
$amount
,
$execName
,
$fee
,
$isToken
=
True
,
$to
,
$tokenSymbol
=
''
,
$node_params
=
[]
)
{
$service
=
new
Chain33Service
();
$service
=
new
Chain33Service
(
$node_params
);
$result
=
$service
->
structureTrade
(
$amount
,
$execName
,
$fee
,
$isToken
,
$to
,
$tokenSymbol
);
if
(
$result
[
'code'
]
!=
0
)
{
return
[
'code'
=>
-
1
,
'msg'
=>
$result
[
'error'
]];
...
...
@@ -265,9 +265,9 @@ class Chain33Business
* @param $password
* 解锁钱包
*/
public
static
function
unLockWallet
(
$password
)
public
static
function
unLockWallet
(
$password
,
$node_params
=
[]
)
{
$service
=
new
Chain33Service
();
$service
=
new
Chain33Service
(
$node_params
);
return
$service
->
unLockWallet
(
$password
);
}
...
...
common/models/psources/CoinReleaseCheck.php
View file @
78ec03c1
...
...
@@ -141,7 +141,7 @@ class CoinReleaseCheck extends BaseActiveRecord
* @throws \Exception
* @return bool
*/
public
function
check_second
(
int
$status
,
string
$address
=
''
)
public
function
check_second
(
$status
,
$address
=
''
)
{
if
(
self
::
CHECK_FIRST_STATUS_SUCCEED
!=
$this
->
check_first_status
)
{
throw
new
\Exception
(
'初审未通过!'
,
-
1
);
...
...
@@ -163,14 +163,20 @@ class CoinReleaseCheck extends BaseActiveRecord
$isToken
=
true
;
}
$walletpasswd
=
Yii
::
$app
->
redis
->
get
(
'wallet_passwd'
);
Chain33Business
::
unLockWallet
(
$walletpasswd
);
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'secondary'
];
$unChain
=
Chain33Business
::
unLockWallet
(
$walletpasswd
,
$node_params
);
if
(
false
==
$unChain
[
'result'
][
'isOK'
]){
throw
new
\Exception
(
$unChain
[
'result'
][
'msg'
],
-
1
);
}
$result
=
Chain33Business
::
tradeToken
(
(
int
)
$this
->
amount
,
''
,
1000
,
$isToken
,
trim
(
$this
->
to_address
),
$this
->
coin
$this
->
coin
,
$node_params
);
// $result = Chain33Business::transToken(
// trim($address),
...
...
common/service/chain33/Chain33Service.php
View file @
78ec03c1
...
...
@@ -16,9 +16,20 @@ use common\helpers\Curl;
*/
class
Chain33Service
{
public
static
function
urlBuild
()
private
$node_params
;
public
function
__construct
(
$parameter
=
[])
{
if
(
empty
(
$parameter
)){
$this
->
node_params
=
Yii
::
$app
->
params
[
'chain33'
];
}
else
{
$this
->
node_params
=
$parameter
;
}
}
public
function
urlBuild
()
{
$config
=
Yii
::
$app
->
params
[
'chain33'
]
;
$config
=
$this
->
node_params
;
$scheme
=
$config
[
'scheme'
]
??
'http'
;
$host
=
$config
[
'host'
]
??
'127.0.0.1'
;
$port
=
(
string
)
$config
[
'port'
]
??
''
;
...
...
@@ -49,7 +60,7 @@ class Chain33Service
$jsonrpc
=
self
::
jsonRpcBuild
(
$params
,
$method
);
$ch
->
setHeader
(
'Content-Type'
,
'application/json'
);
$ch
->
setRawPostData
(
$jsonrpc
);
$result
=
$ch
->
post
(
self
::
urlBuild
(),
false
);
$result
=
$ch
->
post
(
$this
->
urlBuild
(),
false
);
if
(
!
$result
)
{
return
[
'code'
=>
-
1
,
'msg'
=>
$ch
->
errorText
];
}
...
...
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