当前位置: 首页>>代码示例>>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;未经允许,请勿转载。