安全(P0) - 发布包签名:新增 scripts/package_keygen.php、scripts/package_verify.php、 ywxapp\service\PackageVerifier;FrameworkService::apply() 解压前强制验签 (ywxapp.framework_package_verify,默认开启) - JWT 收紧:config/jwt.php 移除公开默认密钥,JwtService::assertStrongSecret() 校验非空 / 长度≥32 / 已知弱值;.env.production.example 键名由 JWT_SECRET_KEY 修正为 JWT_SECRET - /api/v1/Article:免登录白名单收窄为只读接口,写操作字段白名单 + assertOwner() 越权校验 - 开发者令牌:查找接口不再回显明文、统一失败文案 + 限流 - TemplateInstaller:文件名白名单 + realpath 归一化 + 目录内断言,修复 Zip Slip;补 use ZipArchive - 后台登录:接入验证码、失败锁定与登录限流(config/ratelimit.php) - 缓存 / Session 驱动可由 .env 覆盖(CACHE_DRIVER / SESSION_TYPE),集群部署改 redis - paycenter 支付日志开关改为 PAY_LOG,不再跟随 APP_DEBUG 工程化 / 交付 - 新增 CHANGELOG.md 与 .env.production.example;composer.lock 入库锁定依赖版本 - 插件离线安装 CLI 增加 --uid,后台上传安装透传 uid,付费插件授权校验可通过 - 授权拒绝文案区分「未携带 uid」与「未找到有效授权」,便于排障 - .gitignore 放行 .env.production.example / .env.addon.example / .gitattributes / public/.htaccess 结构 - appmall 由 addon/appmall 迁移为独立应用 app/appmall(市场 / 开发者中心 / 审核 / 分润)
153 lines
6.8 KiB
PHP
153 lines
6.8 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Author: ywxapp<admin@ywxapp.cn>
|
||
// +----------------------------------------------------------------------
|
||
|
||
use think\facade\Route;
|
||
|
||
// 前台文章路由
|
||
// 变量/具体路由写在通用 article(index) 之前,避免静态短规则前缀匹配吞掉详情页
|
||
Route::get('article/:id', 'Article/detail');
|
||
Route::get('article/:id/comments', 'Article/getComments');
|
||
Route::post('article/like/:id', 'Article/like');
|
||
Route::post('article/favorite/:id', 'Article/favorite');
|
||
Route::get('article', 'Article/index');
|
||
|
||
// 作者主页(按作者筛选已发布文章)
|
||
Route::get('user/:id', 'Article/author');
|
||
|
||
// 评论路由
|
||
Route::post('comment/add', 'Comment/add');
|
||
Route::post('comment/delete/:id', 'Comment/delete');
|
||
Route::post('comment/like/:id', 'Comment/like');
|
||
|
||
// 互动路由
|
||
Route::post('interaction/like', 'Interaction/like');
|
||
Route::post('interaction/favorite', 'Interaction/favorite');
|
||
Route::post('interaction/share', 'Interaction/share');
|
||
Route::get('interaction/status/:article_id', 'Interaction/getUserInteractions');
|
||
Route::get('interaction/hot', 'Interaction/getHotInteractions');
|
||
|
||
// 首页路由(注:本文件被 loadAddonRoutes() 包在 Route::group('blog') 内,
|
||
// 因此这里用空规则 '' 会被加成 /blog,而非带前导 / 的绝对规则(那样会变成根 /))
|
||
Route::get('', 'Index/index');
|
||
Route::get('category/index', 'Index/category');
|
||
Route::get('category', 'Index/category');
|
||
Route::get('category/:id', 'Index/category');
|
||
Route::get('tag/index', 'Index/tag');
|
||
Route::get('tag', 'Index/tag');
|
||
Route::get('tag/:id', 'Index/tag');
|
||
Route::get('search', 'Index/search');
|
||
Route::get('nearby', 'Index/nearby');
|
||
Route::get('about', 'Index/about');
|
||
Route::get('contact', 'Index/contact');
|
||
|
||
// SEO:站点地图(文章 > 5000 条时 sitemap.xml 输出 index,文章拆到 sitemap-<n>.xml)
|
||
Route::get('sitemap.xml', 'addon\blog\controller\Sitemap@index');
|
||
Route::get('sitemap-:page.xml', 'addon\blog\controller\Sitemap@chunk');
|
||
|
||
// RSS路由
|
||
Route::get('rss', 'Rss/index');
|
||
Route::get('rss/reader', 'Rss/reader');
|
||
// 其他路由...
|
||
|
||
|
||
// 后台路由
|
||
// 说明:TP6 合并正则会把短规则(如 article/category/setting 的 index)优先匹配,
|
||
// 吞掉更长的子规则(article/edit/:id、category/add、setting/site 等),
|
||
// 因此每条具体路由都写在对应的 index 路由之前。
|
||
Route::group('backend', function () {
|
||
// 插件后台入口
|
||
Route::get('/', 'backend.Index/index');
|
||
Route::get('index', 'backend.Index/index');
|
||
|
||
// 仪表盘
|
||
Route::get('dashboard', 'backend.Dashboard/index');
|
||
|
||
// 文章管理(多用户:后台仅管理/审核,不发布新文章)
|
||
Route::get('article/edit/:id', 'backend.Article/edit');
|
||
Route::post('article/update/:id', 'backend.Article/update');
|
||
Route::post('article/delete/:id', 'backend.Article/delete');
|
||
Route::post('article/batch', 'backend.Article/batch');
|
||
Route::post('article/audit/:id', 'backend.Article/audit');
|
||
Route::post('article/reject/:id', 'backend.Article/reject');
|
||
Route::get('article', 'backend.Article/index');
|
||
|
||
// 分类管理
|
||
Route::get('category/add', 'backend.Category/add');
|
||
Route::post('category/save', 'backend.Category/save');
|
||
Route::get('category/edit/:id', 'backend.Category/edit');
|
||
Route::post('category/update/:id', 'backend.Category/update');
|
||
Route::post('category/delete/:id', 'backend.Category/delete');
|
||
Route::get('category', 'backend.Category/index');
|
||
|
||
// 标签管理
|
||
Route::get('tag/add', 'backend.Tag/add');
|
||
Route::post('tag/save', 'backend.Tag/save');
|
||
Route::get('tag/edit/:id', 'backend.Tag/edit');
|
||
Route::post('tag/update/:id', 'backend.Tag/update');
|
||
Route::post('tag/delete/:id', 'backend.Tag/delete');
|
||
Route::post('tag/batchDelete', 'backend.Tag/batchDelete');
|
||
Route::get('tag', 'backend.Tag/index');
|
||
|
||
// 评论管理
|
||
Route::post('comment/approve/:id', 'backend.Comment/approve');
|
||
Route::post('comment/reject/:id', 'backend.Comment/reject');
|
||
Route::post('comment/delete/:id', 'backend.Comment/delete');
|
||
Route::post('comment/batch', 'backend.Comment/batch');
|
||
Route::get('comment', 'backend.Comment/index');
|
||
|
||
// 用户管理(管理全站用户,与博客文章通过 uid 关联)
|
||
Route::get('user/edit/:id', 'backend.User/edit');
|
||
Route::post('user/update/:id', 'backend.User/update');
|
||
Route::post('user/delete/:id', 'backend.User/delete');
|
||
Route::post('user/batch', 'backend.User/batch');
|
||
Route::get('member', 'backend.User/index');
|
||
|
||
// AdminAuth
|
||
Route::get('stat', 'backend.Stat/index');
|
||
|
||
// 系统设置
|
||
Route::get('setting/site', 'backend.Setting/site');
|
||
Route::post('setting/site', 'backend.Setting/site');
|
||
Route::get('setting/seo', 'backend.Setting/seo');
|
||
Route::post('setting/seo', 'backend.Setting/seo');
|
||
Route::get('setting/email', 'backend.Setting/email');
|
||
Route::post('setting/email', 'backend.Setting/email');
|
||
Route::get('setting', 'backend.Setting/index');
|
||
});
|
||
|
||
// ============================================================
|
||
// 会员中心路由(已启用)
|
||
// 控制器放 addon/blog/controller/member/ 下,继承 \ywxapp\controller\AddonMember
|
||
// 未登录访问会自动跳转 /member/login
|
||
// ============================================================
|
||
Route::group('member', function () {
|
||
Route::get('/', 'member.Index/index');
|
||
Route::get('profile', 'member.Index/profile');
|
||
|
||
// 会员中心文章管理(多用户:文章在此发布/管理)
|
||
// 注意:具体路由必须写在通用 index 路由之前,否则 TP6 合并正则会把
|
||
// article/create、article/edit/:id 等长规则误匹配成 article(index)。
|
||
Route::get('article/create', 'member.Article/create');
|
||
Route::get('article/edit/:id', 'member.Article/edit');
|
||
Route::post('article/save', 'member.Article/save');
|
||
Route::post('article/update/:id', 'member.Article/update');
|
||
Route::post('article/delete/:id', 'member.Article/delete');
|
||
Route::post('article/batch', 'member.Article/batch');
|
||
Route::get('article', 'member.Article/index');
|
||
|
||
// 会员中心分类管理(用户自建分类)
|
||
Route::get('category/create', 'member.Category/create');
|
||
Route::get('category/edit/:id', 'member.Category/edit');
|
||
Route::post('category/save', 'member.Category/save');
|
||
Route::post('category/update/:id', 'member.Category/update');
|
||
Route::post('category/delete/:id', 'member.Category/delete');
|
||
Route::post('category/batch', 'member.Category/batch');
|
||
Route::get('category', 'member.Category/index');
|
||
});
|
||
|