time).str_repeat(" ",4096); //----------------------------------加快信息响应------中段--------------------------- // 过滤 if (!in_array(M_ACTION, $this->ado,true)) { //报错 exit(0); } //----------------------------------加快信息响应------中段--------------------------- $size = ob_get_length(); header("Content-Length: $size"); ob_end_flush(); flush(); if (function_exists("fastcgi_finish_request")) { fastcgi_finish_request(); } ignore_user_abort(true); set_time_limit(0); //----------------------------------加快信息响应------结束--------------------------- } # 每天凌晨后或者早上6点之前进行广告位排期处理 # 主要计算排期是否过期,是否已经提到开始排期了 public function doindex() { global $_M, $_YW; $this->webase = load::own_class('../met_wechat/include/class/LW_BASE', 'new'); //当天日期时间 $curdate = date('Y-m-d',$this->time); $strdate = strtotime($curdate); $num = ['daya' => 0,'dayb' => 0,'dayc' => 0]; //查询到期订单 //查询的是设置的提醒天数,以及订单结束日期的前后3天数 $where = " endtime = CURDATE() OR (h_endtime BETWEEN CURDATE() AND DATE_ADD( CURDATE(), INTERVAL 3 DAY ) ) "; $noticeday = $this->tsql->table('noticeday')->where($where)->all(); foreach ($noticeday as $val) { //延时2秒 sleep(3); $h_endtime = strtotime($val['h_endtime']); //首先判断当前这条信息是属于到期前台3天的 还是属于设置的提醒 //那就是判断订单结束时间和今天的相差天数 $day = abs(($h_endtime - $strdate) / 86400); if($day > 3){ //按照设置的提醒来计算 $htypes = "合同 {$val['noticeday']} 天后到期提醒"; //蓝色 $color = "#57c7d4"; $type = 1; $num['daya']++; }else{ //说明还没到期 if($h_endtime > $strdate){ $htypes = "合同 {$day} 天后到期"; //黄色 $color = "#f2a654"; $type = 1; $num['dayb']++; }else{ $htypes = "合同今天到期"; //红色 $color = "#F96868"; $type = 2; $num['dayc']++; } } //公司名称 $customer = $this->tsql->table('customer')->where(['id' => $val['h_cid']])->one(); //签定人员 $w_name = []; $workerswid = stringto_array($val['h_wid'],','); foreach ($workerswid as $hwid) { $workers = $this->tsql->table('workers')->where(['id' => $hwid])->one(); $w_name[] = $workers['w_name']; } //整理内容 $val['first'] = ['value' => $htypes, 'color' => $color]; $val['c_allname'] = $customer['c_allname']; $val['wnamestr'] = arrayto_string($w_name,','); //发送通知 parent::postdata($type,$val)->openid(); } //以上为定时通知或者到期通知 //增加一个今天要上架的投放 $num['dayd'] = $this->tsql->table('launch')->where(" l_starttime = CURDATE() ")->count(); parent::postdata(3,$num)->openid(); die(); } } ?>