query($sql); $count = 1; foreach ($lampinfoList as $lampinfo) { if ($lampinfo['status'] == 1 && $lampinfo['lighteness'] > 0) $count ++; } $allCount = count($lampinfoList); $db->table('network')->where('projectid=30319')->update(array('status'=>1)); $now = explode(':', $end); $now = intval($now[0]) * 60 + intval($now[1]); if (1) { if ($now >= 18 * 60 || $now < 8 * 60) { $lighteness = 100; $db->table('lampinfo')->where('projectid=30319')->update(array('status'=>1,'lighteness'=>$lighteness)); } if ($end == '08:00') { $lighteness = 0; $db->table('lampinfo')->where('projectid=30319')->update(array('status'=>0,'lighteness'=>$lighteness)); } $db->table('network')->where('projectid=30319')->update(array('status'=>1)); }else{ foreach ($lampinfoList as $lampinfo) { if (empty($lampinfo['logtime']) || time() - strtotime($lampinfo['logtime']) > 10*3600) { $db->table('network')->where('id='.$lampinfo['networkid'])->update(array('status'=>0)); } } } $db->close(); }