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
37a3766a
Commit
37a3766a
authored
Nov 08, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
d50da49e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
2 deletions
+78
-2
IssueCoinController.php
api/controllers/IssueCoinController.php
+78
-2
No files found.
api/controllers/IssueCoinController.php
View file @
37a3766a
...
...
@@ -31,6 +31,63 @@ class IssueCoinController extends BaseController
exit
;
}
public
function
actionValidate
()
{
$data
=
null
;
$header
=
Yii
::
$app
->
request
->
headers
;
$platform_id
=
$header
[
'FZM-PLATFORM-ID'
]
??
null
;
if
(
empty
(
$platform_id
))
{
$msg
=
'缺少必要的参数'
;
$code
=
-
1
;
goto
doEnd
;
}
$coin_platform
=
CoinPlatform
::
findOne
(
$platform_id
);
if
(
false
==
$coin_platform
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
goto
doEnd
;
}
$result
=
Yii
::
$app
->
request
->
post
();
$chain_id
=
isset
(
$result
[
'chain_id'
])
?
$result
[
'chain_id'
]
:
0
;
if
(
false
==
$chain_id
)
{
$msg
=
'不存在的链'
;
$code
=
-
1
;
goto
doEnd
;
}
$result
=
[
'name'
=>
isset
(
$result
[
'name'
])
?
$result
[
'name'
]
:
''
,
'symbol'
=>
isset
(
$result
[
'symbol'
])
?
strtoupper
(
$result
[
'symbol'
])
:
''
,
'total'
=>
isset
(
$result
[
'total'
])
?
$result
[
'total'
]
:
''
,
'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'
]
:
''
,
'charge'
=>
$coin_platform
->
issue_charge
,
];
$model
=
new
CoinIssueCoin
();
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE
);
$model
->
load
(
$result
,
''
);
if
(
!
$model
->
validate
())
{
$msg
=
$model
->
errors
;
$code
=
-
1
;
goto
doEnd
;
}
$msg
=
'ok'
;
$code
=
0
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
/**
* 发行申请
* @return array
...
...
@@ -70,7 +127,13 @@ 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'
]
:
''
,
...
...
@@ -95,6 +158,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
];
}
...
...
@@ -200,7 +277,6 @@ class IssueCoinController extends BaseController
$id
=
isset
(
$params
[
'id'
])
?
(
int
)
$params
[
'id'
]
:
0
;
$pre_create_tx
=
isset
(
$params
[
'pre_create_tx'
])
?
$params
[
'pre_create_tx'
]
:
''
;
$pre_send_transaction
=
isset
(
$params
[
'pre_send_transaction'
])
?
$params
[
'pre_send_transaction'
]
:
''
;
if
(
false
==
$id
||
false
==
$pre_create_tx
||
false
==
$pre_send_transaction
)
{
$msg
=
'缺少必要的参数'
;
$code
=
-
1
;
...
...
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