Esempio n. 1
0
 public function PrevWeekTotal($stationid, $sdate, $edate)
 {
     $edate = date('Y-m-d', strtotime($sdate) - 3600 * 24);
     $sdate = date('Y-m-d', strtotime($sdate) - 3600 * 24 * 7);
     $reg_sdate = date('Y_m_d', strtotime($sdate));
     $reg_edate = date('Y_m_d', strtotime($edate));
     $reg_where = " and date BETWEEN '{$reg_sdate}' AND '{$reg_edate}'";
     $connect_where = " and date BETWEEN '{$sdate}' AND '{$edate}'";
     $obj = new Psys_StationRule();
     $data = $obj->PrevWeekTotal($stationid, $reg_where, $connect_where);
     //获取填充数据
     $fillarray = $this->fillarray($sdate, $edate, 1);
     //2015-02-11
     $fillarray_ = $this->fillarray($sdate, $edate);
     //2015_02_11
     //格式化连接数组
     $data['connect'] = $this->arrayformat($data['connect'], 'num');
     $data['connect'] += $fillarray;
     ksort($data['connect']);
     $data['reg'] = $this->arrayformat($data['reg'], 'reg');
     $data['reg'] += $fillarray_;
     ksort($data['reg']);
     $data['down'] = $this->arrayformat($data['down'], 'down');
     $data['down'] += $fillarray_;
     ksort($data['down']);
     return $data;
 }