diff --git a/webapp/models/HashRate.php b/webapp/models/HashRate.php index ca34c85b..61acb1dc 100644 --- a/webapp/models/HashRate.php +++ b/webapp/models/HashRate.php @@ -129,6 +129,24 @@ class HashRate extends BaseModel return $myHashRate; } + public static function decMyCurrentHashRate($val){ + $val = intval($val); + $currentPeriod = myself()->_callMtStatic('AchievementsCycle', 'getCurrentPeriod'); + if ($currentPeriod) { + SqlHelper::update( + myself()->_getSelfMysql(), + 't_hash_rate_reward', + array( + 'account_id' => myself()->_getAccountId(), + 'period' => $currentPeriod['id'], + 'reward' => function () use($val) { + return "GREATEST(0, reward - ${val})"; + }, + ) + ); + } + } + public static function getTotalByAccount($accountId,$period){ $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(),