国内外主机
测评及优惠码

DEDECMS后台会员消费记录人性化时间显示不准的解决方法

EDECMS的后台会员消费记录存在BUG,在消费时间后边跟随的人性化时间不准确,一年前的单子也显示几天前。需要进行修改。

 

1、打开include/helpers/time.helper.php,找到

 

 

function FloorTime($seconds)
    {
        $times '';
        $days = floor(($seconds/86400)0);
        $hours = floor(($seconds/3600)$);
        $minutes = floor(($seconds/60)`);
        $seconds = floor($seconds`);
        if($seconds >= 1) $times .= $seconds.'秒';
        if($minutes >= 1) $times = $minutes.'分钟 '.$times;
        if($hours >= 1) $times = $hours.'小时 '.$times;
        if($days >= 1)  $times = $days.'天';
        if($days > 30) return false;
        $times .= '前';
        return str_replace(" "'', $times);
    }

替换为以下代码即可:

 

 

function FloorTime($date) {
$str = '';
$timer = $date;
$diff = $_SERVER['REQUEST_TIME'] - $timer;
$day = floor($diff / 86400);
$free = $diff % 86400;
if($day > 0) {
return $day."天前";
}else{
if($free>0){
$hour = floor($free / 3600);
$free = $free % 3600;
if($hour>0){
return $hour."小时前";
}else{
if($free>0){
$min = floor($free / 60);
$free = $free % 60;
if($min>0){
return $min."分钟前";
}else{
if($free>0){
return $free."秒前";
}else{
return '刚刚';
}
}
}else{
return '刚刚';
}
}
}else{
return '刚刚';
}
}
}

 

 

2、打开后台管理目录下的templets/member_operations.htm,找到

 

({dede:field.mtime function="floorTime(time()-@me,@me)"/})

 

替换为:

 

({dede:field.mtime function="floorTime(@me)"/})

 

更改完毕。

 
赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《DEDECMS后台会员消费记录人性化时间显示不准的解决方法》
文章链接:https://www.ibytx.com/1180.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

登录

找回密码

注册