Commit f6198ab2 authored by shajiaiming's avatar shajiaiming

价格调整

parent 69c97b4f
...@@ -137,6 +137,8 @@ class TickerController extends BaseController ...@@ -137,6 +137,8 @@ class TickerController extends BaseController
$quotation = $exchange->getTicker(strtolower($tag_first), strtolower($tag_second)); $quotation = $exchange->getTicker(strtolower($tag_first), strtolower($tag_second));
$temp['symbol'] = $val['symbol']; $temp['symbol'] = $val['symbol'];
$temp['currency'] = strtoupper($tag_first);
$temp['base_currency'] = strtoupper($tag_second);
$temp['close'] = (float)sprintf("%0.4f", $quotation['last']); $temp['close'] = (float)sprintf("%0.4f", $quotation['last']);
$temp['close_rmb'] = (float)sprintf("%0.4f", $quotation['last'] * $this->basic_price[$tag_second]); $temp['close_rmb'] = (float)sprintf("%0.4f", $quotation['last'] * $this->basic_price[$tag_second]);
$temp['change'] = (float)sprintf("%0.4f", ($quotation['last'] - $quotation['open']) / $quotation['open'] * 100); $temp['change'] = (float)sprintf("%0.4f", ($quotation['last'] - $quotation['open']) / $quotation['open'] * 100);
......
...@@ -30,8 +30,8 @@ class BinanceBuilder extends FactoryService ...@@ -30,8 +30,8 @@ class BinanceBuilder extends FactoryService
$temp['symbol'] = $explode_arr[0] . '/' . $coin; $temp['symbol'] = $explode_arr[0] . '/' . $coin;
$temp['currency'] = strtoupper($explode_arr[0]); $temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin); $temp['base_currency'] = strtoupper($coin);
$temp['close'] = (float)sprintf("%0.4f", $val['lastPrice']); $temp['close'] = (float)sprintf("%0.6f", $val['lastPrice'] * $this->basic_price[$coin]['usd']);
$temp['close_rmb'] = (float)sprintf("%0.4f", $val['lastPrice'] * $this->basic_price[$coin]); $temp['close_rmb'] = (float)sprintf("%0.4f", $val['lastPrice'] * $this->basic_price[$coin]['rmb']);
$temp['change'] = (float)sprintf("%0.4f", $val['priceChangePercent']); $temp['change'] = (float)sprintf("%0.4f", $val['priceChangePercent']);
$temp['high'] = (float)sprintf("%0.4f", $val['highPrice']); $temp['high'] = (float)sprintf("%0.4f", $val['highPrice']);
$temp['low'] = (float)sprintf("%0.4f", $val['lowPrice']); $temp['low'] = (float)sprintf("%0.4f", $val['lowPrice']);
......
...@@ -34,8 +34,10 @@ abstract class FactoryService ...@@ -34,8 +34,10 @@ abstract class FactoryService
$curl->setRawPostData($params); $curl->setRawPostData($params);
$res = $curl->post('https://b.biqianbao.net/interface/coin/coin-index', true); $res = $curl->post('https://b.biqianbao.net/interface/coin/coin-index', true);
$res = json_decode($res, true); $res = json_decode($res, true);
foreach ($res['data'] as $val) { foreach ($res['data'] as $val) {
$this->basic_price[$val['name']] = $val['rmb']; $this->basic_price[$val['name']]['rmb'] = $val['rmb'];
$this->basic_price[$val['name']]['usd'] = $val['usd'];
} }
} }
} }
\ No newline at end of file
...@@ -30,8 +30,8 @@ class HuobiBuilder extends FactoryService ...@@ -30,8 +30,8 @@ class HuobiBuilder extends FactoryService
$temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin; $temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin;
$temp['currency'] = strtoupper($explode_arr[0]); $temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin); $temp['base_currency'] = strtoupper($coin);
$temp['close'] = (float)sprintf("%0.4f", $val['close']); $temp['close'] = (float)sprintf("%0.6f", $val['close'] * $this->basic_price[$coin]['usd']);
$temp['close_rmb'] = (float)sprintf("%0.4f", $val['close'] * $this->basic_price[$coin]); $temp['close_rmb'] = (float)sprintf("%0.4f", $val['close'] * $this->basic_price[$coin]['rmb']);
$temp['change'] = (float)sprintf("%0.4f", ($val['close'] - $val['open']) / $val['open'] * 100); $temp['change'] = (float)sprintf("%0.4f", ($val['close'] - $val['open']) / $val['open'] * 100);
$temp['high'] = (float)sprintf("%0.4f", $val['high']); $temp['high'] = (float)sprintf("%0.4f", $val['high']);
$temp['low'] = (float)sprintf("%0.4f", $val['low']); $temp['low'] = (float)sprintf("%0.4f", $val['low']);
......
...@@ -34,7 +34,7 @@ class ZhaobiBuilder extends FactoryService ...@@ -34,7 +34,7 @@ class ZhaobiBuilder extends FactoryService
$temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin; $temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin;
$temp['currency'] = strtoupper($explode_arr[0]); $temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin); $temp['base_currency'] = strtoupper($coin);
$temp['close'] = (float)sprintf("%0.4f", $val['last']); $temp['close'] = (float)sprintf("%0.6f", $val['last']);
$temp['close_rmb'] = (float)sprintf("%0.4f", $val['lastrmb']); $temp['close_rmb'] = (float)sprintf("%0.4f", $val['lastrmb']);
$temp['change'] = (float)sprintf("%0.4f", ($val['last'] - $val['open']) / $val['open'] * 100); $temp['change'] = (float)sprintf("%0.4f", ($val['last'] - $val['open']) / $val['open'] * 100);
$temp['high'] = (float)sprintf("%0.4f", $val['high']); $temp['high'] = (float)sprintf("%0.4f", $val['high']);
......
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