找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 103|回复: 0

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

[复制链接]

该用户从未签到

发表于 2018-9-24 14:02:10 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

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

         

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

         

         

       
               
                       
                               
                                       
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        01
                                                                               
                                                                                        function FloorTime($seconds)
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        02
                                                                               
                                                                                            {
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        03
                                                                               
                                                                                                $times = '';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        04
                                                                               
                                                                                                $days = floor(($seconds/86400)%30);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        05
                                                                               
                                                                                                $hours = floor(($seconds/3600)%24);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        06
                                                                               
                                                                                                $minutes = floor(($seconds/60)%60);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        07
                                                                               
                                                                                                $seconds = floor($seconds%60);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        08
                                                                               
                                                                                                if($seconds >= 1) $times .= $seconds.'秒';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        09
                                                                               
                                                                                                if($minutes >= 1) $times = $minutes.'分钟 '.$times;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        10
                                                                               
                                                                                                if($hours >= 1) $times = $hours.'小时 '.$times;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        11
                                                                               
                                                                                                if($days >= 1)  $times = $days.'天';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        12
                                                                               
                                                                                                if($days > 30) return false;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        13
                                                                               
                                                                                                $times .= '前';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        14
                                                                               
                                                                                                return str_replace(" ", '', $times);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        15
                                                                               
                                                                                            }
                                                                       
                                                               
                                                       
                                               
                                       
                               
                       
               
       

        替换为以下代码即可:

         

         

       
               
                       
                               
                                       
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        01
                                                                               
                                                                                        function FloorTime($date) {
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        02
                                                                               
                                                                                        $str = '';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        03
                                                                               
                                                                                        $timer = $date;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        04
                                                                               
                                                                                        $diff = $_SERVER['REQUEST_TIME', - $timer;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        05
                                                                               
                                                                                        $day = floor($diff / 86400);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        06
                                                                               
                                                                                        $free = $diff % 86400;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        07
                                                                               
                                                                                        if($day > 0) {
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        08
                                                                               
                                                                                        return $day."天前";
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        09
                                                                               
                                                                                        }else{
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        10
                                                                               
                                                                                        if($free>0){
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        11
                                                                               
                                                                                        $hour = floor($free / 3600);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        12
                                                                               
                                                                                        $free = $free % 3600;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        13
                                                                               
                                                                                        if($hour>0){
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        14
                                                                               
                                                                                        return $hour."小时前";
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        15
                                                                               
                                                                                        }else{
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        16
                                                                               
                                                                                        if($free>0){
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        17
                                                                               
                                                                                        $min = floor($free / 60);
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        18
                                                                               
                                                                                        $free = $free % 60;
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        19
                                                                               
                                                                                        if($min>0){
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        20
                                                                               
                                                                                        return $min."分钟前";
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        21
                                                                               
                                                                                        }else{
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        22
                                                                               
                                                                                        if($free>0){
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        23
                                                                               
                                                                                        return $free."秒前";
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        24
                                                                               
                                                                                        }else{
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        25
                                                                               
                                                                                        return '刚刚';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        26
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        27
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        28
                                                                               
                                                                                        }else{
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        29
                                                                               
                                                                                        return '刚刚';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        30
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        31
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        32
                                                                               
                                                                                        }else{
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        33
                                                                               
                                                                                        return '刚刚';
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        34
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        35
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                               
                                                       
                                                               
                                                                       
                                                                               
                                                                                        36
                                                                               
                                                                                        }
                                                                       
                                                               
                                                       
                                               
                                       
                               
                       
               
       

         

         

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

         

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

        替换为:

         

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

        更改完毕。
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-9-29 11:36

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表