Commit cf355d7f authored by rlgy's avatar rlgy

删除旧接口

parent 123482d1
......@@ -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
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment