Commit 9e130d74 authored by shajiaiming's avatar shajiaiming

fix

parent 93e06a7d
......@@ -442,10 +442,9 @@ class ExchangeBusiness
$exchange = ExchangeFactory::createExchange("Rate");
$rate = $exchange->getTicker("CNY", "USD");
$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'])) {
$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['high'] = (float)sprintf("%0.4f", $quotation['high']);
$quotation['last'] = (float)sprintf("%0.4f", $quotation['last']);
......
......@@ -41,8 +41,8 @@ abstract class FactoryService
$res = json_decode($res, true);
foreach ($res['data'] as $val) {
$this->basic_price[$val['name']]['rmb'] = $val['rmb'];
$this->basic_price[$val['name']]['usd'] = $val['usd'];
$this->basic_price[$val['name']]['rmb'] = $val['rmb'] ?? 0;
$this->basic_price[$val['name']]['usd'] = $val['usd'] ?? 0;
}
$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