Sitemap.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. namespace app\admin\controller;
  14. class Sitemap extends Base
  15. {
  16. public function _initialize() {
  17. parent::_initialize();
  18. }
  19. /*
  20. * Sitemap
  21. */
  22. public function index()
  23. {
  24. $inc_type = 'sitemap';
  25. if (IS_POST) {
  26. $param = input('post.');
  27. $param['sitemap_not1'] = isset($param['sitemap_not1']) ? $param['sitemap_not1'] : 0;
  28. $param['sitemap_not2'] = isset($param['sitemap_not2']) ? $param['sitemap_not2'] : 0;
  29. $param['sitemap_xml'] = isset($param['sitemap_xml']) ? $param['sitemap_xml'] : 0;
  30. $param['sitemap_txt'] = isset($param['sitemap_txt']) ? $param['sitemap_txt'] : 0;
  31. $param['sitemap_archives_num'] = isset($param['sitemap_archives_num']) ? intval($param['sitemap_archives_num']) : 100;
  32. /*多语言*/
  33. if (is_language()) {
  34. $langRow = \think\Db::name('language')->order('id asc')
  35. ->cache(true, EYOUCMS_CACHE_TIME, 'language')
  36. ->select();
  37. foreach ($langRow as $key => $val) {
  38. tpCache($inc_type,$param,$val['mark']);
  39. }
  40. } else {
  41. tpCache($inc_type,$param);
  42. }
  43. /*--end*/
  44. /* 生成sitemap */
  45. sitemap_all();
  46. $this->success('操作成功', url('Sitemap/index'));
  47. }
  48. $config = tpCache($inc_type);
  49. $this->assign('config',$config);//当前配置项
  50. return $this->fetch('seo/sitemap');
  51. }
  52. /**
  53. * 生成相应的搜索引擎sitemap
  54. */
  55. public function create($ver = 'xml')
  56. {
  57. if (empty($ver)) {
  58. sitemap_all();
  59. } else {
  60. $fun_name = 'sitemap_'.$ver;
  61. $fun_name();
  62. }
  63. }
  64. }