1
This commit is contained in:
parent
0182702eae
commit
bd0c46d307
@ -320,10 +320,7 @@ class BlockChainController extends BaseAuthedController {
|
||||
)) {
|
||||
$rate = 10;
|
||||
}
|
||||
$jinDu = 18;
|
||||
if ($tokenType == BlockChainService::CURRENCY_USDC) {
|
||||
$jinDu = 6;
|
||||
}
|
||||
$jinDu = BlockChainService::getCurrencyDecimals($tokenType);
|
||||
$currency = $tokenType;
|
||||
$price = BlockChainService::formatCurrencyEx($num, $jinDu);
|
||||
|
||||
|
@ -177,6 +177,33 @@ class BlockChainService {
|
||||
return $formatedStr;
|
||||
}
|
||||
|
||||
public static function getCurrencyDecimals($currencyName)
|
||||
{
|
||||
switch ($currencyName) {
|
||||
case self::CURRENCY_CEG:
|
||||
{
|
||||
return 18;
|
||||
}
|
||||
break;
|
||||
case self::CURRENCY_USDC:
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
case self::CURRENCY_USDT:
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
error_log("unkonw currencyName " . $currencyName);
|
||||
die();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$price 是一个小数精确到小数点后5位
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user