db = \Zend_Registry::get('db'); }else{ $this->db = $db; } $this->config = \Zend_Registry::get('config'); } function Fetch() { $sql = "SELECT * FROM ".$this->tbl_dataservice.""; $rs = $this->db->query($sql); return $rs->fetchAll(); } function get($uuid) { $sql = "SELECT * FROM ".$this->tbl_dataservice." WHERE uuid='$uuid' LIMIT 1"; $rs = $this->db->query($sql); return $rs->fetch(); } public function getWsnData($type,$uuid = "",$param = ""){ include_once("helper/view.php"); $dataservice = new \data\DataService(); $info = $dataservice->get($uuid); $curl = new \helper\Curl(); if($type == 'site') { $param = array( //'uuid'=>$uuid, 'uuid'=>'78e2423f-fe4a-4f9e-a368-c932afc5d257', ///TEST TEST TEST 'uid'=>\view::User('id') ); $data = $curl->request($info['service_url']."site/",$param,"POST"); $data = json_decode($data['response'],TRUE); }//site if($type == 'var') { $param_temp = array( //'uuid'=>$uuid, 'uuid'=>'78e2423f-fe4a-4f9e-a368-c932afc5d257', ///TEST TEST TEST 'uid'=>\view::User('id'), ); $param = array_merge($param,$param_temp); $data = $curl->request($info['service_url']."var/",$param,"POST"); $data = json_decode($data['response'],TRUE); } if($data['status'] == 0) { return $data['error']; } else if($data['status'] == 1) { return $data['data']; } else { return NULL; } }//获取Wsn数据 }