Commit f6ae9cf5 authored by shajiaiming's avatar shajiaiming

fxi

parent 2a5dfba3
......@@ -275,7 +275,7 @@ class CoinController extends BaseController
$platform_id = isset($params['platform_id']) ? $params['platform_id'] : '';
$page = empty($params['page']) ? 1 : $params['page'];
$size = empty($params['size']) ? 10 : $params['size'];
$limit = empty($params['limit']) ? 10 : $params['limit'];
if (false == $platform_id) {
$msg = '参数错误';
......@@ -301,7 +301,8 @@ class CoinController extends BaseController
$query->andWhere(['or', ['like', 'address', $keyword], ['like', 'name', $keyword], ['like', 'nickname', $keyword]]);
}
$data = $query->offset(($page - 1) * $size)->limit($size)->asArray()->all();
$data = $query->offset(($page - 1) * $limit)->limit($limit)->asArray()->all();
$count = $query->count();
if (false != $data) {
$chains = array_unique(array_column($data, 'chain'));
$chain_quotation = [];
......@@ -318,21 +319,11 @@ class CoinController extends BaseController
$value['chain_usd'] = isset($value['chain_quotation']['usd']) ? $value['chain_quotation']['usd'] : 0;
}
}
$countQuery = clone $query;
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => $size]);
$data = [
'list' => $data,
'page' => [
'pageCount' => $pages->pageCount,
'pageSize' => $size,
'currentPage' => $page,
]
];
$code = 0;
$msg = 'success';
doEnd :
return ['code' => $code, 'data' => $data, 'msg' => $msg];
return ['code' => $code, 'data' => $data, 'count' => $count];
}
/**
......
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