Commit 41d0099a authored by shajiaiming's avatar shajiaiming

Merge branch 'master' into feature/optimize

parents 76bf604c f6fd63ce
...@@ -245,11 +245,15 @@ class CoinController extends BaseController ...@@ -245,11 +245,15 @@ 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);
} }
$last[] = 1;
$currency = CoinCurrency::find()->where(['pj_id' => $this->currency_id])->one(); $currency = CoinCurrency::find()->where(['pj_id' => $this->currency_id])->one();
if (false != $currency) { if (false != $currency) {
if (1111 == $this->currency_id) {
$last[] = 1;
} else {
$last = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $currency->symbol, 'last'); $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;
...@@ -260,7 +264,7 @@ class CoinController extends BaseController ...@@ -260,7 +264,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['chain_country_rate'] = (float)sprintf("%0.4f", $last[0] * $value['chain_rmb']); $value['chain_country_rate'] = (float)sprintf("%0.4f", $last[0] * $value['chain_rmb']);
$value['country_rate'] = (false == $currency) ? $value['chain_rmb'] : (float)sprintf("%0.4f", $last[0] * $value['rmb']); $value['country_rate'] = (false == $currency) ? $value['chain_rmb'] : (float)sprintf("%0.4f", $last[0] * $value['rmb']);
} }
return $result; return $result;
......
...@@ -357,9 +357,13 @@ class TickerController extends BaseController ...@@ -357,9 +357,13 @@ class TickerController extends BaseController
$msg = '请求参数错误!'; $msg = '请求参数错误!';
goto doEnd; goto doEnd;
} }
$currency = CoinSupportedCurrency::find()->where(['platform_id' => $platform_id])->all(); $currency = CoinSupportedCurrency::find()->where(['platform_id' => $platform_id])->orderBy('sort')->all();
foreach ($currency as $val) { foreach ($currency as $val) {
if (1111 == $val->currency->pj_id) {
$rate = (string)1;
} else {
list($rate) = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $val->currency->symbol, 'last'); list($rate) = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $val->currency->symbol, 'last');
}
$val->pj_id = $val->currency->pj_id; $val->pj_id = $val->currency->pj_id;
$val->pj_name = $val->currency->pj_name; $val->pj_name = $val->currency->pj_name;
$val->pj_symbol = $val->currency->pj_symbol; $val->pj_symbol = $val->currency->pj_symbol;
......
...@@ -38,6 +38,7 @@ class TickerController extends Controller ...@@ -38,6 +38,7 @@ class TickerController extends Controller
$currency_model = CoinSupportedCurrency::find()->groupBy('currency_id')->all(); $currency_model = CoinSupportedCurrency::find()->groupBy('currency_id')->all();
$curl = new Curl(); $curl = new Curl();
foreach ($currency_model as $val) { foreach ($currency_model as $val) {
if (1111 == $val->currency->pj_id) continue;
go(function () use ($val, $curl) { go(function () use ($val, $curl) {
\Co::sleep(0.5); \Co::sleep(0.5);
$response = $curl->setPostParams([ $response = $curl->setPostParams([
......
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