|
@@ -78,6 +78,8 @@ class CameraApiController extends BaseController
|
|
public function getTotalNingmei(){
|
|
public function getTotalNingmei(){
|
|
$result['status'] = true;
|
|
$result['status'] = true;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
$result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
|
|
+ $data = [];
|
|
|
|
+ $type = Input::get('type', '');
|
|
|
|
|
|
//宁煤集团
|
|
//宁煤集团
|
|
$ningmei = DB::table('mine_list')->where('title',config('mine_hls'))->get();
|
|
$ningmei = DB::table('mine_list')->where('title',config('mine_hls'))->get();
|
|
@@ -107,16 +109,40 @@ class CameraApiController extends BaseController
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //宁煤在离线数量
|
|
|
|
- $data[0]['title'] = '宁煤公司';
|
|
|
|
- $data[0]['mine_code'] = $ningmei[0]->slug;
|
|
|
|
- $data[0]['total'] = DB::table('camera_list')->whereIn('mine_id',$mine_ningmei)->where('deleted_at',null)->count();
|
|
|
|
- $data[0]['total_online'] = DB::table('camera_list')->whereIn('mine_id',$mine_ningmei)->where('camera_status',1)->where('deleted_at',null)->count();
|
|
|
|
- $data[0]['total_offline'] = $data[0]['total'] - $data[0]['total_online'];
|
|
|
|
- $data[0]['rate'] = round($data[0]['total_online'] / $data[0]['total'] * 100,2)."%";
|
|
|
|
|
|
+ if($type == 'nmjt' || $type == ''){
|
|
|
|
+ //宁煤在离线数量
|
|
|
|
+ $data[0]['title'] = '宁煤公司';
|
|
|
|
+ $data[0]['mine_code'] = $ningmei[0]->slug;
|
|
|
|
+ $data[0]['total'] = DB::table('camera_list')->whereIn('mine_id',$mine_ningmei)->where('deleted_at',null)->count();
|
|
|
|
+ $data[0]['total_online'] = DB::table('camera_list')->whereIn('mine_id',$mine_ningmei)->where('camera_status',1)->where('deleted_at',null)->count();
|
|
|
|
+ $data[0]['total_offline'] = $data[0]['total'] - $data[0]['total_online'];
|
|
|
|
+ $data[0]['rate'] = round($data[0]['total_online'] / $data[0]['total'] * 100,2)."%";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($type == 'nmjt'){
|
|
|
|
+ return self::successResponse($data);
|
|
|
|
+ }
|
|
|
|
|
|
//宁煤下各矿在离线数量
|
|
//宁煤下各矿在离线数量
|
|
- $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->where('deleted_at',null)->get();
|
|
|
|
|
|
+ if($type == 'mtdw'){
|
|
|
|
+ $where = ['1941', '1982', '2019', '2099', '2160', '2181', '2193', '2226', '2258', '2307', '2308', '2323', '2324', '2345', '2376', '2405', '2923', '2427', '2429', '6157'];
|
|
|
|
+ $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->whereIn('id',$where)->where('deleted_at',null)->get();
|
|
|
|
+ }elseif($type == 'hgdw'){
|
|
|
|
+ $where = ['2447', '2525', '2557', '2576', '3868', '2597', '3452'];
|
|
|
|
+ $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->whereIn('id',$where)->where('deleted_at',null)->get();
|
|
|
|
+ }elseif($type == 'ndtl'){
|
|
|
|
+ $where = ['6001'];
|
|
|
|
+ $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->whereIn('id',$where)->where('deleted_at',null)->get();
|
|
|
|
+ }elseif($type == 'qtdw'){
|
|
|
|
+ $where = ['2628', '2599', '2600', '2611', '3167'];
|
|
|
|
+ $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->whereIn('id',$where)->where('deleted_at',null)->get();
|
|
|
|
+ }elseif($type == 'gfx'){
|
|
|
|
+ $where = ['4272'];
|
|
|
|
+ $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->whereIn('id',$where)->where('deleted_at',null)->get();
|
|
|
|
+ }else{
|
|
|
|
+ $mine_list = DB::table('mine_list')->where('parent_id',$ningmei[0]->id)->where('deleted_at',null)->get();
|
|
|
|
+ }
|
|
|
|
+
|
|
foreach($mine_list as $k => $v){
|
|
foreach($mine_list as $k => $v){
|
|
$mine_use = [];//宁煤下每个矿所有区域
|
|
$mine_use = [];//宁煤下每个矿所有区域
|
|
foreach($mine_all as $key=>$value){
|
|
foreach($mine_all as $key=>$value){
|
|
@@ -144,6 +170,7 @@ class CameraApiController extends BaseController
|
|
$res['total_offline'] = $total - $total_online;
|
|
$res['total_offline'] = $total - $total_online;
|
|
$res['rate'] = $rate;
|
|
$res['rate'] = $rate;
|
|
}else{
|
|
}else{
|
|
|
|
+
|
|
if($v->slug == 'ShuiDianFenGongSi'){
|
|
if($v->slug == 'ShuiDianFenGongSi'){
|
|
$v->title = '供电分公司';
|
|
$v->title = '供电分公司';
|
|
}
|
|
}
|