Commit 60783e18 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/ticker' into 'master'

行情自定义 See merge request !480
parents 7d042a5e 29b3919f
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace common\business; namespace common\business;
use common\models\psources\Coin; use common\models\psources\Coin;
use common\models\psources\WalletCoinTicker;
use common\service\coin\CoinFactory; use common\service\coin\CoinFactory;
use common\service\exchange\ExchangeFactory; use common\service\exchange\ExchangeFactory;
use Yii; use Yii;
...@@ -71,6 +72,17 @@ class ExchangeBusiness ...@@ -71,6 +72,17 @@ class ExchangeBusiness
*/ */
public static function getquatation($tag = 'btc') public static function getquatation($tag = 'btc')
{ {
$coinTicker = WalletCoinTicker::find()->where(['coin_name' => $tag])->asArray()->one();
if (!empty($coinTicker)) {
$quotation = [
'low' => $coinTicker['ticker'],
'high' => $coinTicker['ticker'],
'last' => $coinTicker['ticker'],
'rmb' => $coinTicker['ticker'],
];
goto doEnd;
}
$coin_quotation_disable_items = Yii::$app->params['coin_quotation_disable_items']; $coin_quotation_disable_items = Yii::$app->params['coin_quotation_disable_items'];
if (strtoupper($tag) == 'CCNY' || strtoupper($tag) == 'CNYT' || strtoupper($tag) == 'ETC' || strtoupper($tag) == 'YX') { if (strtoupper($tag) == 'CCNY' || strtoupper($tag) == 'CNYT' || strtoupper($tag) == 'ETC' || strtoupper($tag) == 'YX') {
$exchange = ExchangeFactory::createExchange("Zhaobi"); $exchange = ExchangeFactory::createExchange("Zhaobi");
......
<?php
namespace common\models\psources;
use Yii;
use common\core\BaseActiveRecord;
class WalletCoinTicker extends BaseActiveRecord
{
public static function getDb()
{
return Yii::$app->get('p_sources');
}
public static function tableName()
{
return '{{wallet_coin_ticker}}';
}
}
\ No newline at end of file
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