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
c7303149
Commit
c7303149
authored
Jan 08, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上链通
parent
df373183
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
IssueCoinController.php
api/controllers/IssueCoinController.php
+19
-5
CoinIssueCoin.php
common/models/psources/CoinIssueCoin.php
+3
-0
IssueChainTransferController.php
console/controllers/IssueChainTransferController.php
+2
-2
No files found.
api/controllers/IssueCoinController.php
View file @
c7303149
...
...
@@ -56,7 +56,13 @@ class IssueCoinController extends BaseController
'charge'
=>
$coin_platform
->
issue_charge
,
];
$model
=
new
CoinIssueCoin
();
if
(
35
==
$platform_id
)
{
$result
[
'token_type'
]
=
isset
(
$result
[
'token_type'
])
?
$result
[
'token_type'
]
:
0
;
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE_MALL
);
}
else
{
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE
);
}
$model
->
load
(
$result
,
''
);
if
(
!
$model
->
validate
())
{
$msg
=
$model
->
errors
;
...
...
@@ -95,9 +101,6 @@ class IssueCoinController extends BaseController
goto
doEnd
;
}
$model
=
new
CoinIssueCoin
();
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE
);
if
(
!
Yii
::
$app
->
request
->
isPost
)
{
$msg
=
'错误的请求方式'
;
$code
=
-
1
;
...
...
@@ -118,9 +121,11 @@ class IssueCoinController extends BaseController
$code
=
-
1
;
goto
doEnd
;
}
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$name
[
$val
]
=
isset
(
$result
[
$val
])
?
$result
[
$val
]
:
''
;
}
$result
=
[
'name'
=>
isset
(
$result
[
'name'
])
?
$result
[
'name'
]
:
''
,
'name'
=>
$name
,
'symbol'
=>
isset
(
$result
[
'symbol'
])
?
strtoupper
(
$result
[
'symbol'
])
:
''
,
'total'
=>
isset
(
$result
[
'total'
])
?
$result
[
'total'
]
:
''
,
'owner'
=>
isset
(
$result
[
'owner'
])
?
$result
[
'owner'
]
:
''
,
...
...
@@ -132,6 +137,13 @@ class IssueCoinController extends BaseController
'charge_unit'
=>
isset
(
$result
[
'charge_unit'
])
?
$result
[
'charge_unit'
]
:
''
,
'charge'
=>
(
CoinIssueCoin
::
TYPE_NO
==
$result
[
'type'
])
?
$coin_platform
->
issue_charge
:
0
,
];
$model
=
new
CoinIssueCoin
();
if
(
35
==
$platform_id
)
{
$result
[
'token_type'
]
=
isset
(
$result
[
'token_type'
])
?
$result
[
'token_type'
]
:
0
;
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE_MALL
);
}
else
{
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE
);
}
$model
->
load
(
$result
,
''
);
if
(
!
$model
->
save
())
{
$msg
=
$model
->
errors
;
...
...
@@ -192,6 +204,7 @@ class IssueCoinController extends BaseController
$models
=
$query
->
offset
((
$page
-
1
)
*
$size
)
->
limit
(
$size
)
->
all
();
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
$size
]);
foreach
(
$models
as
&
$val
)
{
$val
->
name
=
isset
(
$val
->
name
[
'en-US'
])
?
$val
->
name
[
'en-US'
]
:
''
;
$val
->
chain_id
=
$val
->
chain
->
platform
;
$val
->
total
=
(
int
)
$val
->
total
*
1e4
;
}
...
...
@@ -231,6 +244,7 @@ class IssueCoinController extends BaseController
$code
=
-
1
;
goto
doEnd
;
}
$data
->
name
=
$data
->
name
[
'en-US'
];
$data
->
total
=
(
int
)
$data
->
total
*
1e4
;
$data
->
chain_name
=
$data
->
chain
->
platform
;
$data
->
issue_charge
=
rtrim
(
sprintf
(
'%.3f'
,
floatval
(
$data
->
charge
)),
'0'
);
...
...
common/models/psources/CoinIssueCoin.php
View file @
c7303149
...
...
@@ -32,6 +32,7 @@ class CoinIssueCoin extends CommonActiveRecord
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
const
SCENARIOS_CANCEL
=
'cancel'
;
const
SCENARIOS_CREATE_MALL
=
'create_mall'
;
public
static
function
getDb
()
{
...
...
@@ -51,6 +52,7 @@ class CoinIssueCoin extends CommonActiveRecord
[[
'introduction'
,
'charge_unit'
],
'string'
,
'length'
=>
[
1
,
20
]],
[
'symbol'
,
'string'
,
'length'
=>
[
1
,
6
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'token_type'
,
'safe'
],
#['status', 'in', 'range' => [1, 2, 0]],
[
'name'
,
'verfiyName'
],
[
'symbol'
,
'verfiySymbol'
],
...
...
@@ -62,6 +64,7 @@ class CoinIssueCoin extends CommonActiveRecord
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'type'
,
'platform_id'
,
'chain_id'
,
'charge_unit'
,
'charge'
],
self
::
SCENARIOS_CREATE_MALL
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'type'
,
'platform_id'
,
'chain_id'
,
'token_type'
],
self
::
SCENARIOS_UPDATE
=>
[
'status'
],
self
::
SCENARIOS_CANCEL
=>
[
'status'
],
];
...
...
console/controllers/IssueChainTransferController.php
View file @
c7303149
...
...
@@ -373,8 +373,8 @@ class IssueChainTransferController extends Controller
if
(
false
==
$model_coin
)
{
$model
=
new
Coin
();
$model
->
name
=
$params
[
'symbol'
];
$model
->
sid
=
$params
[
'name'
]
;
$model
->
nickname
=
[
'ja'
=>
''
,
'en-US'
=>
''
,
'zh-CN'
=>
'
'
];
$model
->
sid
=
isset
(
$params
[
'name'
][
'en-US'
])
?
$params
[
'name'
][
'en-US'
]
:
''
;
$model
->
nickname
=
$params
[
'name
'
];
$model
->
platform
=
$params
[
'platform'
];
$model
->
publish_count
=
$params
[
'total'
]
*
1e4
;
$model
->
chain
=
'BTY'
;
...
...
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