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
63e9a635
Commit
63e9a635
authored
Nov 08, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/issue_coin' into develop
parents
0634ab20
acc05dff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
CoinIssueCoin.php
common/models/psources/CoinIssueCoin.php
+2
-0
IssueChainTransferController.php
console/controllers/IssueChainTransferController.php
+16
-2
No files found.
common/models/psources/CoinIssueCoin.php
View file @
63e9a635
...
...
@@ -25,6 +25,8 @@ class CoinIssueCoin extends CommonActiveRecord
const
TYPE_NO
=
0
;
//不是增发
const
TYPE_YES
=
1
;
//是增发
const
ISSUE_TOKEN
=
'issue_token'
;
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
...
...
console/controllers/IssueChainTransferController.php
View file @
63e9a635
...
...
@@ -127,6 +127,7 @@ class IssueChainTransferController extends Controller
public
function
actionQueryTransaction
(
$step
)
{
$redis
=
Yii
::
$app
->
redis
;
if
(
1
==
$step
)
{
$model
=
CoinIssueChainRecord
::
find
()
->
where
([
'pre_query_transaction'
=>
'standby'
])
->
all
();
}
...
...
@@ -142,6 +143,7 @@ class IssueChainTransferController extends Controller
$node
=
Yii
::
$app
->
params
[
'chain_nodes'
][
'STO'
];
$service
=
new
Chain33Service
(
$node
);
$current_time
=
time
();
foreach
(
$model
as
$val
)
{
if
(
1
==
$step
)
{
$result
=
$service
->
QueryTransaction
(
$val
->
pre_send_transaction
);
...
...
@@ -167,6 +169,7 @@ class IssueChainTransferController extends Controller
}
else
{
$status
=
CoinIssueCoin
::
STATUS_SUCCESS
;
}
$redis
->
hdel
(
CoinIssueCoin
::
ISSUE_TOKEN
,
$val
->
id
);
goto
doEnd
;
}
else
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'ty'
])
&&
2
==
$result
[
'result'
][
'receipt'
][
'ty'
])
{
$data
=
[
...
...
@@ -184,6 +187,7 @@ class IssueChainTransferController extends Controller
}
else
{
$status
=
CoinIssueCoin
::
STATUS_SUCCESS
;
}
$redis
->
hdel
(
CoinIssueCoin
::
ISSUE_TOKEN
,
$val
->
id
);
goto
doEnd
;
}
else
{
$status
=
CoinIssueCoin
::
STATUS_FAILED
;
...
...
@@ -206,11 +210,21 @@ class IssueChainTransferController extends Controller
$data
[
'finish_send_transaction'
]
=
'failed'
;
$data
[
'finish_query_transaction'
]
=
'failed'
;
}
$cache_error_time
=
$redis
->
hget
(
CoinIssueCoin
::
ISSUE_TOKEN
,
$val
->
id
);
if
(
false
==
$cache_error_time
)
{
$redis
->
hmset
(
CoinIssueCoin
::
ISSUE_TOKEN
,
$val
->
id
,
$current_time
);
continue
;
}
if
((
$current_time
-
$cache_error_time
)
<
10
)
{
continue
;
}
$redis
->
hdel
(
CoinIssueCoin
::
ISSUE_TOKEN
,
$val
->
id
);
goto
doEnd
;
}
doEnd
:
#echo json_encode($data).PHP_EOL;
#echo $status.PHP_EOL;exit;
CoinIssueChainRecord
::
updateAll
(
$data
,
[
'id'
=>
$val
->
id
,
]);
...
...
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