Commit 7fd2bcba authored by rlgy's avatar rlgy

推介币种返回信息格式更改

parent 3ab7f39a
......@@ -49,7 +49,7 @@ class CoinController extends BaseController
$page = $request->post('page', 1);
$limit = $request->post('limit', 999);
$condition = [['recommend' => '1']];
return ExchangeBusiness::getApiListForIndex($condition);
return ExchangeBusiness::getApiListForIndex($page, $limit, $condition);
}
/**
......@@ -84,7 +84,7 @@ class CoinController extends BaseController
{
$names = Yii::$app->request->post('names');
$condition = [['in', 'name', $names]];
return ExchangeBusiness::getApiListForIndex($condition);
return ExchangeBusiness::getApiListForIndex(1, 999, $condition);
}
/**
......
......@@ -118,9 +118,10 @@ class ExchangeBusiness
* @param array $condition 需要的币种sid列表
* @return array
*/
public static function getApiListForIndex($condition = [])
public static function getApiListForIndex($page = 1, $limit = 999, $condition = [])
{
$rows = Coin::getSelectList(1, 999, ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain'], $condition);
$rows = Coin::getSelectList($page, $limit, ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain'], $condition);
$count = $rows['count'] ?? 0;
if ($rows['count'] > 0) {
$rows = $rows['data'];
foreach ($rows as $key => $row) {
......@@ -147,7 +148,7 @@ class ExchangeBusiness
}
$rows[$key] = array_merge($rows[$key], $quotation);
}
return $rows;
return ['code' => 0, 'count' => $count, 'data' => $rows];
}
return [];
}
......
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