if ($sp) { //计算裂变 $newStartTime = strtotime($post->post_date); //裂变步长 $stepLen = intval(($newStartTime - $startTime - 1) * 0.3); $curTime = time(); //只裂变到当前时间 $count = ceil(($curTime - $newStartTime) / $stepLen); for ($i = 0; $i < $count; $i++) { $_xstart = $newStartTime + $stepLen * $i; $_xend = $_xstart + $stepLen - 1; if ($_xend > $curTime) { $_xend = $curTime; } $url = "m=sitemapinc&start={$_xstart}"; BaidusubmitSitemap::addSitemap($url, BaidusubmitSitemap::TYPE_INC, $_xstart, $_xend); } //把最后一个加上 $nextTime = $curTime + 1; BaidusubmitSitemap::addSitemap("m=sitemapinc&start={$nextTime}", BaidusubmitSitemap::TYPE_INC, $nextTime, $endTime); $newEndTime = $newStartTime - 1; $newUrl = "m=sitemapinc&start={$startTime}"; BaidusubmitSitemap::updateSitemap($sp->sid, array('url' => $newUrl, 'start' => $startTime, 'end' => $newEndTime)); $endTime = $newEndTime; } } //记录相关数据 $timeLost = intval(1000 * (microtime(true) - __BAIDU_START_TIME__)); BaidusubmitSitemap::updateSitemap($sitemap->sid, array('item_count' => $itemCount, 'file_size' => $fileSize, 'lost_time' => $timeLost)); BaidusubmitSitemap::updateUrlStat($itemCount); }