示例#1
0
include_once './class/randArticle.php';
include_once './class/main.php';
include_once './function/function.php';
$cfg = new config();
$db = new dbQuery($cfg->dbHost, $cfg->dbUser, $cfg->dbPassword, $cfg->dbName);
$indexCache = new indexContent();
$viewID = InStr('read-', '.html', $_SERVER["REQUEST_URI"]);
//当前百度问答采集页面ID。范围从1-10。对应baidu1-baidu10
//--------------------从数据库中读取-------------------------------------
$sqlSelect = 'SELECT `cid`,`title`,`key`,`keys`,`adkey`,`index` FROM `' . $indexCache->dbPrefix . "cat` WHERE `epath`='" . $indexCache->epath . "';";
$result = $db->query($sqlSelect);
$arrResult = $db->fetch_array($result);
//--------------------初始化数据--------------------------------------------
$indexCache->AnalysisData($arrResult);
//将viewid转换成数组
$indexCache->AnalysisCache();
$arrResult = null;
unset($arrResult);
//--------------------获取createTime-------------------------------------
$content = '';
if ($cfg->isMemcached) {
    $memcached = new Memcached();
    $memcached->addServer('127.0.0.1', '11211');
    $content = $memcached->get($indexCache->mainDomain);
}
if ($content == '' && file_exists('./cfg')) {
    $content = file_get_contents('./cfg');
}
if ($content == '') {
    $sqlSelect = 'SELECT MAX(cid) as maxcid FROM `' . $indexCache->dbPrefix . 'cat`;';
    $result = $db->query($sqlSelect);
示例#2
0
        $arrResult = $db->fetch_array($result);
        $key = $arrResult['key'];
        $epath = $arrResult['epath'];
        $arrPath = explode('/', $epath);
        echo '<li><a href="http://' . $arrPath[0] . $indexContent->mainDomain . '/' . $arrPath[1] . '">' . $key . '</a></li>';
    }
    echo '</body></html>';
    $db->close();
    die;
}
//--------------------初始化数据--------------------------------------------
$indexContent->AnalysisData($arrResult, $arrBaiduViewId);
$arrResult = null;
unset($arrResult);
$indexContent->SetCreateTime($createTime);
$indexContent->AnalysisCache();
//--------------------无需更新--------------------------------------------
if (!$indexContent->NeedUp() && $indexContent->conIndex != '') {
    $db->close();
    $indexContent->Show($cfg->isMemcached, $memcached);
    die;
}
$upTimes = $indexContent->cid > 500 ? 86400 : 432000;
$indexContent->SetUpTimes($upTimes);
//--------------------更新百度--------------------------------------------
$sqlUpBaidu = '';
$indexContent->CleanBaiduArray();
$baiduLinks = '';
foreach ($arrBaiduViewId as $k => $v) {
    $baidu = new baidu();
    $baidu->AnalysisCache($indexContent->conBaidu[$v]);