chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: ywxapp <admin@ywxapp.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace addon\seo\controller;
|
||||
use ywxapp\controller\FrontendBase;
|
||||
|
||||
use think\Response;
|
||||
|
||||
/**
|
||||
* SEO增强前台控制器
|
||||
*
|
||||
* 对外提供站点地图、robots 与状态页。无需登录即可访问。
|
||||
*/
|
||||
class Index extends FrontendBase
|
||||
{
|
||||
protected $noNeedLogin = ['*'];
|
||||
protected $noNeedVerify = ['*'];
|
||||
|
||||
/**
|
||||
* 前台状态页
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// TODO: 前台展示/状态页
|
||||
$this->view->assign('title', 'SEO增强');
|
||||
return $this->view->fetch('index/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点地图(/seo/sitemap.xml)
|
||||
*/
|
||||
public function sitemap()
|
||||
{
|
||||
// TODO: 遍历站点 URL 生成符合 sitemaps.org 规范的 XML
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8"?>'
|
||||
. '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>';
|
||||
return Response::create($xml, 'xml')->contentType('application/xml');
|
||||
}
|
||||
|
||||
/**
|
||||
* robots.txt(/seo/robots.txt)
|
||||
*/
|
||||
public function robots()
|
||||
{
|
||||
// TODO: 读取 wxapp_seo_config.robots 输出;此处为默认兜底
|
||||
$txt = "Member-agent: *\nAllow: /";
|
||||
return Response::create($txt)->contentType('text/plain');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user