From 780b765c2ae205eb991d3d36776081e45646b02e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Oct 2024 19:10:48 +0800 Subject: [PATCH] 1 --- webapp/models/HashRate.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(),