Commit 5e3cef4f authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !494
parents 6342a782 b5cdc626
...@@ -284,6 +284,12 @@ class ExchangeBusiness ...@@ -284,6 +284,12 @@ class ExchangeBusiness
goto doEnd; goto doEnd;
} }
if (in_array(strtoupper($tag), ['BTY','YCC'])) {
$exchange = ExchangeFactory::createExchange("Superx");
$quotation = $exchange->getTicker($tag, 'USDT');
goto doEnd;
}
if (in_array(strtoupper($tag), ['CIC', 'MC'])) { if (in_array(strtoupper($tag), ['CIC', 'MC'])) {
$exchange = ExchangeFactory::createExchange("Ztb"); $exchange = ExchangeFactory::createExchange("Ztb");
$quotation = $exchange->getTicker(strtoupper($tag), 'USDT'); $quotation = $exchange->getTicker(strtoupper($tag), 'USDT');
...@@ -442,7 +448,7 @@ class ExchangeBusiness ...@@ -442,7 +448,7 @@ class ExchangeBusiness
$exchange = ExchangeFactory::createExchange("Rate"); $exchange = ExchangeFactory::createExchange("Rate");
$rate = $exchange->getTicker("CNY", "USD"); $rate = $exchange->getTicker("CNY", "USD");
$cny_usd_rate = 1 / $rate['last']; $cny_usd_rate = 1 / $rate['last'];
$quotation['rmb'] = (float)sprintf("%0.4f", $quotation['last'] / $cny_usd_rate); $quotation['rmb'] = isset($quotation['rmb']) ? $quotation['rmb'] : (float)sprintf("%0.4f", $quotation['last'] / $cny_usd_rate);
if (in_array(strtoupper($tag), ['FOLI', 'CIC', 'MC', 'KPC8', 'BBD', 'BVA', 'DAG', 'BNC', 'BNB', 'GHP', 'DRA', 'ETC', 'PAX', 'STH', 'XJH', 'SFT', 'TSC', 'SUM', 'USDW', 'FUT', 'MBTC', 'METH', 'GLCW', 'HDC', 'GWA', 'KLG', 'LELE', 'ZUE'])) { if (in_array(strtoupper($tag), ['FOLI', 'CIC', 'MC', 'KPC8', 'BBD', 'BVA', 'DAG', 'BNC', 'BNB', 'GHP', 'DRA', 'ETC', 'PAX', 'STH', 'XJH', 'SFT', 'TSC', 'SUM', 'USDW', 'FUT', 'MBTC', 'METH', 'GLCW', 'HDC', 'GWA', 'KLG', 'LELE', 'ZUE'])) {
$quotation['usd'] = (float)sprintf("%0.4f", $quotation['last']); $quotation['usd'] = (float)sprintf("%0.4f", $quotation['last']);
$quotation['low'] = (float)sprintf("%0.4f", $quotation['low']); $quotation['low'] = (float)sprintf("%0.4f", $quotation['low']);
......
...@@ -63,7 +63,7 @@ class TickerController extends Controller ...@@ -63,7 +63,7 @@ class TickerController extends Controller
foreach ($div->find('td') as $key => $e) { foreach ($div->find('td') as $key => $e) {
if ($key == 5) { if ($key == 5) {
$key = 'quotation_boc_' . 'CNY_' . $val->currency->symbol; $key = 'quotation_boc_' . 'CNY_' . $val->currency->symbol;
$currency = rtrim(sprintf('%.6f', 1 / ($e->innertext / 100)), '0'); $currency = rtrim(sprintf('%.6f', 1 / (str_replace("
", "", $e->innertext) / 100)), '0');
Yii::$app->redis_currency->hmset($key, 'low', $currency, 'high', $currency, 'last', $currency, 'open', $currency); Yii::$app->redis_currency->hmset($key, 'low', $currency, 'high', $currency, 'last', $currency, 'open', $currency);
} }
} }
......
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