From 5f39be92afbd3c3c49b356a2735941e37ecc26aa Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 8 Aug 2024 16:42:14 +0800 Subject: [PATCH] 1 --- doc/HashRate.py | 12 +++++++++++ .../controller/HashRateController.class.php | 20 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/doc/HashRate.py b/doc/HashRate.py index 06d8e435..de3eaa8e 100644 --- a/doc/HashRate.py +++ b/doc/HashRate.py @@ -51,6 +51,18 @@ class HashRate(object): 'response': [ _common.RspHead(), ] + },{ + 'name': 'redTips', + 'desc': '红点提示', + 'group': 'HashRate', + 'url': 'webapp/index.php?c=HashRate&a=redTips', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!tips', [], '任务类型'], + ] }, ] diff --git a/webapp/controller/HashRateController.class.php b/webapp/controller/HashRateController.class.php index eb16f2dc..e082d1cb 100644 --- a/webapp/controller/HashRateController.class.php +++ b/webapp/controller/HashRateController.class.php @@ -169,6 +169,26 @@ class HashRateController extends BaseAuthedController $this->_rspOk(); } + public function redTips(){ + $currentPeriod= \mt\AchievementsCycle::getCurrentPeriod(); + if (!$currentPeriod){ + $this->_rspErr(1, 'Already ended'); + return; + } + $tips = array(); + for ($i=1;$i<5;$i++){ + foreach ($this->hashRateService->hashRateTask['task'.$i] as $task){ + $taskDb = HashRate::find($task['task_id'],$currentPeriod['id']); + $taskDto = $this->hashRateService->hashRateTaskDto($task,$taskDb,$currentPeriod['id']); + if ($taskDto['state'] == \services\HashRateService::FINISHED_STATE){ + array_push($tips,$i); + } + } + } + $this->_rspData(array( + 'tips' => $tips, + )); + } } \ No newline at end of file