From 80344d69d9b2d3d64a4710126c3d279a5c0aa70a Mon Sep 17 00:00:00 2001 From: li Date: Tue, 31 Mar 2026 10:51:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=AC=E5=91=8A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E5=AE=9E=E6=97=B6=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 公告列表和详情页的时间改为显示当前实时时间 不再显示数据库中存储的旧创建时间(2022-11-09) --- application/api/controller/Index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index 623d056..f29a874 100755 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -64,7 +64,8 @@ class Index extends Api ->order('id desc') ->paginate(20,false,['query' => request()->param()]); foreach ($message as $key => $value) { - $value['createtime'] = date("Y-m-d H:i:s",$value['createtime']); + // 公告时间跟随实时变动,显示当前时间 + $value['createtime'] = date("Y-m-d H:i:s", time()); switch ($lang) { case "zh-cn": $value['content'] = strip_tags($value['content']); @@ -129,7 +130,8 @@ class Index extends Api if(empty($message)){ $this->error(__("内容不存在")); } - $message['createtime'] = date("Y-m-d H:i:s",$message['createtime']); + // 公告时间跟随实时变动 + $message['createtime'] = date("Y-m-d H:i:s", time()); switch ($lang) { case "zh-cn": $message['content'] = str_replace("src=\"","src=\"".Config::get("site.image_url"), $message['content']);