Commit 867871f2 authored by rlgy's avatar rlgy

update

parent 6b276b39
...@@ -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?platform=HKJB&sort=cname'; protected $base_url = 'http://40.83.77.188/api/data/Ticker?sort=cname&platform=';
/** /**
* 转化交易对为请求变量 * 转化交易对为请求变量
...@@ -43,11 +43,13 @@ class Bty extends Exchange implements ExchangeInterface ...@@ -43,11 +43,13 @@ class Bty extends Exchange implements ExchangeInterface
*/ */
public function setQuotation() public function setQuotation()
{ {
$content = $this->ch->get($this->base_url, false); $platforms = ['HKJB', 'BB360'];
foreach($platforms as $platform) {
$content = $this->ch->get($this->base_url . $platform, false);
if (is_array($content) && isset($content['code']) && $content['code'] == 200) { if (is_array($content) && isset($content['code']) && $content['code'] == 200) {
$data = $content['data']['USDT']; $data = $content['data']['USDT'];
foreach ($data as $item) { foreach ($data as $item) {
if ($item['symbol'] == 'BTYUSDT' || $item['symbol'] == 'ITVBUSDT') { if (in_array($item['symbol'], ['BTYUSDT', 'ITVBUSDT', 'SCTCUSDT'])) {
$data = $item; $data = $item;
$key = $this->quotation_prefix . $item['symbol']; $key = $this->quotation_prefix . $item['symbol'];
$this->redis->hmset($key, 'low', $data['low'], 'high', $data['high'], 'last', $data['last'], 'rmb', $data['lastrmb']); $this->redis->hmset($key, 'low', $data['low'], 'high', $data['high'], 'last', $data['last'], 'rmb', $data['lastrmb']);
...@@ -56,5 +58,6 @@ class Bty extends Exchange implements ExchangeInterface ...@@ -56,5 +58,6 @@ class Bty extends Exchange implements ExchangeInterface
} }
} }
} }
}
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ use yii\console\Controller; ...@@ -18,6 +18,7 @@ use yii\console\Controller;
use common\models\psources\CoinPublishRule; use common\models\psources\CoinPublishRule;
use common\models\psources\CoinReleaseMember; use common\models\psources\CoinReleaseMember;
use backend\jobs\QueryTransJob; use backend\jobs\QueryTransJob;
use common\service\exchange\Bty;
/** /**
* Class ExchangeController * Class ExchangeController
...@@ -53,4 +54,10 @@ class DevController extends Controller ...@@ -53,4 +54,10 @@ class DevController extends Controller
$id = Yii::$app->queue->push(new JugdeAwardJob()); $id = Yii::$app->queue->push(new JugdeAwardJob());
var_dump($id); var_dump($id);
} }
public function actionQuotation()
{
$bty = new Bty();
$bty->setQuotation();
}
} }
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