123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <?php
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Route;
- use App\Http\Controllers\LoginController;
- use App\Http\Controllers\CateController;
- use App\Http\Controllers\CourseController;
- use App\Http\Controllers\CollectionController;
- /*
- |--------------------------------------------------------------------------
- | API Routes
- |--------------------------------------------------------------------------
- |
- | Here is where you can register API routes for your application. These
- | routes are loaded by the RouteServiceProvider within a group which
- | is assigned the "api" middleware group. Enjoy building your API!
- |
- */
- //
- //Route::middleware('auth:api')->get('/user', function (Request $request) {
- // return $request->user();
- //});
- $api = app('Dingo\Api\Routing\Router');
- //这里的version是版本,里面的v1是在env里面定义好的。
- $api->version('v1', function($api) {
- $api->get('gzh', function(){
- return view('gzh');
- });
- $api->get('dist', function(){
- return view('dist');
- });
- $api->group(['prefix'=>'login'], function ($api) {
- $api->post('login', [LoginController::class,'login'])->name('login');
- $api->post('register', [LoginController::class,'register']);
- $api->group(['middleware' => 'auth:users'],function($api){
- $api->get('logout', [LoginController::class,'logout']);
- $api->get('user', [LoginController::class,'getAuthUser']);
- });
- });
- $api->group(['prefix'=>'collection'], function ($api) {
- $api->group(['middleware' => 'auth:users'],function($api){
- $api->get('getCollection', [CollectionController::class,'getCollection']);
- $api->post('addCollection', [CollectionController::class,'addCollection']);
- });
- });
- $api->group(['prefix'=>'course'], function ($api) {
- $api->group(['middleware' => 'auth:users'],function($api){
- $api->get('list', [CourseController::class,'list']);
- $api->get('current', [CourseController::class,'current']);
- });
- });
- $api->group(['prefix'=>'cate'], function ($api) {
- $api->group(['middleware' => 'auth:users'],function($api){
- $api->get('getCate', [CateController::class,'getCate']);
- });
- });
- // $api->group(['prefix'=>'article'], function ($api) {
- // $api->get('list', [ArticleController::class,'list']);
- // $api->get('detail', [ArticleController::class,'detail']);
- // $api->group(['middleware' => 'auth:users'],function($api){
- //// $api->group(['middleware' => 'check_token'],function($api){
- // $api->get('getDataInfo', [ArticleController::class,'getDataInfo']);
- // $api->post('like', [ArticleController::class,'like']);
- // $api->post('share', [ArticleController::class,'share']);
- // $api->post('read', [ArticleController::class,'read']);
- // $api->post('addComment', [ArticleController::class,'addComment']);
- // $api->get('getSignPackage', [ArticleController::class,'getSignPackage']);
- // $api->get('getArticleLike', [ArticleController::class,'getArticleLike']);
- // $api->get('getWetalkData', [ArticleController::class,'getWetalkData']);
- // $api->get('getAllWetalkComment', [ArticleController::class,'getAllWetalkComment']);
- // });
- // });
- $api->group(['prefix'=>'admin','namespace'=>'App\Http\Controllers\Admin'], function($api){
- $api->post('login','LoginController@login')->name('login');
- $api->post('register','LoginController@register');
- $api->post('refresh', 'LoginController@refresh')->name('refresh');
- $api->group(['middleware' => ['check_token','auth:admins']],function($api) {
- $api->get('getAuthUser', 'LoginController@getAuthUser');
- });
- $api->group(['middleware' => ['check_token','auth:admins']],function($api) {
- $api->get('getAuthUser', 'LoginController@getAuthUser');
- $api->get('list', 'LoginController@list');
- $api->post('delete', 'LoginController@delete');
- $api->post('edit', 'LoginController@edit');
- $api->post('logout', 'LoginController@logout');
- });
- $api->group(['prefix'=>'course'], function ($api) {
- $api->group(['middleware' => ['check_token','auth:admins']],function($api){//'check_token'
- $api->post('uploadAudio', 'CourseController@uploadAudio');
- $api->post('uploadImg', 'CourseController@uploadImg');
- $api->post('uploadVideo', 'CourseController@uploadVideo');
- $api->post('addCourse', 'CourseController@addCourse');
- $api->post('editCourse', 'CourseController@editCourse');
- $api->post('deleteCourse', 'CourseController@deleteCourse');
- $api->post('onlineCourse', 'CourseController@onlineCourse');
- $api->post('manyOnlineCourse', 'CourseController@manyOnlineCourse');
- $api->post('shareCourse', 'CourseController@shareCourse');
- $api->post('setTop', 'CourseController@setTop');
- $api->post('cancelTop', 'CourseController@cancelTop');
- $api->get('list', 'CourseController@list');
- $api->get('getCourseDetail', 'CourseController@getCourseDetail');
- });
- });
- $api->group(['prefix'=>'cate'], function ($api) {
- $api->group(['middleware' => ['check_token','auth:admins']],function($api){
- $api->post('addCate', 'CateController@addCate');
- $api->post('editCate', 'CateController@editCate');
- $api->post('deleteCate', 'CateController@deleteCate');
- $api->get('getOneCate', 'CateController@getOneCate');
- $api->get('getTwoCate', 'CateController@getTwoCate');
- $api->get('getCate', 'CateController@getCate');
- $api->post('uploadImg', 'CateController@uploadImg');
- });
- });
- $api->group(['prefix'=>'comment'], function ($api) {
- $api->group(['middleware' => ['check_token','auth:admins']],function($api){
- $api->get('list', 'CommentController@list');
- $api->post('auditComment', 'CommentController@auditComment');
- $api->post('deleteComment', 'CommentController@deleteComment');
- });
- });
- $api->group(['prefix'=>'data'], function ($api) {
- $api->group(['middleware' => ['check_token','auth:admins']],function($api){
- $api->get('index', 'DataController@index');
- $api->get('getCourseRead', 'DataController@getCourseRead');
- });
- });
- $api->group(['prefix'=>'author'], function ($api) {
- $api->group(['middleware' => ['check_token','auth:admins']],function($api){
- $api->get('getUserAvatar', 'AuthorController@getUserAvatar');
- $api->post('uploadAvatar', 'AuthorController@uploadAvatar');
- });
- });
- });
- });
|