123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <?php
- /*
- * This file is part of the Jiannei/lumen-api-starter.
- *
- * (c) Jiannei <longjian.huang@foxmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- use Illuminate\Support\Facades\Route;
- use Jiannei\Response\Laravel\Support\Facades\Response;
- /*
- |--------------------------------------------------------------------------
- | Application Routes
- |--------------------------------------------------------------------------
- |
- | Here is where you can register all of the routes for an application.
- | It is a breeze. Simply tell Lumen the URIs it should respond to
- | and give it the Closure to call when that URI is requested.
- |
- */
- /**
- * 基础业务模块
- */
- Route::get('/home', 'HomeController@index');
- Route::group(['namespace' => 'Base', 'prefix' => 'base'], function () {
- //登录
- Route::post('/auth/login', 'AuthController@login');
- //上传文件
- Route::post('/common/upload', 'ResourceController@upload');
- //枚举
- Route::get('/common/enums', 'CommonController@enums');
- Route::group([
- 'middleware' => ['auth:api']
- ], function () {
- Route::get('/auth/me', 'AuthController@me');
- Route::put('/auth/me', 'AuthController@update');
- Route::put('/auth/password', 'AuthController@changePassword');
- Route::get('/auth/logout', 'AuthController@logout');
- });
- });
- //Route::get('/page/home', 'PageController@home');
- //Route::get('/page/navigations', 'PageController@navigations');
- //Route::get('/page/articles', 'PageController@articles');
- //Route::get('/page/article/{id}', 'PageController@article');
- //Route::get('/page/navigation-article/{id}', 'PageController@navigationArticle');
- //Route::post('/page/settings', 'PageController@settings');
- Route::group(['namespace' => 'CMS'], function () {
- //上传文件
- Route::post('/common/upload', 'ResourceController@upload');
- //banner
- Route::get('/banner', 'BannersController@index');
- //导航
- Route::get('/category', 'CategoriesController@index');
- //文章
- Route::get('/articles', 'ArticlesController@index');
- Route::get('/article', 'ArticlesController@article');
- Route::get('/article-lists', 'ArticlesController@lists');
- Route::get('/article/{id}', 'ArticlesController@show');
- //配置
- Route::get('/settings', 'SettingController@index');
- //登录
- // Route::post('/auth/login', 'AuthController@login');
- // Route::post('/auth/register', 'AuthController@store');
- // Route::group([
- // 'middleware' => 'auth:api'
- // ], function () {
- // Route::get('/auth/me', 'AuthController@me');
- // Route::put('/auth/me', 'AuthController@update');
- // Route::get('/auth/logout', 'AuthController@logout');
- // });
- });
- //用户管理
- Route::group(['namespace' => 'User', 'prefix' => 'user'], function () {
- Route::get('/', 'UserController@index');
- // Route::post('/', 'UserController@store');
- // Route::get('/{id}', 'UserController@show');
- // Route::put('/{id}', 'UserController@update');
- // Route::delete('/{id}', 'UserController@destroy');
- // Route::post('/delete', 'UserController@delete');
- // Route::post('/import', 'UserController@import');
- // Route::post('/export', 'UserController@export');
- });
- /**
- * 视频接口
- */
- Route::group(['namespace' => 'Course', 'prefix' => 'course'], function () {
- //分类
- Route::get('/categories', 'CategoryController@index');
- //视频列表
- Route::get('/', 'CourseController@index');
- Route::get('/random', 'CourseController@random');
- Route::get('/select-options', 'CourseController@selectOptions');
- //视频详情
- Route::get('/info/{slug}', 'CourseController@show');
- Route::group([
- 'middleware' => 'auth:api'
- ], function () {
- Route::group([
- 'middleware' => 'auth.role:teacher'
- ], function () {
- //老师路由
- Route::post('/', 'CourseController@store');
- Route::put('/{id}', 'CourseController@update');
- Route::delete('/{id}', 'CourseController@destroy');
- //章节
- Route::post('/chapter', 'ChapterController@store');
- Route::put('/chapter/{id}', 'ChapterController@update');
- Route::delete('/chapter/{id}', 'ChapterController@destroy');
- //视频
- Route::post('/video', 'VideoController@store');
- Route::put('video/{id}', 'VideoController@update');
- Route::delete('video/{id}', 'VideoController@destroy');
- //附件
- Route::post('/attach', 'AttachController@store');
- Route::put('/attach/{id}', 'AttachController@update');
- Route::delete('/attach/{id}', 'AttachController@destroy');
- //班级
- Route::post('/organization', 'OrganizationsController@store');
- Route::put('/organization/{id}', 'OrganizationsController@update');
- Route::delete('/organization/{id}', 'OrganizationsController@destroy');
- Route::post('/organization/courses', 'OrganizationsController@syncCourses');
- Route::post('/organization/student/update', 'OrganizationsController@updateStudent');
- Route::post('/organization/students/delete', 'OrganizationsController@destroyStudents');
- Route::get('/organization/statistical', 'OrganizationsController@statistical');
- });
- //班级
- Route::get('/organization', 'OrganizationsController@index');
- Route::get('/organization/info/{slug}', 'OrganizationsController@show');
- Route::get('/organization/teacher', 'OrganizationsController@teacher');
- Route::get('/organization/students', 'OrganizationsController@students');
- Route::post('/organization/student', 'OrganizationsController@storeStudent');
- //课程详情【学生】
- Route::get('/detail/{slug}', 'CourseController@detail');
- //订阅
- Route::post('/subscribe', 'CourseController@subscribe');
- //章节列表
- Route::get('/chapter', 'ChapterController@index');
- //视频
- Route::get('/video', 'VideoController@index');
- Route::get('/video/select-options', 'VideoController@selectOptions');
- Route::get('/video/info/{slug}', 'VideoController@show');
- Route::post('/video/look-record', 'VideoController@lookRecord');
- // 学生
- Route::get('/video/detail/{slug}', 'VideoController@detail');
- //附件
- Route::get('/attach', 'AttachController@index');
- Route::get('/attach/download/{slug}', 'AttachController@download');
- //观看记录
- Route::get('/course-look', 'CourseController@lookCourses');
- //评价
- Route::post('/comment', 'CommentController@store');
- Route::get('/comments', 'CommentController@index');
- //收藏
- Route::post('/collection', 'CourseController@collection');
- });
- });
- /**
- * 试卷
- */
- Route::group(['namespace' => 'Exam', 'prefix' => 'exam', 'middleware' => 'auth:api'], function () {
- Route::get('/', 'PapersController@index');
- Route::get('/info/{slug}', 'PapersController@show');
- Route::get('/topic-select-options', 'TopicsController@selectOptions');
- //提交考试结果
- Route::post('/examination', 'PapersController@examination');
- // Route::get('/', 'TopicsController@index');
- Route::group([
- 'middleware' => 'auth.role:teacher'
- ], function () {
- Route::post('/', 'PapersController@store');
- Route::put('/{id}', 'PapersController@update');
- Route::delete('/{id}', 'PapersController@destroy');
- //批阅
- Route::post('/examines', 'PapersController@examines');
- //试题
- Route::get('/topic', 'TopicsController@index');
- Route::get('/topic/{id}', 'TopicsController@show');
- Route::post('/topic', 'TopicsController@store');
- Route::put('/topic/{id}', 'TopicsController@update');
- Route::delete('/topic/{id}', 'TopicsController@destroy');
- //学生考试记录
- Route::delete('/result/{id}', 'PaperResultsController@destroy');
- });
- Route::get('/result', 'PaperResultsController@index');
- Route::get('/result/{id}', 'PaperResultsController@show');
- });
- //笔记
- Route::group(['namespace' => 'Note', 'prefix' => 'note'], function () {
- Route::get('/', 'NotesController@index');
- Route::get('info/{slug}', 'NotesController@show');
- Route::get('comment', 'CommentsController@index');
- Route::group([
- 'middleware' => 'auth:api'
- ], function () {
- //笔记、问答
- Route::post('/', 'NotesController@store');
- Route::put('/{id}', 'NotesController@update');
- Route::delete('/{id}', 'NotesController@destroy');
- //点赞
- Route::post('good', 'NotesController@good');
- Route::post('comment', 'CommentsController@store');
- Route::delete('comment/{id}', 'CommentsController@destroy');
- Route::post('comment/good', 'CommentsController@good');
- Route::post('comment/answer', 'CommentsController@answer');
- });
- });
- Route::group(['prefix' => 'inform', 'namespace' => 'Inform'], function () {
- //分类
- // Route::get('category', 'CategoryController@index');
- // Route::post('category', 'CategoryController@store');
- // Route::get('category/{id}', 'CategoryController@show');
- // Route::put('category/{id}', 'CategoryController@update');
- // Route::delete('category/{id}', 'CategoryController@destroy');
- // Route::post('category/delete', 'CategoryController@delete');
- // Route::get('category-tree', 'CategoryController@tree');
- // Route::get('category-user-tree', 'CategoryController@lists');
- //信息
- Route::group([
- 'middleware' => 'auth.role:teacher'
- ], function () {
- Route::post('/', 'InformationController@store');
- Route::delete('/{id}', 'InformationController@destroy');
- });
- Route::get('/', 'InformationController@index');
- Route::get('/info/{slug}', 'InformationController@show');
- Route::post('/good', 'InformationController@good');
- // Route::put('information/{id}', 'InformationController@update');
- // Route::post('information/delete', 'InformationController@delete');
- // Route::get('information-user-messages', 'InformationController@userMessages');
- // Route::post('information-read-messages', 'InformationController@readMessages');
- });
- Route::get('/', function () {
- return Response::success(app()->version());
- });
- //开发环境接口
- Route::group(['prefix' => 'develop'], function () {
- //响应状态
- // Route::get('/http-status', 'DevelopController@httpStatus');
- Route::get('/t', 'ExampleController@test');
- Route::get('/init', 'ExampleController@init');
- });
|