/** * 标签操作 */ public function cancelAction() { $tuduIds = $this->_request->getParam('tuduid'); if (empty($tuduIds)) { throw new TuduX_OpenApi_Exception('Missing or invalid value of parameter "tid"', TuduX_OpenApi_ResponseCode::MISSING_PARAMETER); } $params = array('tuduid' => $tuduIds); try { $this->_model->cancel($params); } catch (Model_Tudu_Exception $e) { $exception = $this->getException($e); throw new TuduX_OpenApi_Exception($exception['message'], $exception['code']); } $this->view->code = TuduX_OpenApi_ResponseCode::SUCCESS; }
/** * 认领图度 */ public function claimAction() { $tuduId = trim($this->_request->getParam('tid')); $resourceManager = new Tudu_Model_ResourceManager_Registry(); $resourceManager->setResource(Tudu_Model::RESOURCE_CONFIG, $this->bootstrap->getOptions()); Tudu_Model::setResourceManager($resourceManager); $model = new Model_Tudu_Manager_Tudu(); try { $model->claim(array('tuduid' => $tuduId)); } catch (Model_Tudu_Exception $e) { $err = $this->lang['tudu_claim_failed']; switch ($e->getCode()) { case Model_Tudu_Manager_Tudu::CODE_INVALID_TUDUID: $err = $this->lang['tudu_not_exists']; break; case Model_Tudu_Manager_Tudu::CODE_STEP_NOTCLAIM: $err = $this->lang['step_not_claim']; break; case Model_Tudu_Manager_Tudu::CODE_STEP_CLAIM_FINISH: $err = $this->lang['tudu_has_already_claim']; break; } return $this->json(false, $err); } return $this->json(true, $this->lang['tudu_claim_success']); }