From a25cdeccbc3dc4d0c944d3d31f867554c9cf1404 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 23 Aug 2023 14:55:17 +0800 Subject: [PATCH] 1 --- webapp/models/DynData.php | 25 +++++++++++++++++++++++++ webapp/services/BlockChainService.php | 12 ++++++------ webapp/services/EventService.php | 19 +++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/webapp/models/DynData.php b/webapp/models/DynData.php index 72eb38e1..60e09205 100644 --- a/webapp/models/DynData.php +++ b/webapp/models/DynData.php @@ -87,6 +87,31 @@ class DynData extends BaseModel { ); } + public static function setVEx($accountId, $x, $y, $val) + { + SqlHelper::upsert + (myself()->_getMysql($accountId), + 't_dyndata', + array( + 'account_id' => $accountId, + 'x' => $x, + 'y' => $y + ), + array( + 'val' => $val, + 'modifytime' => myself()->_getNowTime() + ), + array( + 'account_id' => $accountId, + 'x' => $x, + 'y' => $y, + 'val' => $val, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime() + ) + ); + } + public static function decV($x, $y, $val) { self::incV($x, $y, 0 - $val); diff --git a/webapp/services/BlockChainService.php b/webapp/services/BlockChainService.php index 079b824e..858753bb 100644 --- a/webapp/services/BlockChainService.php +++ b/webapp/services/BlockChainService.php @@ -203,19 +203,19 @@ class BlockChainService { } } - public static function parseCurrencyVal($currencyName, $val, &$intVal, &$floatVal) + public static function parseCurrencyVal($currencyName, $val, &$intPart, &$floatPart) { $decimals = self::getCurrencyDecimals($currencyName); if ($decimals === false) { return false; } - $intVal = '0'; - $floatVal = '0'; + $intPart = '0'; + $floatPart = '0'; if (strlen($val) <= $decimals) { - $floatVal = $val; + $floatPart = $val; } else { - $intVal = substr($val, 0, $decimals); - $floatVal = substr($val, $decimals); + $intPart = substr($val, 0, $decimals); + $floatPart = substr($val, $decimals); } return true; } diff --git a/webapp/services/EventService.php b/webapp/services/EventService.php index a09bc17b..ea14128c 100644 --- a/webapp/services/EventService.php +++ b/webapp/services/EventService.php @@ -1,9 +1,28 @@