Commit 21b6c06c authored by shajiaiming's avatar shajiaiming

format return data

parent c2310492
...@@ -328,7 +328,14 @@ class CoinController extends BaseController ...@@ -328,7 +328,14 @@ class CoinController extends BaseController
$platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']); $platform_with_hold['private_key'] = $des->encrypt($platform_with_hold['private_key']);
return ['code' => 0,'data' => $platform_with_hold]; return ['code' => 0,'data' => $platform_with_hold];
}else{ }else{
return ['code' => 0, 'data' => []]; $data = [
'id' => 0,
'platform' => '',
'address' => '',
'private_key' => '',
'exer' => ''
];
return ['code' => 0, 'data' => $data];
} }
}else{ }else{
return ['code' => 1,'data' => [],'msg' => '平台参数不能为空']; return ['code' => 1,'data' => [],'msg' => '平台参数不能为空'];
......
...@@ -45,6 +45,9 @@ class Bitfinex extends Exchange implements ExchangeInterface ...@@ -45,6 +45,9 @@ class Bitfinex extends Exchange implements ExchangeInterface
$symbols = $this->redis->smembers($this->supported_symbol); $symbols = $this->redis->smembers($this->supported_symbol);
$query = '?symbols=' . implode(',', $symbols); $query = '?symbols=' . implode(',', $symbols);
$res = $this->ch->get('https://api.bitfinex.com/v2/tickers' . $query, false); $res = $this->ch->get('https://api.bitfinex.com/v2/tickers' . $query, false);
if(false == $res){
return;
}
foreach ($res as $item) { foreach ($res as $item) {
$this->redis->hmset($this->quotation_prefix . $item[0], $this->redis->hmset($this->quotation_prefix . $item[0],
'low', $item[10], 'low', $item[10],
......
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