From 80b6f7f1dc75ec45deb88e71b5152ca740a0387e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 23 Aug 2023 12:11:35 +0800 Subject: [PATCH] 1 --- webapp/services/BlockChainService.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/webapp/services/BlockChainService.php b/webapp/services/BlockChainService.php index 701b2ec9..5139d8de 100644 --- a/webapp/services/BlockChainService.php +++ b/webapp/services/BlockChainService.php @@ -204,8 +204,17 @@ class BlockChainService { } } - public static function parseCurrency($currencyName, $val, &$intVal, &$floatVal) + public static function parseCurrencyVal($currencyName, $val, &$intVal, &$floatVal) { + $decimals = self::getCurrencyDecimals($currencyName); + $intVal = '0'; + $floatVal = '0'; + if (strlen($val) <= $decimals) { + $floatVal = $val; + } else { + $intVal = substr($val, 0, $decimals); + $floatVal = substr($val, $decimals); + } } /*