Commit e92cd243 authored by shajiaiming's avatar shajiaiming

fix

parent 6d8ab04c
......@@ -14,7 +14,7 @@ class Zhaobi extends Exchange implements ExchangeInterface
{
protected $supported_symbol = 'supported_symbol_zhaobi';
protected $quotation_prefix = 'quotation_zhaobi_';
protected $base_url = 'https://api.biqianbao.top/api/data/basecoinprice?base=CNY&coin=SFT&platform=zhaobi';
protected $base_url = 'https://api.biqianbao.top';
public function symbolExists($tag = 'SFT', $aim = "CNY")
{
......@@ -33,7 +33,7 @@ class Zhaobi extends Exchange implements ExchangeInterface
*/
public function formatSymbol($tag = 'SFT', $aim = 'CNY')
{
return strtoupper($tag .'_'. $aim);
return strtolower(trim($tag) . trim($aim));
}
/**
......@@ -54,12 +54,27 @@ class Zhaobi extends Exchange implements ExchangeInterface
public function setQuotation()
{
$curl = new Curl();
$content = $curl->get($this->base_url, false);
$api = $this->base_url . '/api/data/Ticker?sort=cname';
$content = $curl->get($api, false);
if (isset($content['message']) && 'OK' == $content['message']) {
$ticker_temp = [];
foreach ($content['data'] as $val) {
$ticker_temp = array_merge($ticker_temp, $val);
}
foreach ($ticker_temp as $val) {
$key = $this->quotation_prefix . strtolower($val['symbol']);
$this->redis->hmset($key, 'low', $val['low'], 'high', $val['high'], 'last', $val['last'], 'open', $val['open'], 'vol', $val['vol']);
$this->redis->sadd($this->supported_symbol, $val['symbol']);
}
}
$api = $this->base_url . '/api/data/basecoinprice?base=CNY&coin=SFT&platform=zhaobi';
$content = $curl->get($api, false);
if (is_array($content) && isset($content['code']) && (200 == $content['code'])) {
$data = $content['data'][0];
$key = $this->quotation_prefix . 'SFT_CNY';
$key = $this->quotation_prefix . 'sftcny';
$this->redis->hmset($key, 'low', $data['value'], 'high', $data['value'], 'last', $data['value']);
$this->redis->sadd($this->supported_symbol, 'SFT_CNY');
$this->redis->sadd($this->supported_symbol, 'SFTCNY');
}
}
}
\ 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