From 159d15006f0862761aa5487572b0c8ac961b780b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 22 Dec 2020 19:59:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=B3=BB=E7=BB=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/phpcommon | 2 +- webapp/controller/GMController.class.php | 32 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) 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); + } + + }