Commit a1b6444b authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

Feature/optimize See merge request !89
parents 3132db87 e6cb4f80
...@@ -150,6 +150,13 @@ class ExchangeBusiness ...@@ -150,6 +150,13 @@ class ExchangeBusiness
goto doEnd; goto doEnd;
} }
if (in_array(strtoupper($tag), ['SUSD'])) {
$exchange = ExchangeFactory::createExchange("Go");
$quotation = $exchange->getTicker('CNY', 'USD');
$quotation['rmb'] = (float)sprintf("%0.2f", $quotation['last']);
goto doEnd;
}
if (in_array(strtoupper($tag), ['SJPY'])) { if (in_array(strtoupper($tag), ['SJPY'])) {
$exchange = ExchangeFactory::createExchange("Boc"); $exchange = ExchangeFactory::createExchange("Boc");
$quotation = $exchange->getTicker('CNY', 'JPY'); $quotation = $exchange->getTicker('CNY', 'JPY');
...@@ -222,6 +229,8 @@ class ExchangeBusiness ...@@ -222,6 +229,8 @@ class ExchangeBusiness
if (in_array(strtoupper($tag), ['FOLI'])) { if (in_array(strtoupper($tag), ['FOLI'])) {
$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['rmb'] = (float)sprintf("%0.4f", $quotation['last'] / $cny_usd_rate);
} else if (in_array(strtoupper($tag), ['SUSD'])) {
$quotation['usd'] = (float)sprintf("%0.4f", 1);
} else { } else {
$quotation['usd'] = (float)sprintf("%0.4f", $quotation['rmb'] * $cny_usd_rate); $quotation['usd'] = (float)sprintf("%0.4f", $quotation['rmb'] * $cny_usd_rate);
} }
......
...@@ -62,6 +62,13 @@ class CoinController extends BaseController ...@@ -62,6 +62,13 @@ class CoinController extends BaseController
$names = [$names]; $names = [$names];
} }
$condition = $names; $condition = $names;
$platform = Yii::$app->request->POST('platform', '');
if (!empty($platform)) {
$condition = [];
foreach ($names as $val) {
$condition[] = [$val, $platform];
}
}
$fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'introduce']; $fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'introduce'];
$result = ExchangeBusiness::getApiListForIndex(1, 999, $condition, $fields); $result = ExchangeBusiness::getApiListForIndex(1, 999, $condition, $fields);
if ($result) { if ($result) {
......
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