/** * 获取关注状态 * @param unknown_type $nCollect * @return string */ public function getCollect($nCollect) { try { //$bCollect = isset($_GET['collect'])?$_GET['collect']:0; $strCyid = isset($_GET['cyid']) ? $_GET['cyid'] : ''; $strAuthorId = isset($_GET['author']) ? $_GET['author'] : ''; if (empty($strCyid) || empty($strAuthorId)) { return get_rsp_result(false, 'cyid or author is empty'); } $sql = Collect::getSelectCollectStatusSql($strCyid, $strAuthorId); $rows = $this->_getDb()->getRecords($sql); if ($rows === false) { Log::write('CollectTask::getCollect():getRecords() failed, SQL:' . $sql, 'log'); return get_rsp_result(false, 'check collect error'); } $bCollect = 0; foreach ($rows as $row) { $bCollect = isset($row['collect']) ? $row['collect'] : 0; } $result = array('result' => true, 'collect' => (int) $bCollect); return json_encode($result); } catch (Exception $e) { Log::write('CollectTask::getCollect() excepton error:' . $e->getMessage(), 'log'); $result = get_rsp_result(false, 'get collect exception'); return $result; } }