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


本文整理自网络,侵删。

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

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

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

function FloorTime($seconds)
    {
        $times = '';
        $days = floor(($seconds/86400)%30);
        $hours = floor(($seconds/3600)%24);
        $minutes = floor(($seconds/60)%60);
        $seconds = floor($seconds%60);
        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,找到

(<font color="#FF0000">{dede:field.mtime function="floorTime(time()-@me,@me)"/}</font>)

替换为:

(<font color="#FF0000">{dede:field.mtime function="floorTime(@me)"/}</font>)

更改完毕。


标签:织梦DedeCMS

相关阅读 >>

php下cms程序转移服务器的一般步骤

dedecms实现有短标题时显示短标题、无短标题时显示长标题的方法

dedecms后台验证码总提示错误的解决方法

织梦DedeCMS后台文件列表按文件名排序的方法简介

dedecms会员信息在个人模板info和index的调用问题

dede currentstyle属性完美解决方案

分享两个dedecms分页样式css代码

php 截取字符串专题集合

织梦DedeCMS 去掉后台登陆验证码的方法

js获取ueditor富文本编辑器中的图片地址

更多相关阅读请进入《织梦DedeCMS》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...