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
$bishijie_service = new BishijieService($appid, $appSecret);
$article = $bishijie_service->getArticleDetail($id);
$article['share_url'] = $bishijie['Url'] . '/shendu_' . $id;
$article['source'] = '币世界';
if (@$article['code']) {
$msg = $article['message'];
$code = -1;
......
......@@ -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');
$temp = [];
$temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin;
#if ('BCC/USDT' != $temp['symbol']) continue;
$temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin);
$temp['close'] = number_format($close, 6, '.', '');
if ('0.000000' == $temp['close']) continue;
$temp['close'] = $this->sctonum($close, 8);
$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['change'] = (0 == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100);
......@@ -147,4 +147,14 @@ class BinanceBuilder extends FactoryService
array_multisort($keysValue, $sort, $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
$temp['symbol'] = strtoupper($explode_arr[0]) . '/' . $coin;
$temp['currency'] = strtoupper($explode_arr[0]);
$temp['base_currency'] = strtoupper($coin);
$temp['close'] = number_format($close, 6, '.', '');
if ('0.000000' == $temp['close']) continue;
$temp['close'] = $this->sctonum($close, 8);
$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['change'] = (false == $open) ? 0 : (float)sprintf("%0.2f", ($close - $open) / $open * 100);
......@@ -162,4 +161,14 @@ class HuobiBuilder extends FactoryService
}
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
$this->code = 0;
$res['data']['abstract'] = str_replace(' ', '', str_replace(' ', '', $res['data']['abstract']));
$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'];
return ['code' => $this->code, 'notice' => $res['data']];
} 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