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