feat: 开放API文章相关

This commit is contained in:
2025-05-21 16:59:48 +08:00
parent 9ecc9ac957
commit e712030e3e
7 changed files with 299 additions and 8 deletions

View File

@@ -18,11 +18,14 @@ Route::group('v1', function() {
Route::get('categories', 'v1.ProductCategory/list');
});
// 获取新闻动态
Route::get('news', 'v1.News/list');
Route::group('news', function() {
// 获取新闻详情
Route::get(':id', 'v1.News/detail');
// 获取文章动态
Route::get('articles', 'v1.Article/list');
Route::group('article', function() {
// 获取文章详情
Route::get(':id', 'v1.Article/detail')->when('id', 'number');
// 获取文章分类
Route::get('categories', 'v1.ArticleCategory/list');
});
})
->middleware(\app\openapi\middleware\Auth::class);
@@ -32,4 +35,5 @@ Route::group('v1', function() {
'visit_fail_response' => function (\think\middleware\Throttle $throttle, \think\Request $request, int $wait_seconds) {
return \think\Response::create('您的操作过于频繁, 请在 ' . $wait_seconds . ' 秒后再试。')->code(429);
},
]);
])
->completeMatch(true);