wzh 5 éve
szülő
commit
f14fb4d358
1 módosított fájl, 27 hozzáadás és 0 törlés
  1. 27 0
      api/application/controllers/Home.php

+ 27 - 0
api/application/controllers/Home.php

@@ -177,4 +177,31 @@ class Home extends Base_Controller {
         }
         exit(json_result('0000',$this->response['0000'],$data));
     }
+
+    // 获取单个路灯的经纬度
+    public function get_lng_lat(){
+        $lampid = $this->input->post('lampid',true);
+        $projectid = $this->input->post('projectid',true);
+        $section = $this->input->post('section',true);
+        $lampData = array();
+        if (!empty($lampid)) {
+            $where = array('id'=>$lampid,'longitude !='=>0,'latitude !='=>0);
+            if (!empty($section)) {
+                $where['section'] = $section;
+            }
+            $lampData = $this->Lamp_model->get_one($where,'longitude,latitude');
+        }
+        if (!empty($projectid)) {
+            $where = array('projectid'=>$projectid,'longitude !='=>0,'latitude !='=>0);
+            if (!empty($section)) {
+                $where['section'] = $section;
+            }
+            $lampData = $this->Lamp_model->get_one($where,'longitude,latitude');
+        }
+
+        if (empty($lampData)) {
+            $lampData = array('longitude'=>0,'latitude'=>0);
+        }
+        exit(json_result('0000',$this->response['0000'],$lampData));
+    }
 }