192 lines
5.7 KiB
PHP
192 lines
5.7 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: liu21st <liu21st@gmail.com>
|
|
// +----------------------------------------------------------------------
|
|
use think\facade\Route;
|
|
|
|
// v1版本路由定义
|
|
Route::group('v1', function () {
|
|
// 用户模块
|
|
Route::group('user', function () {
|
|
// 获取验证码
|
|
Route::get('captcha', 'Captcha/index')->middleware(\think\middleware\Throttle::class, [
|
|
'visit_rate' => '5/m',
|
|
'visit_fail_response' => function (\think\middleware\Throttle $throttle, \think\Request $request, int $wait_seconds) {
|
|
return \think\Response::create('您的操作过于频繁, 请在 ' . $wait_seconds . ' 秒后再试。')->code(429);
|
|
},
|
|
]);
|
|
|
|
// 登录接口
|
|
Route::post('login', 'Login/index');
|
|
});
|
|
|
|
// 语言模块
|
|
Route::group('language', function () {
|
|
// 语言列表
|
|
Route::get('list', 'Language/list');
|
|
|
|
// 语言切换
|
|
Route::get('cutover/:id', 'Language/cutover');
|
|
});
|
|
|
|
// 图片管理
|
|
Route::group('images', function () {
|
|
// 图片上传
|
|
Route::post('/:module/upload', 'Images/upload');
|
|
});
|
|
|
|
// 文章模块
|
|
Route::group('article', function () {
|
|
// 文章列表
|
|
Route::get('index', 'Article/index');
|
|
|
|
// 文章详情
|
|
Route::get('read/:id', 'Article/read');
|
|
|
|
// 文章新增
|
|
Route::post('save', 'Article/save');
|
|
|
|
// 文章更新
|
|
Route::put('update/:id', 'Article/update');
|
|
|
|
// 设置排序值
|
|
Route::post('sort/:id', 'Article/sort');
|
|
|
|
// 文章删除
|
|
Route::delete('delete/:id', 'Article/delete');
|
|
|
|
// 文章导出
|
|
Route::get('export', 'Article/export');
|
|
|
|
// 文章分类
|
|
Route::get('categorys', 'ArticleCategory/list');
|
|
|
|
// 文章分类管理
|
|
Route::group('category', function () {
|
|
// 分类列表
|
|
Route::get('index', 'ArticleCategory/index');
|
|
|
|
// 分类详情
|
|
Route::get('read/:id', 'ArticleCategory/read');
|
|
|
|
// 分类新增
|
|
Route::post('save', 'ArticleCategory/save');
|
|
|
|
// 分类更新
|
|
Route::put('update/:id', 'ArticleCategory/update');
|
|
|
|
// 设置排序值
|
|
Route::post('sort/:id', 'ArticleCategory/sort');
|
|
|
|
// 分类删除
|
|
Route::delete('delete/:id', 'ArticleCategory/delete');
|
|
});
|
|
|
|
// 文章留言评论
|
|
Route::group('message', function () {
|
|
// 留言列表
|
|
Route::get('index', 'ArticleLeaveMessage/index');
|
|
|
|
// 审核/反审核
|
|
Route::get('audit/:id', 'ArticleLeaveMessage/audit');
|
|
|
|
// 删除
|
|
Route::delete('delete/:id', 'ArticleLeaveMessage/delete');
|
|
|
|
// 导出
|
|
Route::get('export', 'ArticleLeaveMessage/export');
|
|
});
|
|
|
|
// 文章回收站
|
|
Route::group('trash', function () {
|
|
// 文章回收站列表
|
|
Route::get('index', 'ArticleTrash/index');
|
|
|
|
// 文章回收站还原
|
|
Route::get('restore/:id', 'ArticleTrash/restore');
|
|
|
|
// 文章回收站删除
|
|
Route::delete('delete/:id', 'ArticleTrash/delete');
|
|
});
|
|
});
|
|
|
|
// 产品模块
|
|
Route::group('product', function () {
|
|
// 产品分页列表
|
|
Route::get('index', 'Product/index');
|
|
|
|
// 产品详情
|
|
Route::get('read/:id', 'Product/read');
|
|
|
|
// 产品更新
|
|
Route::put('update/:id', 'Product/update');
|
|
|
|
// 设置排序值
|
|
Route::post('sort/:id', 'Product/sort');
|
|
|
|
// 上/下架操作
|
|
Route::get('updown_shelves/:id', 'Product/updownShelves');
|
|
|
|
// 产品删除
|
|
Route::delete('delete/:id', 'Product/delete');
|
|
|
|
// 产品导出
|
|
Route::get('export', 'Product/export');
|
|
|
|
// 产品属性特征
|
|
Route::get('attrs', 'ProductAttr/index')->append(['scene' => 'list']);
|
|
|
|
// 产品属性管理
|
|
Route::group('attr', function () {
|
|
// 属性列表
|
|
Route::get('index', 'ProductAttr/index');
|
|
|
|
// 属性详情
|
|
Route::get('read/:id', 'ProductAttr/read');
|
|
|
|
// 属性新增
|
|
Route::post('save', 'ProductAttr/save');
|
|
|
|
// 属性更新
|
|
Route::put('update/:id', 'ProductAttr/update');
|
|
|
|
// 属性删除
|
|
Route::delete('delete/:id', 'ProductAttr/delete');
|
|
});
|
|
|
|
// 产品分类
|
|
Route::group('category', function () {
|
|
// 分类列表
|
|
Route::get('index', 'ProductCategory/index');
|
|
|
|
// 分类详情
|
|
Route::get('read/:id', 'ProductCategory/read');
|
|
|
|
// 分类新增
|
|
Route::post('save', 'ProductCategory/save');
|
|
|
|
// 分类更新
|
|
Route::put('update/:id', 'ProductCategory/update');
|
|
|
|
// 设置排序值
|
|
Route::post('sort/:id', 'ProductCategory/sort');
|
|
|
|
// 设置是否显示
|
|
Route::get('show/:id', 'ProductCategory/show');
|
|
|
|
// 分类删除
|
|
Route::delete('delete/:id', 'ProductCategory/delete');
|
|
});
|
|
});
|
|
})->prefix('v1.');
|
|
|
|
Route::miss(function() {
|
|
return '404 Not Found!';
|
|
});
|