From a50e90b2a3737333fb920688b45be54bbd4b49aa Mon Sep 17 00:00:00 2001 From: cloud Date: Wed, 30 Dec 2020 23:43:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=88=E5=90=8C=E5=88=B0?= =?UTF-8?q?=E6=9C=9F=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/traits/tdata.class.php | 2 +- src/update/update.class.php | 2 +- web/timing.class.php | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/traits/tdata.class.php b/include/traits/tdata.class.php index 2341e79..93967f4 100644 --- a/include/traits/tdata.class.php +++ b/include/traits/tdata.class.php @@ -486,7 +486,7 @@ trait tdata $where .= self::td_search(); break; case 'noticeday': - $where .= ' AND endtime = CURDATE()'; //订单到期前后展示3天 // DATE_ADD + $where .= " AND endtime = CURDATE() "; //订单到期前后展示3天 // DATE_ADD break; default: // 如果$where 没有值 会导致计算结果出错,导致前台表格无法获取正确的值,分页显示异常 diff --git a/src/update/update.class.php b/src/update/update.class.php index f091e9e..d0b31a8 100644 --- a/src/update/update.class.php +++ b/src/update/update.class.php @@ -355,7 +355,7 @@ class update extends admin $array['noticeday'] = " CREATE VIEW {$noticeday} AS SELECT DISTINCT ct.*, - substring_index( substring_index( {$h_noticeday}, ',', sq.seq ), ',',- ( 1 ) ) AS noticeday, + cast(substring_index( substring_index( {$h_noticeday}, ',', sq.seq ), ',',- ( 1 ) ) AS signed) AS noticeday, DATE_SUB(ct.h_endtime,INTERVAL substring_index( substring_index( {$h_noticeday}, ',', sq.seq ), ',',- ( 1 ) ) DAY) AS endtime FROM {$sequence} AS sq INNER JOIN {$contract} AS ct diff --git a/web/timing.class.php b/web/timing.class.php index 86a0d79..5d33d91 100644 --- a/web/timing.class.php +++ b/web/timing.class.php @@ -59,25 +59,24 @@ class timing extends appweb $num = ['daya' => 0, 'dayb' => 0, 'dayc' => 0]; //查询到期订单 //查询的是设置的提醒天数,以及订单结束日期的前后3天数 - $where = " endtime = CURDATE() OR (h_endtime BETWEEN CURDATE() AND DATE_ADD( CURDATE(), INTERVAL 3 DAY ) ) "; + $where = " AND endtime = CURDATE() AND noticeday >= 0 "; $noticeday = $this->tsql->table('noticeday')->where($where)->all(); foreach ($noticeday as $val) { - //延时2秒 + //延时2秒 // 通知天数 noticeday sleep(3); - $h_endtime = strtotime($val['h_endtime']); //首先判断当前这条信息是属于到期前台3天的 还是属于设置的提醒 //那就是判断订单结束时间和今天的相差天数 - $day = abs(($h_endtime - $strdate) / 86400); + $day = $val['noticeday']; if ($day > 3) { //按照设置的提醒来计算 - $htypes = "合同 {$val['noticeday']} 天后到期提醒"; + $htypes = "合同 {$day} 天后到期提醒"; //蓝色 $color = "#57c7d4"; $type = 1; $num['daya']++; } else { //说明还没到期 - if ($h_endtime > $strdate) { + if ($day > 0) { $htypes = "合同 {$day} 天后到期"; //黄色 $color = "#f2a654";