123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- use App\Admin\Controllers\DistAppearanceTemplateController;
- use App\Admin\Controllers\RpcController;
- use App\Admin\Services\RpcService;
- use Illuminate\Routing\Router;
- use Illuminate\Support\Facades\Route;
- use Dcat\Admin\Admin;
- use JsonRPC\Server;
- Admin::routes();
- Route::group([
- 'prefix' => config('admin.route.prefix'),
- 'namespace' => config('admin.route.namespace'),
- 'middleware' => config('admin.route.middleware'),
- ], function (Router $router) {
- //主页
- $router->get('/', 'HomeController@index');
- // 定义切换语言的路由
- $router->get('language-switch','LanguageController@index');
- // 不需要登录的路由
- $router->get('captcha','CaptchaController@generate');
- //文件夹
- $router->resource('site-folder', 'SiteAlbumFolderController');
- //相册
- $router->resource('site-album', 'SiteAlbumController');
- //相册日志
- $router->get('site-album-log', 'SiteAlbumLogController@index');
- //相删用户
- $router->resource('site-users', 'SiteUserController');
- });
- // 定义RPC服务
- Route::post('/rpc', function (Request $request) {
- // 创建 JSON-RPC 服务端
- $server = new Server();
- // 注册服务类
- $server->getProcedureHandler()
- ->withClassAndMethod('siteAlbumPaginate', new RpcService(), 'siteAlbumPaginate')
- ->withClassAndMethod('siteAlbumGet', new RpcService(), 'siteAlbumGet')
- ->withClassAndMethod('siteAlbumFolderSelectOptions', new RpcService(), 'siteAlbumFolderSelectOptions')
- ->withClassAndMethod('siteAlbumFolderSelectOptionsAll', new RpcService(), 'siteAlbumFolderSelectOptionsAll')
- ->withClassAndMethod('siteAlbumGetByIds', new RpcService(), 'siteAlbumGetByIds')
- ->withClassAndMethod('siteAlbumFolderAllNodes', new RpcService(), 'siteAlbumFolderAllNodes');
- // 处理请求并返回响应
- return response()->json(json_decode($server->execute()));
- });
- /*
- * 重写上传路由,修改tinymce上传路径
- */
- $attributes = [
- 'prefix' => admin_base_path('dcat-api'),
- 'middleware' => config('admin.route.middleware'),
- 'as' => 'dcat-api.',
- ];
- app('router')->group($attributes, function ($router) {
- $router->post('editor-md/upload', function () {exit;})->name('editor-md.upload');
- $router->post('tinymce/upload', 'App\Http\Controllers\TinymceController@upload')->name('tinymce.upload');
- });
|