Commit 54adb613 authored by shajiaming's avatar shajiaming

merge market

parent 86477424
......@@ -52,6 +52,12 @@ class MarketController extends BaseController
goto doEnd;
}
if ('USDT' == strtoupper($base_currency) && 'USDT' == strtoupper($currency)) {
$this->msg = 'invalid symbol';
$this->code = -1;
goto doEnd;
}
if (false == $exchange || !in_array($exchange, Yii::$app->params['exchange'])) {
$this->msg = 'invalid exchange';
$this->code = -1;
......@@ -71,6 +77,17 @@ class MarketController extends BaseController
goto doEnd;
}
if ('USDT' == strtoupper($currency)) {
$currency_ticker = $exchange->getTicker($base_currency, 'USDT');
if (empty($currency_ticker)) {
$this->code = -1;
$this->msg = '此交易所暂不支持所选币种!';
goto doEnd;
}
$this->data = rtrim(sprintf('%.6f', 1 / $currency_ticker['last']), '0');
goto doEnd;
}
$currency_ticker = $exchange->getTicker($currency, 'USDT');
$base_currency_ticker = $exchange->getTicker($base_currency, 'USDT');
if (empty($currency_ticker) || empty($base_currency_ticker)) {
......
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