From 7d02ff175d90b72e37b14ced5f61e0ff73503a4c Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 1 Aug 2024 19:18:47 +0800 Subject: [PATCH] 1 --- .../controller/FirstTopupController.class.php | 6 +++++- .../controller/HashRateController.class.php | 6 +++--- webapp/controller/MarketController.class.php | 6 +++++- webapp/controller/MissionController.class.php | 1 + webapp/controller/ShopController.class.php | 1 + webapp/models/HashRate.php | 12 +++++++++++ webapp/services/HashRateService.php | 20 +++---------------- 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/webapp/controller/FirstTopupController.class.php b/webapp/controller/FirstTopupController.class.php index a1c36cc2..f82565e7 100644 --- a/webapp/controller/FirstTopupController.class.php +++ b/webapp/controller/FirstTopupController.class.php @@ -15,7 +15,11 @@ use services\AwardService; use services\PropertyChgService; class FirstTopupController extends BaseAuthedController { - + public function _handlePre() + { + parent::_handlePre(); + die; + } public function info() { $dbInfo = FirstTopup::get(); diff --git a/webapp/controller/HashRateController.class.php b/webapp/controller/HashRateController.class.php index ad649e09..7a7d50aa 100644 --- a/webapp/controller/HashRateController.class.php +++ b/webapp/controller/HashRateController.class.php @@ -34,13 +34,13 @@ class HashRateController extends BaseAuthedController $mateList = \mt\AchievementsPower::getCustomTypeMetaList($type,$this->hashRateService); foreach ($mateList as $mate) { $taskDb = HashRate::find($mate['id'],$currentPeriod['id']); - $taskDto = $this->hashRateService->hashRateTaskDto($mate,$taskDb); + $taskDto = $this->hashRateService->hashRateTaskDto($mate,$taskDb,$currentPeriod['id']); array_push($taskDtoList1, $taskDto); } $mateList2 = \mt\AchievementsPower::getListByType(\mt\AchievementsPower::TYPE5); foreach ($mateList2 as $mate) { $taskDb = HashRate::find($mate['id'],$currentPeriod['id']); - $taskDto = $this->hashRateService->hashRateTaskDto($mate,$taskDb); + $taskDto = $this->hashRateService->hashRateTaskDto($mate,$taskDb,$currentPeriod['id']); array_push($taskDtoList2, $taskDto); } $obtain_start_time = strtotime($currentPeriod['obtain_start_time']); @@ -80,7 +80,7 @@ class HashRateController extends BaseAuthedController return; } $taskDb = HashRate::find($taskMeta['id'],$currentPeriod['id']); - $taskDto = $this->hashRateService->hashRateTaskDto($taskMeta,$taskDb); + $taskDto = $this->hashRateService->hashRateTaskDto($taskMeta,$taskDb,$currentPeriod['id']); if (!$taskDto) { $this->_rspErr(10, 'server internal error'); diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 84f56056..1fa8b74d 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -13,7 +13,11 @@ use models\Hero; class MarketController extends BaseAuthedController { - + public function _handlePre() + { + parent::_handlePre(); + die; + } public function productList() { $page = getReqVal('page', 1); diff --git a/webapp/controller/MissionController.class.php b/webapp/controller/MissionController.class.php index 3e6fd588..f8f0a303 100644 --- a/webapp/controller/MissionController.class.php +++ b/webapp/controller/MissionController.class.php @@ -37,6 +37,7 @@ class MissionController extends BaseAuthedController { public function _handlePre() { parent::_handlePre(); + die; DynData::preload(); // $this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); // if (!$this->currRankSeasonMeta) { diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index f578c35b..61582ab5 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -44,6 +44,7 @@ class ShopController extends BaseAuthedController { ) { parent::_handlePre(); } + die(); } public function getGoodsList() diff --git a/webapp/models/HashRate.php b/webapp/models/HashRate.php index d2061b4d..2b782dd8 100644 --- a/webapp/models/HashRate.php +++ b/webapp/models/HashRate.php @@ -19,6 +19,18 @@ class HashRate extends BaseModel ); } + public static function getCount($period){ + $rows = SqlHelper::ormSelect( + myself()->_getSelfMysql(), + 't_hash_rate', + array( + 'account_id' => myself()->_getAccountId(), + 'period' => $period, + ) + ); + return count($rows); + } + public static function add($taskId,$period){ SqlHelper::upsert( diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index 378e889a..f0064dd3 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -96,7 +96,7 @@ class HashRateService extends BaseService - public function hashRateTaskDto($taskMate, $taskDb){ + public function hashRateTaskDto($taskMate, $taskDb,$period){ $taskDto = array( 'task_id' => $taskMate['id'], 'current' => 0, @@ -254,27 +254,13 @@ class HashRateService extends BaseService break; //累计完成任务数 case \mt\AchievementsPower::TOTAL_COMPLETE_NUM : { - //.......... + $taskDto['current'] = HashRate::getCount($period); } break; } if ($taskDto['current'] >= $taskDto['target']) { $taskDto['current'] = $taskDto['target']; $taskDto['state'] = self::FINISHED_STATE; -// if ($currentPeriod){ -// $hashRateDb = HashRate::find($taskMate['id'],$currentPeriod['id']); -// if (!$hashRateDb){ -// $fieldKv = array( -// 'account_id' => myself()->_getAccountId(), -// 'task_id' => $taskMate['id'], -// 'period' => $currentPeriod['id'], -// 'reward' => $taskMate['Reward_quantity'], -// 'createtime' => myself()->_getNowTime(), -// 'modifytime' => myself()->_getNowTime() -// ); -// HashRate::add($fieldKv); -// } -// } } return $taskDto; } @@ -383,7 +369,7 @@ class HashRateService extends BaseService foreach ($item as $task){ $taskMeta = AchievementsPower::find($task['task_id']); $taskDb = HashRate::find($task['task_id'],$period); - $taskDto = $this->hashRateTaskDto($taskMeta,$taskDb); + $taskDto = $this->hashRateTaskDto($taskMeta,$taskDb,$period); if ($taskDto['state'] == self::FINISHED_STATE){ return true; }