diff --git a/third_party/phpcommon b/third_party/phpcommon index 2ca4273..d56fa02 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 2ca4273f80ca9a19ddd282e331229ea1b853d372 +Subproject commit d56fa02411e557908dc2f4f319877a0af70c7957 diff --git a/webapp/controller/GMController.class.php b/webapp/controller/GMController.class.php index 49cb1fe..bcb61c6 100644 --- a/webapp/controller/GMController.class.php +++ b/webapp/controller/GMController.class.php @@ -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); + } + + }