From f7728acefe260e369928b19d167123fb1cfbac64 Mon Sep 17 00:00:00 2001 From: yuanhao0230 <13303461281@189.cn> Date: Tue, 26 May 2020 22:18:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E4=B9=8B=E5=89=8D=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E4=B8=8D=E7=94=9F=E6=95=88=E4=BA=86=EF=BC=8C?= =?UTF-8?q?=E5=A7=8B=E7=BB=88=E6=98=BE=E7=A4=BA=E4=B9=8B=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn.php | 9 +++++++++ extend/fast/Date.php | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 7c28b2bf9..2225deded 100755 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -111,6 +111,15 @@ return [ '%d week%s ago' => '%d周前', '%d month%s ago' => '%d月前', '%d year%s ago' => '%d年前', + // + '%d second%s after' => '%d秒后', + '%d minute%s after' => '%d分钟后', + '%d hour%s after' => '%d小时后', + '%d day%s after' => '%d天后', + '%d week%s after' => '%d周后', + '%d month%s after' => '%d月后', + '%d year%s after' => '%d年后', + // 'Set to normal' => '设为正常', 'Set to hidden' => '设为隐藏', 'Recycle bin' => '回收站', diff --git a/extend/fast/Date.php b/extend/fast/Date.php index 8671476d5..6e82c535b 100644 --- a/extend/fast/Date.php +++ b/extend/fast/Date.php @@ -124,7 +124,9 @@ class Date */ public static function human($remote, $local = null) { - $timediff = (is_null($local) || $local ? time() : $local) - $remote; + $local = is_null($local) || $local ? time() : $local; + $type = ($remote > $local) ? 'after' : 'ago'; + $timediff = abs($local - $remote); $chunks = array( array(60 * 60 * 24 * 365, 'year'), array(60 * 60 * 24 * 30, 'month'), @@ -142,7 +144,7 @@ class Date break; } } - return __("%d {$name}%s ago", $count, ($count > 1 ? 's' : '')); + return __("%d {$name}%s {$type}", $count, ($count > 1 ? 's' : '')); } /** -- Gitee