|
@@ -22,12 +22,19 @@ trait StationGet
|
|
|
}
|
|
|
public function getIsOnlineAttr($value){
|
|
|
$state=$this->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>300){
|
|
|
+ if($int>600){
|
|
|
return '0';
|
|
|
}else{
|
|
|
return '1';
|
|
@@ -35,6 +42,15 @@ trait StationGet
|
|
|
}
|
|
|
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');
|
|
|
}
|
|
@@ -45,12 +61,20 @@ trait StationGet
|
|
|
}
|
|
|
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>300){
|
|
|
+ if($int>600){
|
|
|
return '离线';
|
|
|
}else{
|
|
|
return '在线';
|