Commit a9a0d0c0 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/ticker' into 'master'

修复已知问题 See merge request !175
parents 7a1f0f85 06f5c702
...@@ -56,6 +56,7 @@ class CoinDogController extends BaseController ...@@ -56,6 +56,7 @@ class CoinDogController extends BaseController
$bishijie_service = new BishijieService($appid, $appSecret); $bishijie_service = new BishijieService($appid, $appSecret);
$article = $bishijie_service->getArticleDetail($id); $article = $bishijie_service->getArticleDetail($id);
$article['share_url'] = $bishijie['Url'] . '/shendu_' . $id; $article['share_url'] = $bishijie['Url'] . '/shendu_' . $id;
$article['source'] = '币世界';
if (@$article['code']) { if (@$article['code']) {
$msg = $article['message']; $msg = $article['message'];
$code = -1; $code = -1;
......
...@@ -85,10 +85,10 @@ class BinanceBuilder extends FactoryService ...@@ -85,10 +85,10 @@ class BinanceBuilder extends FactoryService
list($low, $high, $close, $open, $vol) = $this->redis->hmget($this->quotation_prefix . strtolower($val), 'low', 'high', 'last', 'open', 'vol'); list($low, $high, $close, $open, $vol) = $this->redis->hmget($this->quotation_prefix . strtolower($val), 'low', 'high', 'last', 'open', 'vol');
$temp = []; $temp = [];
$temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin; $temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin;
#if ('BCC/USDT' != $temp['symbol']) continue;
$temp['currency'] = strtoupper($explode_arr[0]); $temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin); $temp['base_currency'] = strtoupper($coin);
$temp['close'] = number_format($close, 6, '.', ''); $temp['close'] = $this->sctonum($close, 8);
if ('0.000000' == $temp['close']) continue;
$temp['close_usd'] = (float)sprintf("%0.6f", $close * $this->basic_price[$coin]['usd']); $temp['close_usd'] = (float)sprintf("%0.6f", $close * $this->basic_price[$coin]['usd']);
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']); $temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
$temp['change'] = (0 == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100); $temp['change'] = (0 == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100);
...@@ -147,4 +147,14 @@ class BinanceBuilder extends FactoryService ...@@ -147,4 +147,14 @@ class BinanceBuilder extends FactoryService
array_multisort($keysValue, $sort, $array); array_multisort($keysValue, $sort, $array);
return $array; return $array;
} }
protected function sctonum($num, $double = 5)
{
if (false !== strpos($num, "e")) {
$a = explode("e", strtolower($num));
return bcmul($a[0], bcpow(10, $a[1], $double), $double);
} else {
return number_format($num, 6, '.', '');
}
}
} }
\ No newline at end of file
...@@ -70,8 +70,7 @@ class HuobiBuilder extends FactoryService ...@@ -70,8 +70,7 @@ 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'] = number_format($close, 6, '.', ''); $temp['close'] = $this->sctonum($close, 8);
if ('0.000000' == $temp['close']) continue;
$temp['close_usd'] = (float)sprintf("%0.6f", $close * $this->basic_price[$coin]['usd']); $temp['close_usd'] = (float)sprintf("%0.6f", $close * $this->basic_price[$coin]['usd']);
$temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']); $temp['close_rmb'] = (float)sprintf("%0.4f", $close * $this->basic_price[$coin]['rmb']);
$temp['change'] = (false == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100); $temp['change'] = (false == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100);
...@@ -162,4 +161,14 @@ class HuobiBuilder extends FactoryService ...@@ -162,4 +161,14 @@ class HuobiBuilder extends FactoryService
} }
return ['code' => $this->code, 'ticker' => $ticker]; return ['code' => $this->code, 'ticker' => $ticker];
} }
protected function sctonum($num, $double = 5)
{
if (false !== stripos($num, "e")) {
$a = explode("e", strtolower($num));
return bcmul($a[0], bcpow(10, $a[1], $double), $double);
} else {
return number_format($num, 6, '.', '');
}
}
} }
...@@ -106,6 +106,7 @@ class ZhaobiBuilder extends FactoryService ...@@ -106,6 +106,7 @@ class ZhaobiBuilder extends FactoryService
$this->code = 0; $this->code = 0;
$res['data']['abstract'] = str_replace(' ', '', str_replace(' ', '', $res['data']['abstract'])); $res['data']['abstract'] = str_replace(' ', '', str_replace(' ', '', $res['data']['abstract']));
$res['data']['content'] = str_replace(' ', '', str_replace(' ', '', $res['data']['content'])); $res['data']['content'] = str_replace(' ', '', str_replace(' ', '', $res['data']['content']));
$res['data']['source'] = '找币';
$res['data']['share_url'] = \Yii::$app->params['service']['ZhaobiService']['url']. '/help/notice/' . $params['id']; $res['data']['share_url'] = \Yii::$app->params['service']['ZhaobiService']['url']. '/help/notice/' . $params['id'];
return ['code' => $this->code, 'notice' => $res['data']]; return ['code' => $this->code, 'notice' => $res['data']];
} else { } else {
......
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