game2006api/webapp/services/EventService.php
aozhiwei a25cdeccbc 1
2023-08-23 14:55:17 +08:00

29 lines
822 B
PHP

<?php
require_once('models/DynData.php');
require_once('services/BlockChainService.php');
use models\DynData;
use services\BlockChainService;
class EventService {
public static function mallConsume($accountId, $currencyName, $val)
{
$intPart = 0;
$floatPart = 0;
if (BlockChainService::parseCurrencyVal($currencyName, $val, $intPart, $floatPart)) {
$oldIntPart = DynData::GetVEx($accountId, TN_TOTAL_CEG_CONSUME, 0);
$oldFloatPart = DynData::GetVEx($accountId, TN_TOTAL_CEG_CONSUME, 1);
$newIntPart = $oldIntPart + $intPart;
$newFloatPart = $oldFloatPart;
DynData::setVEx($accountId, TN_TOTAL_CEG_CONSUME, 0, $newIntPart);
DynData::setVEx($accountId, TN_TOTAL_CEG_CONSUME, 1, $newFloatPart);
}
}
}