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
cf355d7f
Commit
cf355d7f
authored
Jun 19, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除旧接口
parent
123482d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
63 deletions
+0
-63
CoinController.php
api/controllers/CoinController.php
+0
-63
No files found.
api/controllers/CoinController.php
View file @
cf355d7f
...
...
@@ -22,69 +22,6 @@ use common\business\CoinBusiness;
class
CoinController
extends
BaseController
{
/**
* 获取行情列表,可筛选可分页
*
* @var int $id coin.id
* @var string $name coin.name
* @var int $page 第几页
* @var int $limit 多少条数据
*
* 返回data数组格式[coin.id coin.name coin.nickname coin.quotation]
* coin.quatation=>['price' => '', 'dollar' => '', 'btc' => '', 'high' => '', 'low' => '', 'change' => '']
* 对应:价格 价格美元 价格btc 最高价 最低价 涨幅(跌幅)
*/
public
function
actionQuotationList
()
{
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
10
);
$condition
=
[];
$post
=
$request
->
post
();
//过滤字段
$post
=
array_filter
(
$post
,
function
(
$item
,
$key
)
{
if
(
$key
==
'id'
&&
is_numeric
(
$item
))
{
return
true
;
}
return
$key
;
},
ARRAY_FILTER_USE_BOTH
);
//id筛选
if
(
isset
(
$post
[
'id'
]))
{
if
(
is_array
(
$post
[
'id'
]))
{
$condition
[]
=
[
'in'
,
'id'
,
$post
[
'id'
]];
}
elseif
(
is_numeric
(
$post
[
'id'
]))
{
$condition
[]
=
[
'id'
=>
$post
[
'id'
]];
}
}
//名称模糊查询
if
(
isset
(
$post
[
'name'
]))
{
if
(
is_array
(
$post
[
'name'
]))
{
$condition
[]
=
[
'in'
,
'name'
,
$post
[
'name'
]];
}
else
{
$condition
[]
=
[
'like'
,
'name'
,
$post
[
'name'
]];
}
}
//昵称模糊查询
if
(
isset
(
$post
[
'nickname'
]))
{
$condition
[]
=
[
'like'
,
'nickname'
,
$post
[
'nickname'
]];
}
//平台筛选
if
(
isset
(
$post
[
'platform'
]))
{
$condition
[]
=
[
'platform'
=>
$post
[
'platform'
]];
}
$data
=
CoinBusiness
::
getApiList
(
$page
,
$limit
,
$condition
);
//sid大写返回
foreach
(
$data
[
'data'
]
as
$key
=>
$item
)
{
$data
[
'data'
][
$key
][
'sid'
]
=
ucfirst
(
$item
[
'sid'
]);
}
Yii
::
$app
->
response
->
data
=
$data
;
}
/**
* 单币种按照id查询
* @return array|null|\yii\db\ActiveRecord
*/
...
...
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