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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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\api;
|
||||
|
||||
/**
|
||||
* SEO增强对外 API(占位)
|
||||
*
|
||||
* 非市场类插件,遵循框架统一 Result 契约(code=0 成功)。
|
||||
* 如需与中心站市场联动再按 Market 系 code=1 契约调整。
|
||||
*/
|
||||
class Seo
|
||||
{
|
||||
/**
|
||||
* 示例:对外查询接口
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
// TODO: 返回 SEO 配置/关键词等数据
|
||||
return json(['code' => 0, 'msg' => 'ok', 'data' => []]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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\backend;
|
||||
|
||||
/**
|
||||
* SEO增强后台控制器
|
||||
*
|
||||
* 业务占位骨架,四个动作对应 menu.json 的四个菜单项。
|
||||
* 实际逻辑(读写 wxapp_seo_config/keywords/snapshots)在 TODO 处实现。
|
||||
*/
|
||||
class Seo extends SeoBackend
|
||||
{
|
||||
/**
|
||||
* SEO概览:收录/排名/内链数等汇总
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// TODO: 聚合 wxapp_seo_snapshots 与 wxapp_seo_keywords 的数量与概览指标
|
||||
$this->view->assign('title', 'SEO概览');
|
||||
return $this->view->fetch('seo/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* SEO设置:站点标题/关键词/描述模板、robots 等
|
||||
*/
|
||||
public function setting()
|
||||
{
|
||||
// TODO: 读取/保存 wxapp_seo_config(表单提交经 POST 落库)
|
||||
$this->view->assign('title', 'SEO设置');
|
||||
return $this->view->fetch('seo/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 内链关键词:增删改查
|
||||
*/
|
||||
public function keywords()
|
||||
{
|
||||
// TODO: 内链关键词 CRUD(表 wxapp_seo_keywords)
|
||||
$this->view->assign('title', '内链关键词');
|
||||
return $this->view->fetch('seo/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 收录统计:搜索引擎收录/排名趋势
|
||||
*/
|
||||
public function stats()
|
||||
{
|
||||
// TODO: 收录排名趋势(表 wxapp_seo_snapshots)
|
||||
$this->view->assign('title', '收录统计');
|
||||
return $this->view->fetch('seo/index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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\backend;
|
||||
|
||||
use ywxapp\controller\BackendBase;
|
||||
|
||||
/**
|
||||
* SEO增强后台控制器基类
|
||||
*
|
||||
* 说明:addon 后台路由(/seo/backend/...)经全局路由分发落在默认 frontend 应用,
|
||||
* 容器 auth 绑定会解析成前台 Auth(isAdmin=false),后台 token 上下文不匹配会被拒。
|
||||
* AddonBackend::_initialize() 已统一处理:当 $this->auth 非 AdminAuth 时强制还原为
|
||||
* AdminAuth 并 tryInitByToken(),再按子类声明的 noNeedLogin/noNeedVerify 做登录与权限校验。
|
||||
*
|
||||
* 这里仅声明跳过后台细粒度权限校验,避免权限规则未配置时锁死后台;登录仍强制要求。
|
||||
*/
|
||||
class SeoBackend extends BackendBase
|
||||
{
|
||||
/**
|
||||
* 跳过后台细粒度权限校验(权限规则未配置时避免锁死后台)。
|
||||
* 登录要求仍由 AddonBackend::_initialize() 强制(noNeedLogin 默认空=需要登录)。
|
||||
*/
|
||||
protected $noNeedVerify = ['*'];
|
||||
}
|
||||
Reference in New Issue
Block a user