Commit b8eeccd2 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !492
parents d60bf8e7 9e130d74
...@@ -442,10 +442,9 @@ class ExchangeBusiness ...@@ -442,10 +442,9 @@ 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);
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['rmb'] = (float)sprintf("%0.4f", $quotation['last'] / $cny_usd_rate);
$quotation['low'] = (float)sprintf("%0.4f", $quotation['low']); $quotation['low'] = (float)sprintf("%0.4f", $quotation['low']);
$quotation['high'] = (float)sprintf("%0.4f", $quotation['high']); $quotation['high'] = (float)sprintf("%0.4f", $quotation['high']);
$quotation['last'] = (float)sprintf("%0.4f", $quotation['last']); $quotation['last'] = (float)sprintf("%0.4f", $quotation['last']);
......
...@@ -41,8 +41,8 @@ abstract class FactoryService ...@@ -41,8 +41,8 @@ abstract class FactoryService
$res = json_decode($res, true); $res = json_decode($res, true);
foreach ($res['data'] as $val) { foreach ($res['data'] as $val) {
$this->basic_price[$val['name']]['rmb'] = $val['rmb']; $this->basic_price[$val['name']]['rmb'] = $val['rmb'] ?? 0;
$this->basic_price[$val['name']]['usd'] = $val['usd']; $this->basic_price[$val['name']]['usd'] = $val['usd'] ?? 0;
} }
$this->redis = \Yii::$app->redis; $this->redis = \Yii::$app->redis;
......
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