From 14d1be9105bc68cc2a928e7b08828fa26d733f8d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Oct 2024 16:33:30 +0800 Subject: [PATCH] 1 --- .../HashRateShopController.class.php | 14 +----------- webapp/models/HashRate.php | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/webapp/controller/HashRateShopController.class.php b/webapp/controller/HashRateShopController.class.php index 1b09a9cc..65d7ac7a 100644 --- a/webapp/controller/HashRateShopController.class.php +++ b/webapp/controller/HashRateShopController.class.php @@ -54,23 +54,11 @@ class HashRateShop extends BaseAuthedController { } $propertyChgService = new services\PropertyChgService(); $awardService = new services\AwardService(); - $tokenType = $goodsMeta['token_type']; - $price = $goodsMeta['price']; - if (!in_array( - $tokenType, - array( - mt\Shop::TOKEN_TYPE_GOLD, - mt\Shop::TOKEN_TYPE_DIAMOND - ) - )) { - myself()->_rspErr(1, "token_type is unsupport, {$tokenType}"); - return; - } + $price = $goodsMeta['pile_price']; if ($price < 1) { myself()->_rspErr(1, "config error"); return; } - $costItemId = myself()->getCostItemIdByTokenType($tokenType); $costItems = array( array( 'item_id' => $costItemId, diff --git a/webapp/models/HashRate.php b/webapp/models/HashRate.php index 77255af3..ca34c85b 100644 --- a/webapp/models/HashRate.php +++ b/webapp/models/HashRate.php @@ -109,6 +109,26 @@ class HashRate extends BaseModel return $myHashRate; } + public static function getMyCurrentHashRate(){ + $currentPeriod = myself()->_callMtStatic('AchievementsCycle', 'getCurrentPeriod'); + if (empty($currentPeriod)) { + return 0; + } + $row = SqlHelper::ormSelectOne( + myself()->_getSelfMysql(), + 't_hash_rate_reward', + array( + 'account_id' => myself()->_getAccountId(), + 'period' => $currentPeriod['id'], + ) + ); + $myHashRate = 0; + if ($row){ + $myHashRate = $row['reward']; + } + return $myHashRate; + } + public static function getTotalByAccount($accountId,$period){ $row = SqlHelper::ormSelectOne( myself()->_getSelfMysql(), @@ -126,4 +146,4 @@ class HashRate extends BaseModel } -} \ No newline at end of file +}