Commit 8627d6db authored by shajiaiming's avatar shajiaiming

fix

parent ec14aae9
...@@ -25,6 +25,7 @@ class Ztb extends Exchange implements ExchangeInterface ...@@ -25,6 +25,7 @@ class Ztb extends Exchange implements ExchangeInterface
} }
return false; return false;
} }
/** /**
* 转化交易对为请求变量 * 转化交易对为请求变量
* *
...@@ -55,15 +56,16 @@ class Ztb extends Exchange implements ExchangeInterface ...@@ -55,15 +56,16 @@ class Ztb extends Exchange implements ExchangeInterface
public function setQuotation() public function setQuotation()
{ {
$curl = new Curl(); $curl = new Curl();
$content = $curl->get($this->base_url, false); $content = $curl->get($this->base_url, true);
$content = json_decode($content, true);
if (is_array($content) && isset($content['ticker'])) { if (is_array($content) && isset($content['ticker'])) {
$data = $content['ticker']; $data = $content['ticker'];
foreach ($data as $item) { foreach ($data as $item) {
if (in_array($item['symbol'], ['ZYCUSDT'])) { if (in_array($item['symbol'], ['ZYC_USDT'])) {
$data = $item; $data = $item;
$key = $this->quotation_prefix . $item['symbol']; $key = $this->quotation_prefix . str_replace('_', '', $item['symbol']);
$this->redis->hmset($key, 'low', $data['low'], 'high', $data['high'], 'last', $data['last'], 'vol', $data['vol'], 'change', $data['change']); $this->redis->hmset($key, 'low', $data['low'], 'high', $data['high'], 'last', $data['last'], 'vol', $data['vol'], 'change', $data['change']);
$this->redis->sadd($this->supported_symbol, $item['symbol']); $this->redis->sadd($this->supported_symbol, str_replace('_', '', $item['symbol']));
} }
} }
} }
......
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