diff --git a/public/themes/simpleboot3/portal/order/get_one.html b/public/themes/simpleboot3/portal/order/get_one.html index e5b2e05..414ca6c 100644 --- a/public/themes/simpleboot3/portal/order/get_one.html +++ b/public/themes/simpleboot3/portal/order/get_one.html @@ -180,17 +180,30 @@ </script> <script> - var starttime = new Date("2019/6/9"); - setInterval(function() { - var nowtime = new Date(); - var time = nowtime - starttime; - var hour = parseInt(time / 1000 / 60 / 60 % 24); - var minute = parseInt(time / 1000 / 60 % 60); - var seconds = parseInt(time / 1000 % 60); - $('.timespan').html(hour + "时" + minute + "分" + seconds + "秒后"); - console.log(hour); - console.log(minute); - console.log(seconds) - }, 1000); + var lastTime = {$data.create_time} + 86400; //最后时间时间戳(秒) + var currentTime = Date.parse(new Date()) / 1000; //当前时间时间戳(秒) + console.log(currentTime); + var intDiff = parseInt(lastTime - currentTime); //倒计时总秒数量 + function timer(intDiff) { + window.setInterval(function() { + var day = 0, + hour = 0, + minute = 0, + second = 0; //时间默认值 + if(intDiff > 0) { + day = Math.floor(intDiff / (60 * 60 * 24)); + hour = Math.floor(intDiff / (60 * 60)) - (day * 24); + minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60); + second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60); + } + if(minute <= 9) minute = '0' + minute; + if(second <= 9) second = '0' + second; + var time = hour + '时' + minute + '分' + second + '秒' + console.log(time); + $('.timespan').html(time) + intDiff--; + }, 1000); + } + timer(intDiff); </script> </html> \ No newline at end of file diff --git a/simplewind/cmf/controller/WeChatBaseController.php b/simplewind/cmf/controller/WeChatBaseController.php index ec05b23..3496b85 100644 --- a/simplewind/cmf/controller/WeChatBaseController.php +++ b/simplewind/cmf/controller/WeChatBaseController.php @@ -204,7 +204,7 @@ class WeChatBaseController extends BaseController */ public function checkWeChatUserLogin() { - /*$user = Db::name('user')->where('id',5)->find(); + /*$user = Db::name('user')->where('id',5)->find(); cmf_update_current_user($user);*/ $userId = cmf_get_current_user_id(); if (empty($userId)) {