public function setCollect($nCollect) { try { // $bCollect = isset($_GET['collect'])?$_GET['collect']:0; $strCyid = isset($_GET['cyid']) ? $_GET['cyid'] : ''; $strAuthorId = isset($_GET['author']) ? $_GET['author'] : ''; $strAuthorName = isset($_GET['authorName']) ? $_GET['authorName'] : ''; if (empty($strCyid) || empty($strAuthorId)) { return get_rsp_result(false, 'cyid or author is empty'); } $sql = Collect::getCheckSql($strCyid, $strAuthorId); $nCount = $this->_getDb()->getRecordsCount($sql); if ($nCount === false) { Log::write('CollectTask::setCollect():getRecordsCount() failed, SQL:' . $sql, 'log'); return get_rsp_result(false, 'check collect error'); } if ($nCount <= 0) { $sql = Collect::getInsertSql($strCyid, $strAuthorId, $strAuthorName); } else { $sql = Collect::getUpdateSql($nCollect, $strCyid, $strAuthorId); } $result = $this->_getDb()->setRecords($sql); if (!$result) { Log::write('CollectTask::setCollect():setRecords() failed, SQL:' . $sql, 'log'); return get_rsp_result(false, 'set collect error'); } return get_rsp_result(true); } catch (Exception $e) { Log::write('CollectTask::setCollect() excepton error:' . $e->getMessage(), 'log'); $result = get_rsp_result(false, 'set collect exception'); return $result; } }