|
@@ -46,7 +46,7 @@ class Station extends Model
|
|
{
|
|
{
|
|
$res = $this->dataRange()
|
|
$res = $this->dataRange()
|
|
->catchSearch()
|
|
->catchSearch()
|
|
- ->append(['is_online'])
|
|
|
|
|
|
+ ->append(['is_online','is_online_text'])
|
|
->order($this->aliasField('online_time'), 'desc')
|
|
->order($this->aliasField('online_time'), 'desc')
|
|
->paginate()->each(function($item, $key) {
|
|
->paginate()->each(function($item, $key) {
|
|
$wgsLoc = \algorithm\Geometry::convertGcj02ToBd09((float)$item['latitude'],(float)$item['longitude']);
|
|
$wgsLoc = \algorithm\Geometry::convertGcj02ToBd09((float)$item['latitude'],(float)$item['longitude']);
|
|
@@ -56,6 +56,20 @@ class Station extends Model
|
|
|
|
|
|
return $res;
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function getMapList(){
|
|
|
|
+ $res = $this->dataRange()
|
|
|
|
+ ->catchSearch()
|
|
|
|
+ ->append(['is_online','is_online_text'])
|
|
|
|
+ ->order($this->aliasField('online_time'), 'desc')
|
|
|
|
+ ->paginate()->each(function($item, $key) {
|
|
|
|
+ $wgsLoc = \algorithm\Geometry::gcj02ToWgs84((float)$item['latitude'],(float)$item['longitude']);
|
|
|
|
+ $item['longitude']=$wgsLoc['lng'];
|
|
|
|
+ $item['latitude']=$wgsLoc['lat'];
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return $res;
|
|
|
|
+ }
|
|
public function getAllList(){
|
|
public function getAllList(){
|
|
$res = $this
|
|
$res = $this
|
|
->catchSearch()
|
|
->catchSearch()
|
|
@@ -68,7 +82,7 @@ class Station extends Model
|
|
$item['longitude']=$wgsLoc['lng'];
|
|
$item['longitude']=$wgsLoc['lng'];
|
|
$item['latitude']=$wgsLoc['lat'];
|
|
$item['latitude']=$wgsLoc['lat'];
|
|
})->toArray();
|
|
})->toArray();
|
|
-
|
|
|
|
|
|
+
|
|
return $res;
|
|
return $res;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -86,6 +100,13 @@ class Station extends Model
|
|
return $query->where('shortcode|mac', 'like', '%'.$value.'%');
|
|
return $query->where('shortcode|mac', 'like', '%'.$value.'%');
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
|
|
+ * 关键字
|
|
|
|
+ */
|
|
|
|
+ public function searchKeywordsAttr($query, $value, $data)
|
|
|
|
+ {
|
|
|
|
+ return $query->where('name|mac', 'like', '%'.$value.'%');
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
* 根据状态搜索
|
|
* 根据状态搜索
|
|
*/
|
|
*/
|
|
public function searchOnlineStateAttr($query, $value, $data)
|
|
public function searchOnlineStateAttr($query, $value, $data)
|