當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Batch::updateStatus方法代碼示例

本文整理匯總了PHP中Batch::updateStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP Batch::updateStatus方法的具體用法?PHP Batch::updateStatus怎麽用?PHP Batch::updateStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Batch的用法示例。


在下文中一共展示了Batch::updateStatus方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: batchStatusAction

 function batchStatusAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     Zend_Loader::loadClass('Batch');
     Zend_Loader::loadClass('Document');
     Zend_Loader::loadClass('Geoparser_Edina');
     Zend_Loader::loadClass('Geoparser_EdinaBatch');
     $batchObj = new Batch();
     if (isset($_GET["batchID"])) {
         $batchID = $_GET["batchID"];
         $batch = $batchObj->getByID($batchID);
     } elseif (isset($_GET["parserID"])) {
         $parserID = $_GET["parserID"];
         $batch = $batchObj->getByParserID($parserID);
         $batchID = $batchObj->id;
     }
     if (!$batch) {
         //$this->view->requestURI = $this->_request->getRequestUri();
         //return $this->render('404error');
         throw new Zend_Controller_Action_Exception('Cannnot find this page: ' . $this->_request->getRequestUri(), 404);
     }
     $edinaObj = new Geoparser_EdinaBatch();
     $edinaObj->prepSettings();
     $edinaObj->batchName = $batchObj->parserID;
     //name of the batch
     $responseJSON = $edinaObj->cacheGetBatch();
     //get the status, but use the cache
     if (!$edinaObj->HTTPstatusOK) {
         $status = "error";
     } else {
         $status = "ok";
         $respObj = Zend_Json::decode($responseJSON);
         if (!$edinaObj->cacheUsed) {
             //cache was not used to generate the resulse, so we can update the status of the batch and its documents
             $batchObj->updateStatus("pending");
             if (isset($respObj["Texts"])) {
                 if (is_array($respObj["Texts"])) {
                     $docObj = new Document();
                     $docObj->batchID = $batchID;
                     foreach ($respObj["Texts"] as $text) {
                         $resourceID = $text["resource-id"];
                         $docStatus = $text["status"];
                         $data = array("parserID" => $resourceID, "status" => $docStatus);
                         if ($docStatus == "complete") {
                             $data["pLinks"] = Zend_Json::encode($text["output"]);
                         }
                         $docObj->url = $text["src"];
                         $docObj->updateDataByBatchURL($data);
                     }
                 }
             }
         }
         unset($batchObj);
         unset($docObj);
         $batchObj = new Batch();
         $batch = $batchObj->getByID($batchID);
         $batch["documents"] = $batchObj->documents;
         $batch["edina-resp"] = $respObj;
         header('Content-Type: application/json; charset=utf8');
         echo Zend_Json::encode($batch);
     }
 }
開發者ID:shawngraham,項目名稱:gap2,代碼行數:62,代碼來源:EdinaController.php


注:本文中的Batch::updateStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。