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
fabc54f0
Commit
fabc54f0
authored
Jan 04, 2019
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4f7460d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
ServiceController.php
api/controllers/ServiceController.php
+16
-3
No files found.
api/controllers/ServiceController.php
View file @
fabc54f0
...
...
@@ -11,6 +11,7 @@ use api\base\BaseController;
use
common\business\ExchangeBusiness
;
use
common\models\psources\Coin
;
use
common\models\psources\CoinRecommend
;
use
common\service\coin\CoinFactory
;
use
Yii
;
...
...
@@ -31,10 +32,12 @@ class ServiceController extends BaseController
{
$request
=
Yii
::
$app
->
request
;
$coinItems
=
$request
->
post
(
'names'
);
if
(
!
$coinItems
){
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'币种不能为空'
];
}
if
(
!
is_array
(
$coinItems
)){
$coinItems
=
[
$coinItems
];
}
$tickerData
=
[];
if
(
$coinItems
){
foreach
(
$coinItems
as
$item
){
...
...
@@ -62,8 +65,6 @@ class ServiceController extends BaseController
}
return
[
'code'
=>
0
,
'data'
=>
$tickerData
,
'msg'
=>
'行情获取成功'
];
}
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'币种不能为空'
];
}
public
function
actionCoinIndex
()
...
...
@@ -80,4 +81,16 @@ class ServiceController extends BaseController
$rows
=
Coin
::
getSelectList
(
1
,
999
,
$fields
,[[
'in'
,
'name'
,
$coinItems
]]);
return
[
'code'
=>
0
,
'data'
=>
$rows
,
'msg'
=>
'币种列表获取成功'
];
}
public
function
actionCoinRecommendList
()
{
$recommend_list
=
CoinRecommend
::
find
()
->
select
(
'cid'
)
->
where
([
'platform_id'
=>
6
])
->
all
();
if
(
$recommend_list
){
$coin_ids
=
array_column
(
$recommend_list
,
'cid'
);
$coin_items
=
Coin
::
find
()
->
select
(
'name'
)
->
where
([
'in'
,
'id'
,
$coin_ids
])
->
all
();
$coin_names
=
array_column
(
$coin_items
,
'name'
);
return
[
'code'
=>
0
,
'data'
=>
$coin_names
,
'msg'
=>
'推荐币种获取成功'
];
}
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'推荐币种获取成功'
];
}
}
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