添加系统时间设置

This commit is contained in:
aozhiwei 2020-12-22 19:59:44 +08:00
parent f110779fee
commit 159d15006f
2 changed files with 33 additions and 1 deletions

@ -1 +1 @@
Subproject commit 2ca4273f80ca9a19ddd282e331229ea1b853d372
Subproject commit d56fa02411e557908dc2f4f319877a0af70c7957

View File

@ -36,4 +36,36 @@ class GMController {
return $conn;
}
public function clearDB()
{
}
public function getSysTime()
{
echo phpcommon\timestamp_to_datetime(phpcommon\getNowTime());
}
public function setSysTime()
{
if (!defined('GLOBAL_TIME_OFFSET_KEY')) {
die('不支持设置系统时间');
return;
}
$newtime = strtotime($_REQUET['newtime']);
if ($newtime <= 0) {
die('时间格式错误');
return;
}
$time_offset = $newtime - phpcommon\getRealTime();
$r = new phpcommon\Redis(array(
'host' => '127.0.0.1',
'port' => 6379,
'passwd' => ''
));
$r->set(GLOBAL_TIME_OFFSET_KEY, $time_offset);
}
}