Beispiel #1
0
 function getApplicationUpdate()
 {
     $this->load->model('servicepublicclass/applicationupdatepublic', 'applicationupdatepublic');
     header("Content-Type:application/json");
     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);
     $application = new applicationupdatepublic();
     $application->loadapplicationupdate($content);
     $retParamsCheck = $this->utility->isPraramerValue($content, $array = array("appkey", "version_code"));
     if ($retParamsCheck["flag"] <= 0) {
         $ret = array('flag' => -2, 'msg' => $retParamsCheck['msg']);
         echo json_encode($ret);
         return;
     }
     $key = $application->appkey;
     $version_code = $application->version_code;
     $isKeyAvailable = $this->utility->isKeyAvailale($key);
     if (!$isKeyAvailable) {
         $ret = array('flag' => -1, 'msg' => 'NotAvailable appkey ');
         echo json_encode($ret);
         return;
     } else {
         $haveNewversion = $this->update->haveNewversion($key, $version_code);
         if (!$haveNewversion) {
             $ret = array('flag' => -7, 'msg' => 'no new version');
             echo json_encode($ret);
             return;
         } else {
             try {
                 $product = $this->update->getProductUpdate($key);
                 if ($product != null) {
                     $ret = array('flag' => 1, 'msg' => 'ok', 'fileurl' => $product->updateurl, 'forceupdate' => $product->man, 'description' => $product->description, 'time' => $product->date, 'version' => $product->version);
                 }
             } catch (Exception $ex) {
                 $ret = array('flag' => -4, 'msg' => 'DB Error');
             }
         }
         echo json_encode($ret);
     }
 }
Beispiel #2
0
 /**
  * Get Application Update by version no
  *
  * @return void
  */
 function getApplicationUpdate()
 {
     $ret = $this->_checkJsonData();
     if ($ret == null) {
         $this->load->model($this->_prefix . '/update', 'update');
         $this->load->model('servicepublicclass/applicationupdatepublic', 'applicationupdatepublic');
         $updateobj = new applicationupdatepublic();
         $updateobj->loadapplicationupdate($this->_jsondata);
         $key = $updateobj->appkey;
         $version_code = $updateobj->version_code;
         $haveNewversion = $this->update->haveNewversion($key, $version_code);
         if (!$haveNewversion) {
             $ret = array('flag' => -7, 'msg' => 'no new version');
         } else {
             try {
                 $product = $this->update->getProductUpdate($key);
                 if ($product != null) {
                     $ret = array('flag' => 1, 'msg' => 'ok', 'fileurl' => $product->updateurl, 'forceupdate' => $product->man, 'description' => $product->description, 'time' => $product->date, 'version' => $product->version);
                 }
             } catch (Exception $ex) {
                 $ret = array('flag' => -4, 'msg' => 'DB Error');
             }
         }
     }
     echo json_encode($ret);
 }