30 lines
863 B
PHP
30 lines
863 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\controller;
|
||
|
|
|
||
|
|
use think\facade\Db;
|
||
|
|
|
||
|
|
class Monitor
|
||
|
|
{
|
||
|
|
public function MonitorList(){
|
||
|
|
$list =Db::table('charge_station')->column('charge_station_name');
|
||
|
|
foreach ($list as $ll){
|
||
|
|
$message = Db::table('rtspaddr')->field('name')->where('charge_station_name',$ll)->select()->toArray();
|
||
|
|
$i = 0;
|
||
|
|
foreach ($message as $mess){
|
||
|
|
$message[$i]['station'] = $message[$i]['name'];
|
||
|
|
array_diff_key($message[$i],['name' => 'xy']);
|
||
|
|
$i+=1;
|
||
|
|
}
|
||
|
|
$kk['station'] = $ll;
|
||
|
|
$kk['children'] = $message;
|
||
|
|
$ss[] = $kk;
|
||
|
|
}
|
||
|
|
return json($ss);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function MonitorId($MonitorName){
|
||
|
|
$id = Db::table('rtspaddr')->where('name',$MonitorName)->value('id');
|
||
|
|
return json(['id' => $id]);
|
||
|
|
}
|
||
|
|
}
|