Commit 41d0099a authored by shajiaiming's avatar shajiaiming

Merge branch 'master' into feature/optimize

parents 76bf604c f6fd63ce
......@@ -245,10 +245,14 @@ class CoinController extends BaseController
foreach ($chains as $key => $value) {
$chain_quotation[$value] = ExchangeBusiness::getquatation($value);
}
$last[] = 1;
$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');
if (1111 == $this->currency_id) {
$last[] = 1;
} else {
$last = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $currency->symbol, 'last');
}
}
foreach ($result['data'] as $key => &$value) {
......@@ -260,7 +264,7 @@ class CoinController extends BaseController
$value['chain_quotation'] = $chain_quotation[$value['chain']] ?: null;
$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_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']);
}
return $result;
......
......@@ -357,9 +357,13 @@ class TickerController extends BaseController
$msg = '请求参数错误!';
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) {
list($rate) = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $val->currency->symbol, 'last');
if (1111 == $val->currency->pj_id) {
$rate = (string)1;
} else {
list($rate) = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $val->currency->symbol, 'last');
}
$val->pj_id = $val->currency->pj_id;
$val->pj_name = $val->currency->pj_name;
$val->pj_symbol = $val->currency->pj_symbol;
......
......@@ -38,6 +38,7 @@ class TickerController extends Controller
$currency_model = CoinSupportedCurrency::find()->groupBy('currency_id')->all();
$curl = new Curl();
foreach ($currency_model as $val) {
if (1111 == $val->currency->pj_id) continue;
go(function () use ($val, $curl) {
\Co::sleep(0.5);
$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