Commit 166de7bb authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !500
parents c8997076 eb30121e
...@@ -253,17 +253,7 @@ class CoinController extends BaseController ...@@ -253,17 +253,7 @@ class CoinController extends BaseController
$last[] = 1; $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 = Yii::$app->redis_currency->hmget('quotation_currency_' . 'CNY_' . $currency->symbol, 'last');
$last[] = 1;
} else if (1316 == $this->currency_id) {
if (Yii::$app->redis->hkeys('quotation_go_CNY_USD')) {
$last[0] = 1 / Yii::$app->redis->hmget('quotation_go_CNY_USD', 'last')[0];
} else {
$last = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $currency->symbol, 'last');
}
} else {
$last = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $currency->symbol, 'last');
}
} }
foreach ($result['data'] as $key => &$value) { foreach ($result['data'] as $key => &$value) {
......
...@@ -432,7 +432,7 @@ class TickerController extends BaseController ...@@ -432,7 +432,7 @@ class TickerController extends BaseController
if (1111 == $val->currency->pj_id) { if (1111 == $val->currency->pj_id) {
$rate = (string)1; $rate = (string)1;
} else { } else {
list($rate) = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $val->currency->symbol, 'last'); list($rate) = Yii::$app->redis_currency->hmget('quotation_currency_' . '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;
......
...@@ -82,11 +82,7 @@ class WalletCoinController extends BaseController ...@@ -82,11 +82,7 @@ class WalletCoinController extends BaseController
$last[] = 1; $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 = Yii::$app->redis_currency->hmget('quotation_currency_' . 'CNY_' . $currency->symbol, 'last');
$last[] = 1;
} else {
$last = Yii::$app->redis_currency->hmget('quotation_boc_' . 'CNY_' . $currency->symbol, 'last');
}
} }
$ticker = ['low' => 0, 'high' => 0, 'last' => 0, 'open' => 0, 'vol' => 0, 'rmb' => 0, 'usd' => 0]; $ticker = ['low' => 0, 'high' => 0, 'last' => 0, 'open' => 0, 'vol' => 0, 'rmb' => 0, 'usd' => 0];
......
...@@ -32,16 +32,14 @@ class ExchangeBusiness ...@@ -32,16 +32,14 @@ class ExchangeBusiness
1 => 'Hadax', 1 => 'Hadax',
2 => 'Bittrex', 2 => 'Bittrex',
3 => 'Zb', 3 => 'Zb',
4 => 'Rate', 4 => 'Superx',
5 => 'Superx', 5 => 'Binance',
6 => 'Binance', 6 => 'Bilaxy',
7 => 'Bilaxy', 7 => 'Bitnasdaq',
8 => 'Bitnasdaq', 8 => 'Isummit',
9 => 'Isummit', 9 => 'Ztb',
10 => 'Boc', 10 => 'Wbf',
11 => 'Ztb', 11 => 'Gwa'
12 => 'Wbf',
13 => 'Gwa'
//1 => 'Hadax', //不需要 //1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要 //2 => 'Bitfinex', //不需要
...@@ -452,9 +450,9 @@ class ExchangeBusiness ...@@ -452,9 +450,9 @@ class ExchangeBusiness
} }
doEnd : doEnd :
$exchange = ExchangeFactory::createExchange("Rate"); $cny_usd_rate = Yii::$app->redis_currency->hmget('quotation_currency_CNY_USD', 'last');
$rate = $exchange->getTicker("CNY", "USD"); $cny_usd_rate = floatval($cny_usd_rate[0]);
$cny_usd_rate = 1 / $rate['last'];
$quotation['rmb'] = isset($quotation['rmb']) ? $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']);
......
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