online_state; if($state=='2'){ return '0'; } $config=Env::get('app.station_state'); if(!$config){ return '1'; } if($state=='1'){ return '1'; } $value = strtotime($this->online_time); $int=time()-$value; if($int>600){ return '0'; }else{ return '1'; } } public function getOnlineTimeAttr($value){ $state=$this->online_state; if($state=='2'){ $time=time()-3600*mt_rand(3,9); return date('Y-m-d H:i:s',$time); } $config=Env::get('app.station_state'); if(!$config){ $time=time()-mt_rand(5,3600); return date('Y-m-d H:i:s',$time); } if($state=='1'){ return date('Y-m-d H:i:s'); } if($value){ return $value; } return '-'; } public function getIsOnlineTextAttr($value){ $state=$this->online_state; if($state=='2'){ return '离线'; } $config=Env::get('app.station_state'); if(!$config){ return '在线'; } if($state=='1'){ return '在线'; } $value = strtotime($this->online_time); $int=time()-$value; if($int>600){ return '离线'; }else{ return '在线'; } } }