Commit a4508f34 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/ticker' into 'master'

hd to hdc See merge request !416
parents f06e90cb 315043b1
...@@ -378,7 +378,7 @@ class TickerController extends BaseController ...@@ -378,7 +378,7 @@ class TickerController extends BaseController
], [ ], [
'exchange' => 'hd', 'exchange' => 'hd',
'symbol' => [ 'symbol' => [
'hdusdt' 'hdcusdt'
], ],
] ]
]; ];
......
...@@ -16,7 +16,7 @@ class Hd extends Exchange implements ExchangeInterface ...@@ -16,7 +16,7 @@ class Hd extends Exchange implements ExchangeInterface
protected $quotation_prefix = 'quotation_hd_'; protected $quotation_prefix = 'quotation_hd_';
protected $base_url = 'https://app.honordecent.com/exchange/getHdcCurrPrice'; protected $base_url = 'https://app.honordecent.com/exchange/getHdcCurrPrice';
public function symbolExists($tag = 'HD', $aim = "USDT") public function symbolExists($tag = 'HDC', $aim = "USDT")
{ {
$supported = $this->redis->smembers($this->supported_symbol); $supported = $this->redis->smembers($this->supported_symbol);
if (is_array($supported) && in_array($this->formatSymbol($tag, $aim), $supported)) { if (is_array($supported) && in_array($this->formatSymbol($tag, $aim), $supported)) {
...@@ -32,7 +32,7 @@ class Hd extends Exchange implements ExchangeInterface ...@@ -32,7 +32,7 @@ class Hd extends Exchange implements ExchangeInterface
* @param string $aim * @param string $aim
* @return mixed * @return mixed
*/ */
public function formatSymbol($tag = 'HD', $aim = 'USDT') public function formatSymbol($tag = 'HDC', $aim = 'USDT')
{ {
return strtoupper($tag . $aim); return strtoupper($tag . $aim);
} }
...@@ -57,10 +57,10 @@ class Hd extends Exchange implements ExchangeInterface ...@@ -57,10 +57,10 @@ class Hd extends Exchange implements ExchangeInterface
$curl = new Curl(); $curl = new Curl();
$res = $curl->get($this->base_url, false); $res = $curl->get($this->base_url, false);
if (is_array($res) && 1 == $res['code']) { if (is_array($res) && 1 == $res['code']) {
$key = $this->quotation_prefix . 'HDUSDT'; $key = $this->quotation_prefix . 'HDCUSDT';
$this->redis->hmset($key, 'low', $res['data'], 'high', $res['data'], 'last', $res['data']); $this->redis->hmset($key, 'low', $res['data'], 'high', $res['data'], 'last', $res['data']);
if (!$this->redis->sismember($this->supported_symbol, 'HDUSDT')) { if (!$this->redis->sismember($this->supported_symbol, 'HDCUSDT')) {
$this->redis->sadd($this->supported_symbol, 'HDUSDT'); $this->redis->sadd($this->supported_symbol, 'HDCUSDT');
} }
} }
} }
......
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