Commit 65a5b07c authored by shajiaiming's avatar shajiaiming

小数点后变4位

parent 836c9ded
......@@ -66,7 +66,7 @@ class CoinService extends Coin implements CoinInterface
*/
public function setPrice($price)
{
$this->price = (float)sprintf("%0.2f", $price);
$this->price = (float)sprintf("%0.4f", $price);
}
/**
......@@ -155,7 +155,7 @@ class CoinService extends Coin implements CoinInterface
*/
public function setHigh($high)
{
$this->high = (float)sprintf("%0.2f", $high / 6.6);
$this->high = (float)sprintf("%0.4f", $high / 6.6);
}
/**
......@@ -184,7 +184,7 @@ class CoinService extends Coin implements CoinInterface
*/
public function setLow($low)
{
$this->low = (float)sprintf("%0.2f", $low / 6.6);
$this->low = (float)sprintf("%0.4f", $low / 6.6);
}
/**
......@@ -517,7 +517,7 @@ class CoinService extends Coin implements CoinInterface
//价格与涨幅
$pattern = '/<div class=coinprice>(.*?)<span class=(tags-red|tags-green)>(.*?)<\/span><\/div>/is';
preg_match_all($pattern, $content, $matchs, PREG_SET_ORDER);
$result['price'] = (float)sprintf("%0.2f", (float)str_replace(['¥', ','], '', $matchs[0][1]));
$result['price'] = (float)sprintf("%0.4f", (float)str_replace(['¥', ','], '', $matchs[0][1]));
//美元 btc
preg_match_all('/<div class=sub><span>(.*?)<\/span>(.*?)<span>(.*?)<\/span><\/div>/is', $content,
......
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