This commit is contained in:
hujiabin 2024-08-08 16:42:14 +08:00
parent 6f3dc858e9
commit 5f39be92af
2 changed files with 32 additions and 0 deletions

View File

@ -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', [], '任务类型'],
]
},
]

View File

@ -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,
));
}
}