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
b9e90dbd
Commit
b9e90dbd
authored
Oct 24, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复已知问题
parent
700cce58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
IssueCoinController.php
api/controllers/IssueCoinController.php
+3
-2
IssueCoinController.php
console/controllers/IssueCoinController.php
+22
-0
No files found.
api/controllers/IssueCoinController.php
View file @
b9e90dbd
...
...
@@ -89,8 +89,9 @@ class IssueCoinController extends BaseController
$data
=
null
;
$header
=
Yii
::
$app
->
request
->
headers
;
$platform_id
=
$header
[
'FZM-PLATFORM-ID'
]
??
null
;
$address
=
Yii
::
$app
->
request
->
get
(
'address'
,
''
);
if
(
empty
(
$platform_id
))
{
if
(
empty
(
$platform_id
)
||
empty
(
$address
)
)
{
$msg
=
'缺少必要的参数'
;
$code
=
-
1
;
goto
doEnd
;
...
...
@@ -101,7 +102,7 @@ class IssueCoinController extends BaseController
$query
=
CoinIssueCoin
::
find
()
->
select
(
'id, name, total, create_time, status, chain_id'
)
->
where
([
'
platform_id'
=>
$platform_id
])
->
where
([
'
owner'
=>
$address
])
->
orderBy
(
'create_time desc'
);
$countQuery
=
clone
$query
;
...
...
console/controllers/IssueCoinController.php
View file @
b9e90dbd
...
...
@@ -2,6 +2,7 @@
namespace
console\controllers
;
use
common\models\psources\Coin
;
use
common\models\psources\CoinIssueCoin
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
...
...
@@ -44,6 +45,9 @@ class IssueCoinController extends Controller
$result
=
$chain_service
->
createRawTokenPreCreateTx
(
$params
);
if
(
null
==
$result
[
'error'
]
&&
false
==
$result
[
'code'
])
{
$status
=
CoinIssueCoin
::
SUCCESS_ISSUE
;
$params
[
'platform'
]
=
$issue_coin
->
chain
->
platform
;
$this
->
syncCoin
(
$params
);
}
else
{
$status
=
CoinIssueCoin
::
FAIL_ISSUE
;
}
...
...
@@ -94,6 +98,8 @@ class IssueCoinController extends Controller
$result
=
$chain_service
->
createRawTokenPreCreateTx
(
$params
);
if
(
null
==
$result
[
'error'
]
&&
false
==
$result
[
'code'
])
{
$status
=
CoinIssueCoin
::
SUCCESS_ISSUE
;
$params
[
'platform'
]
=
$issue_coin
->
chain
->
platform
;
$this
->
syncCoin
(
$params
);
}
else
{
$status
=
CoinIssueCoin
::
FAIL_ISSUE
;
}
...
...
@@ -111,4 +117,19 @@ class IssueCoinController extends Controller
echo
date
(
'Y-m-d H:i:s'
)
.
'发行成功'
.
PHP_EOL
;
return
0
;
}
public
function
syncCoin
(
$params
=
[])
{
$model_coin
=
Coin
::
find
()
->
where
([
'name'
=>
$params
[
'name'
],
'platform'
=>
$params
[
'platform'
]])
->
one
();
if
(
false
==
$model_coin
)
{
$model
=
new
Coin
();
$model
->
name
=
$params
[
'name'
];
$model
->
sid
=
$params
[
'symbol'
];
$model
->
platform
=
$params
[
'platform'
];
$model
->
introduce
[
'zh-CN'
]
=
$params
[
'introduction'
];
$model
->
chain
=
'BTY'
;
$model
->
treaty
=
1
;
$model
->
save
();
}
}
}
\ No newline at end of file
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