Commit 70a73eb4 authored by ZhuChunYang's avatar ZhuChunYang

update

parent f538a9bc
...@@ -14,6 +14,7 @@ use common\models\psources\Coin; ...@@ -14,6 +14,7 @@ use common\models\psources\Coin;
use common\models\psources\CoinRecommend; use common\models\psources\CoinRecommend;
use common\models\psources\MinerFee; use common\models\psources\MinerFee;
use common\service\coin\CoinFactory; use common\service\coin\CoinFactory;
use common\service\exchange\ExchangeFactory;
use Yii; use Yii;
/** /**
...@@ -39,11 +40,19 @@ class ServiceController extends BaseController ...@@ -39,11 +40,19 @@ class ServiceController extends BaseController
if(!is_array($coinItems)){ if(!is_array($coinItems)){
$coinItems = [$coinItems]; $coinItems = [$coinItems];
} }
$tol_coins = ['ETC'];
$tickerData = []; $tickerData = [];
if($coinItems){ if($coinItems){
foreach($coinItems as $item){ foreach($coinItems as $item){
$item = strtoupper($item); $item = strtoupper($item);
$quotation = ExchangeBusiness::getquatation($item); if(in_array($item,$tol_coins)){
$exchange = ExchangeFactory::createExchange('HuoBi');
if ($exchange->symbolExists($item)) {
$quotation = $exchange->getTicker($item);
}
}else{
$quotation = ExchangeBusiness::getquatation($item);
}
if (!$quotation) { if (!$quotation) {
//使用Coin服务 //使用Coin服务
try { try {
...@@ -113,4 +122,12 @@ class ServiceController extends BaseController ...@@ -113,4 +122,12 @@ class ServiceController extends BaseController
} }
return ['code' => 0,'data' => $fee,'msg' => '旷工费获取成功']; return ['code' => 0,'data' => $fee,'msg' => '旷工费获取成功'];
} }
private function getRate()
{
$exchange = ExchangeFactory::createExchange("Bty");
$rate = $exchange->getTicker("BTY", "USDT");
return (float)$rate['rmb'] / $rate['last'];
}
} }
...@@ -12,7 +12,7 @@ class Bty extends Exchange implements ExchangeInterface ...@@ -12,7 +12,7 @@ class Bty extends Exchange implements ExchangeInterface
{ {
protected $supported_symbol = 'supported_symbol_bty'; protected $supported_symbol = 'supported_symbol_bty';
protected $quotation_prefix = 'quotation_bty_'; protected $quotation_prefix = 'quotation_bty_';
protected $base_url = 'http://40.83.77.188/api/data/Ticker?sort=cname&platform='; protected $base_url = 'https://zbapi.licai.cn/api/data/Ticker?sort=cname&platform=';
/** /**
* 转化交易对为请求变量 * 转化交易对为请求变量
......
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