Пример #1
0
 function getOnlineConfiguration()
 {
     $this->load->model('servicepublicclass/onlineconfigpublic', 'onlineconfigpublic');
     if (!isset($_POST["content"])) {
         $ret = array('flag' => -3, 'msg' => 'Invalid content.');
         echo json_encode($ret);
         return;
     }
     $encoded_content = $_POST['content'];
     log_message('debug', $encoded_content);
     $content = json_decode($encoded_content);
     $onlineconfig = new onlineconfigpublic();
     $onlineconfig->loadonlineconfig($content);
     $key = $onlineconfig->appkey;
     log_message('debug', $key);
     if (!isset($key)) {
         $ret = array('flag' => -2, 'msg' => 'Invalid key.');
         echo json_encode($ret);
         return;
     } else {
         $isKeyAvailable = $this->utility->isKeyAvailale($key);
         if (!$isKeyAvailable) {
             $ret = array('flag' => -1, 'msg' => 'NotAvailable appkey ');
             echo json_encode($ret);
             return;
         } else {
             try {
                 $productid = $this->onlineconfig->getProductid($key);
                 $configmessage = $this->onlineconfig->getConfigMessage($productid);
                 if ($configmessage != null) {
                     $ret = array('flag' => 1, 'msg' => 'ok', 'autogetlocation' => $configmessage->autogetlocation, 'updateonlywifi' => $configmessage->updateonlywifi, 'sessionmillis' => $configmessage->sessionmillis, 'reportpolicy' => $configmessage->reportpolicy);
                 }
             } catch (Exception $ex) {
                 $ret = array('flag' => -4, 'msg' => 'DB Error');
             }
         }
         echo json_encode($ret);
     }
 }
Пример #2
0
 /**
  * Used to get Online Configuration
  *
  * @return void
  */
 function getOnlineConfiguration()
 {
     $ret = $this->_checkJsonData();
     if ($ret == null) {
         try {
             $this->load->model($this->_prefix . '/onlineconfig', 'onlineconfig');
             $this->load->model('servicepublicclass/onlineconfigpublic', 'online');
             $online = new onlineconfigpublic();
             $online->loadonlineconfig($this->_jsondata);
             $productid = $this->onlineconfig->getProductid($online->appkey);
             $configmessage = $this->onlineconfig->getConfigMessage($productid);
             if ($configmessage != null) {
                 $ret = array('flag' => 1, 'msg' => 'ok', 'autogetlocation' => $configmessage->autogetlocation, 'updateonlywifi' => $configmessage->updateonlywifi, 'sessionmillis' => $configmessage->sessionmillis, 'reportpolicy' => $configmessage->reportpolicy);
             }
         } catch (Exception $ex) {
             $ret = array('flag' => -4, 'msg' => 'DB Error');
         }
     }
     echo json_encode($ret);
 }