Commit 2a5dfba3 authored by shajiaiming's avatar shajiaiming

fix

parent 038e8419
...@@ -15,6 +15,7 @@ use common\business\Chain33Business; ...@@ -15,6 +15,7 @@ use common\business\Chain33Business;
use common\business\CoinBusiness; use common\business\CoinBusiness;
use common\business\ExchangeBusiness; use common\business\ExchangeBusiness;
use common\models\psources\Coin; use common\models\psources\Coin;
use common\models\psources\CoinCurrency;
use common\models\psources\CoinPlatformWithHold; use common\models\psources\CoinPlatformWithHold;
use common\models\psources\CoinRecommend; use common\models\psources\CoinRecommend;
use common\models\psources\MinerFee; use common\models\psources\MinerFee;
...@@ -244,6 +245,12 @@ class CoinController extends BaseController ...@@ -244,6 +245,12 @@ class CoinController extends BaseController
foreach ($chains as $key => $value) { foreach ($chains as $key => $value) {
$chain_quotation[$value] = ExchangeBusiness::getquatation($value); $chain_quotation[$value] = ExchangeBusiness::getquatation($value);
} }
$currency = CoinCurrency::find()->where(['pj_id' => $this->currency_id])->one();
if (false != $currency) {
$last = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $currency->symbol, 'last');
}
foreach ($result['data'] as $key => &$value) { foreach ($result['data'] as $key => &$value) {
if (!isset($value['nickname']) || empty($value['nickname'])) continue; if (!isset($value['nickname']) || empty($value['nickname'])) continue;
$nickname = json_decode($value['nickname'], true); $nickname = json_decode($value['nickname'], true);
...@@ -253,6 +260,7 @@ class CoinController extends BaseController ...@@ -253,6 +260,7 @@ class CoinController extends BaseController
$value['chain_quotation'] = $chain_quotation[$value['chain']] ?: null; $value['chain_quotation'] = $chain_quotation[$value['chain']] ?: null;
$value['chain_rmb'] = isset($value['chain_quotation']['rmb']) ? $value['chain_quotation']['rmb'] : 0; $value['chain_rmb'] = isset($value['chain_quotation']['rmb']) ? $value['chain_quotation']['rmb'] : 0;
$value['chain_usd'] = isset($value['chain_quotation']['usd']) ? $value['chain_quotation']['usd'] : 0; $value['chain_usd'] = isset($value['chain_quotation']['usd']) ? $value['chain_quotation']['usd'] : 0;
$value['country_rate'] = (false == $currency) ? '' : (float)sprintf("%0.4f", $last[0] * $value['rmb']);
} }
return $result; return $result;
} }
...@@ -266,8 +274,8 @@ class CoinController extends BaseController ...@@ -266,8 +274,8 @@ class CoinController extends BaseController
$platform = isset($params['platform']) ? $params['platform'] : ''; $platform = isset($params['platform']) ? $params['platform'] : '';
$platform_id = isset($params['platform_id']) ? $params['platform_id'] : ''; $platform_id = isset($params['platform_id']) ? $params['platform_id'] : '';
$page = isset($params['page']) ? $params['page'] : 1; $page = empty($params['page']) ? 1 : $params['page'];
$size = isset($params['size']) ? $params['size'] : 10; $size = empty($params['size']) ? 10 : $params['size'];
if (false == $platform_id) { if (false == $platform_id) {
$msg = '参数错误'; $msg = '参数错误';
...@@ -320,7 +328,7 @@ class CoinController extends BaseController ...@@ -320,7 +328,7 @@ class CoinController extends BaseController
'currentPage' => $page, 'currentPage' => $page,
] ]
]; ];
$code = 1; $code = 0;
$msg = 'success'; $msg = 'success';
doEnd : doEnd :
......
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