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";