Przeglądaj źródła

摄像头类型修改

任敬轩 1 rok temu
rodzic
commit
27342f4354

+ 21 - 1
Modules/Camera/Http/Controllers/Api/CameraApiController.php

@@ -1309,7 +1309,27 @@ class CameraApiController extends BaseController
 
     //摄像头下拉列表
     public function cameraSelect(Request $request){
-        $result = 11;
+        $result = '<select style="width:99%;" class="form-control" name="select_list"><option value="0">-选择模块-</option>';
+
+        $mine_list = DB::table('mine_list')->where('parent_id',6356)->where('deleted_at',null)->get();
+
+        if(count($mine_list) > 0){
+            for($i=0;$i<count($mine_list);$i++){
+                $camera_list = DB::table('camera_list')->where('mine_id',$mine_list[$i]->id)->where('is_show',1)->where('deleted_at',null)->get();
+
+                if(count($camera_list) > 0){
+                    $result = $result . '<optgroup label="' . $mine_list[$i]->title . '">';
+
+                    for($j=0;$j<count($camera_list);$j++){
+                        $result = $result . '<option value="'.$camera_list[$j]->id.'">'.$camera_list[$j]->camera_name.'</option>';
+                    }
+
+                    $result = $result . '</optgroup>';
+                }
+            }
+        }
+
+        $result = $result . '</select>';
 
         return $result;
     }