This commit is contained in:
hujiabin 2024-07-01 16:10:54 +08:00
parent 28bb7d9e25
commit 4fde638257
2 changed files with 17 additions and 4 deletions

View File

@ -59,6 +59,11 @@ class BaseController {
return phpcommon\getDaySeconds($time, $this->timeZone);
}
public function _getDaySecondsOffset($time)
{
return $time - phpcommon\getDaySeconds($time, $this->timeZone);
}
public function _getTodayRemainSeconds()
{
return max(0, $this->_getNowDaySeconds() + 3600 * 24 - $this->_getNowTime());

View File

@ -314,12 +314,20 @@ class OtherController extends BaseAuthedController {
if ($modeMeta['limit_time'] == 2 && (empty($taskStatus) || !$taskMeta || myself()->_getNowTime() <= strtotime($taskMeta['income_start_time']))){
return true;
}
$temp = array(
'id' => $modeMeta['id']
);
if ($modeMeta['id'] == 1){
$dailyOpenTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ".$modeMeta['daily_open_time']));
$dailyEndTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ".$modeMeta['daily_end_time']));
$nowTimeOffset = myself()->_getDaySecondsOffset(myself()->_getNowTime());
$temp['daily_open_time'] = strtotime($modeMeta['daily_open_time']) ;
$temp['daily_end_time'] = strtotime($modeMeta['daily_end_time']);
$temp['state'] = $nowTimeOffset >= $dailyOpenTimeOffset && $nowTimeOffset <= $dailyEndTimeOffset ? 1 : 0;
}
array_push(
$modeList,
array(
'id' => $modeMeta['id']
)
$temp
);
}
return true;