table('system_setting')->find(['key' => MODULE_NAME.'_setting']); $system_config = json_decode($system_config['val'], true); if(empty($system_config)){ exit('请配置生?); } $map_config = $model->table('system_setting')->find(['key' => 'sitemap_'.MODULE_NAME.'_config']); if(empty($map_config)){ exit('请配置生?); } $map_config = json_decode($map_config['val'], true); $domain = formatDomain($map_config['domain']); $per_page = $map_config['page']; //有page的情况输出分页数?if(isset($_GET['page'])){ $article_list = $model->table('jieqi_article_article')->select([], $per_page, 'articleid DESC'); getArticleListXml($article_list, $model, $system_config); exit; } //输出索引文件 $total_count = $model->table('jieqi_article_article')->count(); $total_page = ceil($total_count/$per_page); echo ''.PHP_EOL; echo ''.PHP_EOL; for($i=1; $i<= $total_page; $i++){ $url = $domain.'/'.$map_config['page_path']; echo getIndexXml($url, $i); } echo ''.PHP_EOL; /** * 获取索引xml节点 * @param $url * @param $page * @return string */ function getIndexXml($url, $page){ $param = ['Page'=>$page]; $url = urlCover($url, $param); $output = ''; $output .= ''.PHP_EOL; $output .= '' . $url. ''.PHP_EOL; $output .= ''. PHP_EOL; return $output; } /** * 获取章节xml节点 * @param $row * @return string */ function getArticleXml($row){ $output = ''; $output .= ''.PHP_EOL; $output .= ''.$row['url'].''.PHP_EOL; $output .= ''.date('Y-m-d', $row['lastupdate']).''.PHP_EOL; $output .= 'always'.PHP_EOL; $output .= '1.0'.PHP_EOL; $output .= ''.PHP_EOL; return $output; } /** * 获取小说列表的xml * @param $article_list * @param $model * @param $config */ function getArticleListXml($article_list, $model, $config){ //图片路径配置 $site_url = $model->table('system_setting')->find(['key' => 'site_url']); $site_url = $site_url['val']; $pic_path = $model->table('system_setting')->find(['key' => 'pic_path']); $pic_path = $pic_path['val']; //分类配置 $category_config = $model->table('system_setting')->find(['key' => 'category']); $cate_list = getCategoryList($category_config['val']); $domain = formatDomain($config['root_domain']); echo ''.PHP_EOL; foreach ($article_list as $article){ $path_param = []; $path_param['NovelId/1000'] = intval($article['articleid']/1000); $path_param['NovelId'] = $article['articleid']; $path_param['SortId'] = $article['sortid']; $path_param['ChapterId'] = $article['lastchapterid']; $path_param['SortPinyin'] = getSortPinyin($article['sortid'], $cate_list); $uri = isset($config['novel_uri']) ? $config['novel_uri'] : $config['novel_path']; $article_url = urlCover($uri, $path_param); // $article_url = dirname($article_url); $article['url'] = $domain.$article_url; $article['url'] = str_replace('index.html', '', $article['url']); $article['last_url'] = $domain.urlCover($config['chapter_path'], $path_param); $article['sortname'] = getSortName($article['sortid'], $cate_list); $article['pic'] = get_image($article['articleid'],$site_url,$pic_path); echo getArticleXml($article); } echo ''.PHP_EOL; }Ǹ ׺| ֻ| Ļ| Ѱ׼վ| ֻѲ| װѴȫ˽ŵ| ȡ| ռ| 2019һ| ׼Ĵʦ| | ׾| ֲ| ׼ũ| ͼ| ֻ| ũ| ׼վ| мŮ| | ϻѰ2019| ֲ| йŴ| ͼ| С˵ǽ| Ƚ׼վ| Ե| С˵| 2020| 1974ũ³6| С˵Ů| ũ| Ѳ| ¼Ƭ| ׼վ| ׼| Ѳ| Ƽһ׼վ| ׼վ2345| ׼ʵ| Ӱͯ|