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
6c46805e
Commit
6c46805e
authored
Nov 07, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复已知问题
parent
09cfc426
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
180 deletions
+130
-180
IssueCoinController.php
api/controllers/IssueCoinController.php
+51
-113
CoinIssueCoin.php
common/models/psources/CoinIssueCoin.php
+30
-37
IssueChainTransferController.php
console/controllers/IssueChainTransferController.php
+49
-30
No files found.
api/controllers/IssueCoinController.php
View file @
6c46805e
...
...
@@ -27,7 +27,8 @@ class IssueCoinController extends BaseController
// ];
$chain_service
=
new
Chain33Service
(
$node
);
$result
=
$chain_service
->
query
();
echo
json_encode
(
$result
);
exit
;
echo
json_encode
(
$result
);
exit
;
}
/**
...
...
@@ -69,6 +70,14 @@ class IssueCoinController extends BaseController
goto
doEnd
;
}
$pre_create_tx
=
isset
(
$result
[
'pre_create_tx'
])
?
$result
[
'pre_create_tx'
]
:
''
;
$pre_send_transaction
=
isset
(
$result
[
'pre_send_transaction'
])
?
$result
[
'pre_send_transaction'
]
:
''
;
if
(
false
==
$pre_create_tx
||
false
==
$pre_send_transaction
)
{
$msg
=
'缺少必要的参数'
;
$code
=
-
1
;
goto
doEnd
;
}
$result
=
[
'name'
=>
isset
(
$result
[
'name'
])
?
$result
[
'name'
]
:
''
,
'symbol'
=>
isset
(
$result
[
'symbol'
])
?
strtoupper
(
$result
[
'symbol'
])
:
''
,
...
...
@@ -76,6 +85,7 @@ class IssueCoinController extends BaseController
'owner'
=>
isset
(
$result
[
'owner'
])
?
$result
[
'owner'
]
:
''
,
'introduction'
=>
isset
(
$result
[
'introduction'
])
?
$result
[
'introduction'
]
:
''
,
'category'
=>
isset
(
$result
[
'category'
])
?
$result
[
'category'
]
:
0
,
'type'
=>
isset
(
$result
[
'type'
])
?
$result
[
'type'
]
:
0
,
'platform_id'
=>
$platform_id
,
'chain_id'
=>
$chain_id
,
'charge_unit_id'
=>
isset
(
$result
[
'charge_unit_id'
])
?
$result
[
'charge_unit_id'
]
:
''
,
...
...
@@ -91,6 +101,20 @@ class IssueCoinController extends BaseController
$code
=
0
;
$data
=
$model
->
getPrimaryKey
();
$params
=
[
'pre_create_tx'
=>
$pre_create_tx
,
'pre_send_transaction'
=>
$pre_send_transaction
,
'pre_query_transaction'
=>
'standby'
,
'finish_tx'
=>
'standby'
,
'finish_send_transaction'
=>
'standby'
,
'finish_query_transaction'
=>
'standby'
,
'issue_coin_id'
=>
$data
,
];
$transfer_model
=
new
CoinIssueChainRecord
();
$transfer_model
->
setScenario
(
CoinIssueChainRecord
::
SCENARIOS_PRE_CREATE
);
$transfer_model
->
load
(
$params
,
''
);
$transfer_model
->
save
();
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
...
...
@@ -118,8 +142,9 @@ class IssueCoinController extends BaseController
$size
=
\Yii
::
$app
->
request
->
get
(
'size'
,
5
);
$query
=
CoinIssueCoin
::
find
()
->
select
(
'id, name, symbol, total, create_time, status, chain_id'
)
->
select
(
'id, name, symbol, t
ype, t
otal, create_time, status, chain_id'
)
->
where
([
'owner'
=>
$address
])
->
andWhere
([
'in'
,
'status'
,
[
CoinIssueCoin
::
STATUS_PEDDING
,
CoinIssueCoin
::
STATUS_CANCEL_SUCCESS
,
CoinIssueCoin
::
STATUS_CANCEL_FAILED
,
CoinIssueCoin
::
STATUS_ALLOW
,
CoinIssueCoin
::
STATUS_REFUSE
,
CoinIssueCoin
::
STATUS_SUCCESS
,
CoinIssueCoin
::
STATUS_FAILED
]])
->
orderBy
(
'create_time desc'
);
$countQuery
=
clone
$query
;
...
...
@@ -211,7 +236,7 @@ class IssueCoinController extends BaseController
$params
=
[
'pre_create_tx'
=>
$pre_create_tx
,
'pre_send_transaction'
=>
$pre_send_transaction
,
'pre_query_transaction'
=>
's
uccess
'
,
'pre_query_transaction'
=>
's
tandby
'
,
'finish_tx'
=>
'standby'
,
'finish_send_transaction'
=>
'standby'
,
'finish_query_transaction'
=>
'standby'
,
...
...
@@ -260,6 +285,12 @@ class IssueCoinController extends BaseController
goto
doEnd
;
}
if
(
!
in_array
(
$status
,
[
CoinIssueCoin
::
STATUS_CANCEL
,
CoinIssueCoin
::
STATUS_CONFIRM
]))
{
$msg
=
'错误的状态值'
;
$code
=
-
1
;
goto
doEnd
;
}
$model
=
CoinIssueCoin
::
findOne
(
$id
);
if
(
false
==
$model
)
{
$msg
=
'不存在的记录'
;
...
...
@@ -267,6 +298,22 @@ class IssueCoinController extends BaseController
goto
doEnd
;
}
if
(
CoinIssueCoin
::
STATUS_CONFIRM
==
$status
)
{
if
(
CoinIssueCoin
::
STATUS_PEDDING
!=
$model
->
status
)
{
$msg
=
'该状态下禁止发行'
;
$code
=
-
1
;
goto
doEnd
;
}
}
if
(
CoinIssueCoin
::
STATUS_CANCEL
==
$status
)
{
if
(
'success'
!=
$model
->
transfer
->
pre_query_transaction
)
{
$msg
=
'该状态下禁止撤消'
;
$code
=
-
1
;
goto
doEnd
;
}
}
$record_model
=
CoinIssueChainRecord
::
find
()
->
where
([
'issue_coin_id'
=>
$id
])
->
one
();
if
(
false
==
$record_model
)
{
$msg
=
'交易记录不存在'
;
...
...
@@ -274,12 +321,6 @@ class IssueCoinController extends BaseController
goto
doEnd
;
}
if
(
$model
->
status
>
CoinIssueCoin
::
UN_AUDIT
)
{
$msg
=
'不允许取消的发行'
;
$code
=
-
1
;
goto
doEnd
;
}
$data
=
[
'status'
=>
$status
,
];
...
...
@@ -291,7 +332,7 @@ class IssueCoinController extends BaseController
goto
doEnd
;
}
if
(
$status
==
CoinIssueCoin
::
ALLOWED_ISSUE
)
{
if
(
$status
==
CoinIssueCoin
::
STATUS_CONFIRM
)
{
$record_model
->
pre_query_transaction
=
'success'
;
$record_model
->
update
();
}
...
...
@@ -302,106 +343,4 @@ class IssueCoinController extends BaseController
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
];
}
/**
* 手续费划转
* @return
*/
public
function
actionPayCharge
()
{
$issue_coin_model
=
CoinIssueCoin
::
find
()
->
select
(
'id'
)
->
where
([
'charge_pay'
=>
CoinIssueCoin
::
ALLOW_PAY
])
->
asArray
()
->
all
();
if
(
false
==
$issue_coin_model
)
{
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无手续费划转任务'
.
PHP_EOL
;
return
0
;
}
$issue_transfer
=
CoinIssueTransfer
::
find
()
->
where
([
'unissue'
=>
1
])
->
andWhere
([
'in'
,
'issue_coin_id'
,
ArrayHelper
::
getColumn
(
$issue_coin_model
,
'id'
)])
->
asArray
()
->
all
();
if
(
false
==
$issue_transfer
)
{
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无手续费划转任务'
.
PHP_EOL
;
return
0
;
}
$node
=
Yii
::
$app
->
params
[
'chain_nodes'
][
'STO'
];
$service
=
new
Chain33Service
(
$node
);
foreach
(
$issue_transfer
as
$val
)
{
$result
=
$service
->
sendTransaction
(
$val
[
'txhex'
]);
if
(
0
==
$result
[
'code'
])
{
$send_result
=
$result
[
'result'
];
$currentModel
=
CoinIssueTransfer
::
findOne
(
$val
[
'id'
]);
$currentModel
->
send_result
=
$send_result
;
$currentModel
->
msg
=
0
;
$currentModel
->
save
();
}
else
{
$currentModel
=
CoinIssueTransfer
::
findOne
(
$val
[
'id'
]);
$currentModel
->
msg
=
$result
[
'msg'
];
$currentModel
->
save
();
}
}
echo
date
(
'Y-m-d H:i:s'
)
.
'手续费划转任务完成'
.
PHP_EOL
;
return
0
;
}
/**
* 手续费划转状态确认
* @return
*/
public
function
actionPayChargeStatus
()
{
$unissue
=
-
1
;
$model
=
CoinIssueTransfer
::
find
()
->
where
([
'<>'
,
'send_result'
,
'0'
])
->
andWhere
([
'msg'
=>
'0'
])
->
asArray
()
->
all
();
if
(
empty
(
$model
))
{
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无需要确认的手续费划转状态'
.
PHP_EOL
;
return
0
;
}
$node
=
\Yii
::
$app
->
params
[
'chain_parallel'
][
'primary'
];
$service
=
new
Chain33Service
(
$node
);
foreach
(
$model
as
$val
)
{
$send_result
=
$val
[
'send_result'
];
$result
=
$service
->
QueryTransaction
(
$send_result
);
if
(
isset
(
$result
[
'result'
][
'actionName'
])
&&
'unknown'
==
$result
[
'result'
][
'actionName'
])
{
$query_result
=
'success'
;
$msg
=
'success'
;
goto
doEnd
;
}
else
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'ty'
])
&&
2
==
$result
[
'result'
][
'receipt'
][
'ty'
])
{
$query_result
=
'success'
;
$msg
=
'success'
;
goto
doEnd
;
}
else
{
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'logs'
]))
{
foreach
(
$result
[
'result'
][
'receipt'
][
'logs'
]
as
$log
)
{
if
(
isset
(
$log
[
'tyName'
])
&&
'LogErr'
==
$log
[
'tyName'
])
{
$msg
=
$log
[
'tyName'
];
break
;
}
}
}
else
{
$msg
=
$result
[
'msg'
];
}
$query_result
=
$result
[
'code'
];
goto
doEnd
;
}
doEnd
:
if
(
'success'
==
$msg
)
{
$unissue
=
0
;
$coin_issue_coin
=
CoinIssueCoin
::
find
()
->
where
([
'id'
=>
$val
[
'issue_coin_id'
]])
->
one
();
$coin_issue_coin
->
charge_pay
=
CoinIssueCoin
::
SUCCESS_PAY
;
$coin_issue_coin
->
save
();
}
$currentModel
=
CoinIssueTransfer
::
findOne
(
$val
[
'id'
]);
$currentModel
->
query_result
=
$query_result
;
if
(
$unissue
>
-
1
)
{
$currentModel
->
unissue
=
$unissue
;
}
$currentModel
->
msg
=
$msg
;
$currentModel
->
save
();
}
}
}
\ No newline at end of file
common/models/psources/CoinIssueCoin.php
View file @
6c46805e
...
...
@@ -9,28 +9,21 @@ class CoinIssueCoin extends CommonActiveRecord
{
const
UN_PAY
=
0
;
const
ALLOW_PAY
=
1
;
const
SUCCESS_PAY
=
2
;
const
STATUS_PEDDING
=
0
;
//待用户确认
const
STATUS_CANCEL
=
1
;
//用户点击撤消后的状态
const
STATUS_CANCEL_SUCCESS
=
2
;
//撤消成功
const
STATUS_CANCEL_FAILED
=
3
;
//撤消失败
const
STATUS_CONFIRM
=
4
;
//用户点击确认后的状态
const
STATUS_ALLOW
=
5
;
//开启人工审核,管理员后台点击通过后的状态 (未开启人工审核,跳过该状态)
const
STATUS_REFUSE
=
6
;
//开启人工审核,管理员后台点击拒绝后的状态 (未开启人工审核,跳过该状态)
const
STATUS_SUCCESS
=
7
;
//发行成功
const
STATUS_FAILED
=
8
;
//发行失败
const
UN_AUDIT
=
0
;
//允许发行(管理员)
const
ALLOW_ISSUE
=
1
;
//允许发行(管理员)
const
REFUSE_ISSUE
=
2
;
//拒绝发行
const
SUCCESS_ISSUE
=
3
;
//发行成功
const
FAIL_ISSUE
=
4
;
//发行失败
const
CANCEL_ISSUE
=
5
;
//已撤消
const
ALLOWED_ISSUE
=
6
;
//允许发行(申请者)
const
CANCEL_SUCCESS
=
7
;
//撤消成功
const
CANCEL_FAIL
=
8
;
//撤消失败
const
SUCCESS_PAY
=
2
;
const
STATUS_ADVANCE
=
0
;
//预发行,待确认
const
STATUS_PEDDING
=
1
;
//预发行成功,待用户确认
const
STATUS_CANCEL
=
2
;
//用户点击撤消后的状态
const
STATUS_CANCEL_SUCCESS
=
3
;
//撤消成功
const
STATUS_CANCEL_FAILED
=
4
;
//撤消失败
const
STATUS_CONFIRM
=
5
;
//用户点击确认后的状态
const
STATUS_ALLOW
=
6
;
//开启人工审核,管理员后台点击通过后的状态 (未开启人工审核,跳过该状态)
const
STATUS_REFUSE
=
7
;
//开启人工审核,管理员后台点击拒绝后的状态 (未开启人工审核,跳过该状态)
const
STATUS_SUCCESS
=
8
;
//发行成功
const
STATUS_FAILED
=
9
;
//(预)发行失败
const
TYPE_NO
=
0
;
//不是增发
const
TYPE_YES
=
1
;
//是增发
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
...
...
@@ -50,19 +43,29 @@ class CoinIssueCoin extends CommonActiveRecord
public
function
rules
()
{
return
[
[[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
,
'charge_unit_id'
,
'charge'
],
'required'
],
[[
'total'
,
'category'
,
'platform_id'
,
'chain_id'
,
'charge_unit_id'
],
'integer'
],
[[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'
type'
,
'
platform_id'
,
'chain_id'
,
'charge_unit_id'
,
'charge'
],
'required'
],
[[
'total'
,
'category'
,
'
type'
,
'
platform_id'
,
'chain_id'
,
'charge_unit_id'
],
'integer'
],
[
'introduction'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'symbol'
,
'string'
,
'length'
=>
[
1
,
6
]],
[
'msg'
,
'string'
,
'length'
=>
[
1
,
10
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
20
]],
#['status', 'in', 'range' => [1, 2, 0]],
[
'name'
,
'verfiyName'
],
[
'symbol'
,
'verfiySymbol'
],
#
['name', 'verfiyName'],
#
['symbol', 'verfiySymbol'],
[
'total'
,
'verfiyAmount'
]
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'type'
,
'platform_id'
,
'chain_id'
,
'charge_unit_id'
,
'charge'
],
self
::
SCENARIOS_UPDATE
=>
[
'status'
,
'msg'
],
self
::
SCENARIOS_CANCEL
=>
[
'status'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
verfiyName
(
$attribute
,
$params
)
{
$model
=
CoinIssueCoin
::
find
()
->
where
([
'name'
=>
$this
->
name
,
'platform_id'
=>
$this
->
platform_id
])
->
orderBy
(
'id desc'
)
->
one
();
...
...
@@ -92,21 +95,11 @@ class CoinIssueCoin extends CommonActiveRecord
$issue_record
=
CoinIssueRecord
::
find
()
->
where
([
'platform_id'
=>
$this
->
platform_id
])
->
sum
(
'total'
);
$issue_record
=
empty
(
$issue_record
)
?
0
:
$issue_record
;
if
(
$issue_record
+
$this
->
$attribute
>=
900
)
{
$this
->
addError
(
$attribute
,
'最大发行量900亿,目前已发行'
.
$issue_record
.
'亿'
);
$this
->
addError
(
$attribute
,
'最大发行量900亿,目前已发行'
.
$issue_record
.
'亿'
);
return
false
;
}
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
,
'charge_unit_id'
,
'charge'
],
self
::
SCENARIOS_UPDATE
=>
[
'status'
,
'msg'
],
self
::
SCENARIOS_CANCEL
=>
[
'status'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
attributeLabels
()
{
return
[
...
...
console/controllers/IssueChainTransferController.php
View file @
6c46805e
...
...
@@ -24,7 +24,7 @@ class IssueChainTransferController extends Controller
public
function
actionSendTransaction
(
$step
,
$type
)
{
if
(
0
==
$type
)
{
$status
=
CoinIssueCoin
::
ALLOWED_ISSUE
;
$status
=
CoinIssueCoin
::
STATUS_CONFIRM
;
$manual_review
=
Yii
::
$app
->
redis
->
get
(
'issue_chain_manual_review'
);
if
(
'close'
==
$manual_review
)
{
return
0
;
...
...
@@ -32,7 +32,7 @@ class IssueChainTransferController extends Controller
}
if
(
1
==
$type
)
{
$status
=
CoinIssueCoin
::
ALLOW_ISSUE
;
$status
=
CoinIssueCoin
::
STATUS_ALLOW
;
}
$issue_coin_model
=
CoinIssueCoin
::
find
()
->
select
(
'id'
)
->
where
([
'status'
=>
$status
])
->
asArray
()
->
all
();
...
...
@@ -145,36 +145,46 @@ class IssueChainTransferController extends Controller
foreach
(
$model
as
$val
)
{
if
(
1
==
$step
)
{
$result
=
$service
->
QueryTransaction
(
$val
->
pre_send_transaction
);
$column
=
'pre_query_transaction'
;
}
if
(
2
==
$step
)
{
$result
=
$service
->
QueryTransaction
(
$val
->
finish_send_transaction
);
$column
=
'finish_query_transaction'
;
}
if
(
isset
(
$result
[
'result'
][
'actionName'
])
&&
'unknown'
==
$result
[
'result'
][
'actionName'
])
{
$status
=
CoinIssueCoin
::
SUCCESS_ISSUE
;
if
(
1
==
$step
)
{
$status
=
CoinIssueCoin
::
STATUS_PEDDING
;
}
else
{
$status
=
CoinIssueCoin
::
STATUS_SUCCESS
;
}
$data
=
[
'finish_query_transaction'
=>
'success'
$column
=>
'success'
];
goto
doEnd
;
}
else
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'ty'
])
&&
2
==
$result
[
'result'
][
'receipt'
][
'ty'
])
{
$status
=
CoinIssueCoin
::
SUCCESS_ISSUE
;
if
(
1
==
$step
)
{
$status
=
CoinIssueCoin
::
STATUS_PEDDING
;
}
else
{
$status
=
CoinIssueCoin
::
STATUS_SUCCESS
;
}
$data
=
[
'finish_query_transaction'
=>
'success'
$column
=>
'success'
];
goto
doEnd
;
}
else
{
$status
=
CoinIssueCoin
::
FAIL_ISSUE
;
$status
=
CoinIssueCoin
::
STATUS_FAILED
;
if
(
isset
(
$result
[
'result'
][
'receipt'
][
'logs'
]))
{
foreach
(
$result
[
'result'
][
'receipt'
][
'logs'
]
as
$log
)
{
if
(
isset
(
$log
[
'tyName'
])
&&
'LogErr'
==
$log
[
'tyName'
])
{
$data
=
[
'finish_query_transaction'
=>
$log
[
'log'
]
$column
=>
$log
[
'log'
]
];
break
;
}
}
}
else
{
$data
=
[
'finish_query_transaction'
=>
$result
[
'msg'
]
$column
=>
$result
[
'msg'
]
];
}
goto
doEnd
;
...
...
@@ -186,29 +196,38 @@ class IssueChainTransferController extends Controller
]);
//查询后,交易失败
if
(
$status
==
CoinIssueCoin
::
FAIL_ISSUE
)
{
if
(
$status
==
CoinIssueCoin
::
STATUS_FAILED
)
{
CoinIssueCoin
::
updateAll
([
'status'
=>
$status
],
[
'id'
=>
$val
->
coin
->
id
,
]);
}
//查询后,交易成功
if
(
$status
==
CoinIssueCoin
::
SUCCESS_ISSUE
)
{
//1.1查询后,交易成功
if
(
1
==
$step
&&
$status
==
CoinIssueCoin
::
STATUS_PEDDING
)
{
CoinIssueCoin
::
updateAll
([
'status'
=>
$status
],
[
'id'
=>
$val
->
coin
->
id
,
]);
}
//1.2查询后,交易成功
if
(
2
==
$step
&&
$status
==
CoinIssueCoin
::
STATUS_SUCCESS
)
{
CoinIssueCoin
::
updateAll
([
'status'
=>
$status
,
'charge_pay'
=>
CoinIssueCoin
::
SUCCESS_PAY
],
[
'id'
=>
$val
->
coin
->
id
,
]);
$params
=
[
'name'
=>
$val
->
coin
->
name
,
'symbol'
=>
$val
->
coin
->
symbol
,
'introduction'
=>
$val
->
coin
->
introduction
,
'total'
=>
(
int
)
$val
->
coin
->
total
,
'price'
=>
isset
(
$val
->
coin
->
platform
->
issue_charge
)
?
(
int
)
$val
->
coin
->
platform
->
issue_charge
:
0
,
'category'
=>
(
int
)
$val
->
coin
->
category
,
'owner'
=>
$val
->
coin
->
owner
,
'platform_id'
=>
$val
->
coin
->
platform_id
,
'platform'
=>
$val
->
coin
->
chain
->
platform
];
$this
->
syncRecord
(
$params
);
$this
->
syncCoin
(
$params
);
if
(
CoinIssueCoin
::
TYPE_NO
==
$val
->
coin
->
type
)
{
$params
=
[
'name'
=>
$val
->
coin
->
name
,
'symbol'
=>
$val
->
coin
->
symbol
,
'introduction'
=>
$val
->
coin
->
introduction
,
'total'
=>
(
int
)
$val
->
coin
->
total
,
'price'
=>
isset
(
$val
->
coin
->
platform
->
issue_charge
)
?
(
int
)
$val
->
coin
->
platform
->
issue_charge
:
0
,
'category'
=>
(
int
)
$val
->
coin
->
category
,
'owner'
=>
$val
->
coin
->
owner
,
'platform_id'
=>
$val
->
coin
->
platform_id
,
'platform'
=>
$val
->
coin
->
chain
->
platform
];
$this
->
syncCoin
(
$params
);
}
}
}
echo
date
(
'Y-m-d H:i:s'
)
.
'查询完成,同步完成'
.
PHP_EOL
;
...
...
@@ -217,7 +236,7 @@ class IssueChainTransferController extends Controller
public
function
actionCancel
()
{
$issue_coin_model
=
CoinIssueCoin
::
find
()
->
where
([
'status'
=>
CoinIssueCoin
::
CANCEL_ISSUE
])
->
all
();
$issue_coin_model
=
CoinIssueCoin
::
find
()
->
where
([
'status'
=>
CoinIssueCoin
::
STATUS_CANCEL
])
->
all
();
if
(
false
==
$issue_coin_model
)
{
echo
date
(
'Y-m-d H:i:s'
)
.
'暂无需要撤消的发行'
.
PHP_EOL
;
return
0
;
...
...
@@ -229,7 +248,7 @@ class IssueChainTransferController extends Controller
//执行1.3构造
$result
=
$chain_service
->
CreateRawTokenRevokeTx
(
$val
->
symbol
,
$val
->
owner
);
if
(
null
!=
$result
[
'error'
])
{
$status
=
CoinIssueCoin
::
CANCEL_FAIL
;
$status
=
CoinIssueCoin
::
STATUS_CANCEL_FAILED
;
$data
=
[
'pre_query_transaction'
=>
'fail'
];
...
...
@@ -242,7 +261,7 @@ class IssueChainTransferController extends Controller
//执行1.3签名
$signRawTx
=
$chain_service
->
signRawTx
(
$privkey
,
$txHex
,
$expire
);
if
(
0
!=
$signRawTx
[
'code'
])
{
$status
=
CoinIssueCoin
::
CANCEL_FAIL
;
$status
=
CoinIssueCoin
::
STATUS_CANCEL_FAILED
;
$data
=
[
'pre_query_transaction'
=>
'fail'
];
...
...
@@ -251,13 +270,13 @@ class IssueChainTransferController extends Controller
//执行1.3交易
$result
=
$chain_service
->
sendTransaction
(
$signRawTx
[
'result'
]);
if
(
0
!=
$result
[
'code'
])
{
$status
=
CoinIssueCoin
::
CANCEL_FAIL
;
$status
=
CoinIssueCoin
::
STATUS_CANCEL_FAILED
;
$data
=
[
'pre_query_transaction'
=>
'fail'
];
goto
doEnd
;
}
$status
=
CoinIssueCoin
::
CANCEL_SUCCESS
;
$status
=
CoinIssueCoin
::
STATUS_
CANCEL_SUCCESS
;
$data
=
[
'pre_query_transaction'
=>
$result
[
'result'
]
];
...
...
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