Commit 9da8c83d authored by ZhuChunYang's avatar ZhuChunYang

update

parent 69907aaa
...@@ -109,6 +109,64 @@ class CoinController extends BaseController ...@@ -109,6 +109,64 @@ class CoinController extends BaseController
} }
/** /**
* 获取推介币种列表(新)
*/
public function actionGetNewRecList()
{
$request = Yii::$app->request;
$page = $request->post('page', 1);
$limit = $request->post('limit', 999);
$platform_id = $request->post('platform_id', 1);//默认币钱包
$recommend = $request->post('recommend', '');
$condition = ['platform_id' => $platform_id];
if ($recommend) {
$condition['recommend'] = $recommend;
}
$select = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain'];
$datas = CoinRecommend::getList($page, $limit, $condition, [], $select);
//获取详细信息
$coin_recommends = &$datas['data'];
if (!empty($coin_recommends)) {
$coin_ids = array_column($coin_recommends, 'cid');
//获取币种信息
$coin_infos = Coin::getCoinInfoByIds($coin_ids, $select, 'id');
//获取行情信息
$coin_names = array_column($coin_infos, 'name');
$coin_names = array_merge($coin_names, array_column($coin_infos, 'chain'));
$coin_quotations = ExchangeBusiness::getQuatationByNames($coin_names);
if ($coin_infos) {
array_shift($select);
foreach ($coin_recommends as $key => &$value) {
$temp_key = $coin_infos[$value['cid']]['name'];
foreach ($select as $item) {
$value[$item] = $coin_infos[$value['cid']][$item];
if ($value['platform_id'] != 2) {
//国盾币不需要行情
$value['low'] = $coin_quotations[$temp_key]['low'];
$value['high'] = $coin_quotations[$temp_key]['high'];
$value['last'] = $coin_quotations[$temp_key]['last'];
$value['rmb'] = $coin_quotations[$temp_key]['rmb'];
} else {
$value['low'] = 0;
$value['high'] = 0;
$value['last'] = 0;
$value['rmb'] = 0;
}
}
$value['id'] = $value['cid'];
$value['sid'] = ucfirst($value['sid']);
$value['chain_quotation'] = $coin_quotations[$coin_infos[$value['cid']]['chain']];
unset($value['create_time'], $value['update_time'], $value['cid']);
}
unset($key, $value);
}
}
return $datas;
}
/**
* 矿工费获取 * 矿工费获取
* *
* 根据name获取 * 根据name获取
......
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