Commit 8b56be53 authored by shajiaiming's avatar shajiaiming

小数点后变4位

parent 65a5b07c
...@@ -55,7 +55,7 @@ class ServiceController extends BaseController ...@@ -55,7 +55,7 @@ class ServiceController extends BaseController
$quotation[$key] = (float)sprintf("%0.4f", (double)$value); $quotation[$key] = (float)sprintf("%0.4f", (double)$value);
} }
$rate = $this->getRate(); $rate = $this->getRate();
$quotation['rmb'] = (float)sprintf("%0.2f", $rate * $quotation['last']); $quotation['rmb'] = (float)sprintf("%0.4f", $rate * $quotation['last']);
} }
} }
}else{ }else{
......
...@@ -87,7 +87,7 @@ class CoinBTYService extends Coin implements CoinInterface ...@@ -87,7 +87,7 @@ class CoinBTYService extends Coin implements CoinInterface
public function setPrice($price) public function setPrice($price)
{ {
return $this->price = (float)sprintf("%0.2f", $price); return $this->price = (float)sprintf("%0.4f", $price);
} }
public function getDollar() public function getDollar()
......
...@@ -517,7 +517,7 @@ class CoinService extends Coin implements CoinInterface ...@@ -517,7 +517,7 @@ class CoinService extends Coin implements CoinInterface
//价格与涨幅 //价格与涨幅
$pattern = '/<div class=coinprice>(.*?)<span class=(tags-red|tags-green)>(.*?)<\/span><\/div>/is'; $pattern = '/<div class=coinprice>(.*?)<span class=(tags-red|tags-green)>(.*?)<\/span><\/div>/is';
preg_match_all($pattern, $content, $matchs, PREG_SET_ORDER); preg_match_all($pattern, $content, $matchs, PREG_SET_ORDER);
$result['price'] = (float)sprintf("%0.4f", (float)str_replace(['¥', ','], '', $matchs[0][1])); $result['price'] = (float)sprintf("%0.2f", (float)str_replace(['¥', ','], '', $matchs[0][1]));
//美元 btc //美元 btc
preg_match_all('/<div class=sub><span>(.*?)<\/span>(.*?)<span>(.*?)<\/span><\/div>/is', $content, 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