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
616d9c29
Commit
616d9c29
authored
Dec 20, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
钱包支持链信息
parent
92c03ec9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
SupportedChainController.php
api/controllers/SupportedChainController.php
+41
-0
CoinSupportedChain.php
common/models/psources/CoinSupportedChain.php
+51
-0
No files found.
api/controllers/SupportedChainController.php
0 → 100644
View file @
616d9c29
<?php
namespace
api\controllers
;
use
Yii
;
use
api\base\BaseController
;
use
common\models\psources\CoinSupportedChain
;
class
SupportedChainController
extends
BaseController
{
public
function
actionIndex
()
{
$header
=
Yii
::
$app
->
request
->
headers
;
$platform_id
=
$header
[
'FZM-PLATFORM-ID'
]
??
null
;
$data
=
null
;
if
(
false
==
$platform_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
goto
doEnd
;
}
$supported_chain_model
=
CoinSupportedChain
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
all
();
if
(
false
==
$supported_chain_model
)
{
$msg
=
'success'
;
$code
=
0
;
goto
doEnd
;
}
$data
=
[];
foreach
(
$supported_chain_model
as
$key
=>
&
$val
)
{
$data
[]
=
!
empty
(
$val
->
coin
)
?
$val
->
coin
:
''
;
}
$msg
=
'success'
;
$code
=
0
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
common/models/psources/CoinSupportedChain.php
0 → 100644
View file @
616d9c29
<?php
namespace
common\models\psources
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
CoinSupportedChain
extends
BaseActiveRecord
{
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%coin_supported_chain}}'
;
}
public
function
rules
()
{
return
[
[[
'coin_id'
,
'platform_id'
],
'required'
],
[[
'coin_id'
,
'platform_id'
],
'integer'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'coin_id'
,
'platform_id'
],
self
::
SCENARIOS_UPDATE
=>
[
'id'
,
'coin_id'
,
'platform_id'
]
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
attributes
()
{
return
array_merge
(
parent
::
attributes
(),
[
'coins'
]);
}
public
function
getCoin
()
{
return
$this
->
hasOne
(
Coin
::
className
(),
[
'id'
=>
'coin_id'
])
->
select
(
'name as chain'
);
}
}
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