api.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. use Illuminate\Http\Request;
  3. use Illuminate\Support\Facades\Route;
  4. /*
  5. |--------------------------------------------------------------------------
  6. | API Routes
  7. |--------------------------------------------------------------------------
  8. |
  9. | Here is where you can register API routes for your application. These
  10. | routes are loaded by the RouteServiceProvider within a group which
  11. | is assigned the "api" middleware group. Enjoy building your API!
  12. |
  13. */
  14. $api = app('Dingo\Api\Routing\Router');
  15. $api->version('v1',['limit'=>60, 'expire' => 1, 'namespace'=>'App\Http\Controllers'], function ($api) {
  16. $api->get('web','AdminController@web');
  17. //管理员登陆退出
  18. $api->group(['prefix'=>'auth', 'name'=> 'auth.'],function ($api) {
  19. $api->post('login', 'AuthController@login')->name('login');
  20. $api->get('me', 'AuthController@me')->name('me');
  21. $api->post('editPassword', 'AuthController@editPassword')->name('editPassword');
  22. $api->post('logout', 'AuthController@logout')->name('logout');
  23. });
  24. //管理员
  25. $api->group(['prefix'=>'admin', 'name'=> 'admin.', 'middleware'=> 'check.token'],function ($api) { //, 'middleware'=> 'check.token'
  26. $api->post('/create', 'AdminController@create')->name('create');
  27. $api->get('/show', 'AdminController@show')->name('show');
  28. $api->get('/index', 'AdminController@index')->name('index');
  29. $api->post('/update', 'AdminController@update')->name('update');
  30. $api->post('/destroy', 'AdminController@destroy')->name('destroy');
  31. $api->post('/uploadImg', 'AdminController@uploadImg')->name('uploadImg');
  32. $api->post('/setStatus', 'AdminController@setStatus')->name('setStatus');
  33. });
  34. //角色
  35. $api->group(['prefix'=>'role', 'name'=> 'role.', 'middleware'=> 'check.token'],function ($api) {
  36. $api->post('/create', 'RoleController@create')->name('create');
  37. $api->get('/show', 'RoleController@show')->name('show');
  38. $api->get('/index', 'RoleController@index')->name('index');
  39. $api->post('/update', 'RoleController@update')->name('update');
  40. $api->get('/all', 'RoleController@all')->name('all');
  41. $api->post('/destroy', 'RoleController@destroy')->name('destroy');
  42. });
  43. //后台站点
  44. $api->group(['prefix'=>'site', 'name'=> 'site.', 'middleware'=> 'check.token'],function ($api) {
  45. $api->post('/create', 'SiteController@create')->name('create');
  46. $api->get('/show', 'SiteController@show')->name('show');
  47. $api->get('/index', 'SiteController@index')->name('index');
  48. $api->post('/update', 'SiteController@update')->name('update');
  49. $api->post('/destroy', 'SiteController@destroy')->name('destroy');
  50. $api->post('/uploadImg', 'SiteController@uploadImg')->name('uploadImg');
  51. $api->get('/all', 'SiteController@all')->name('all');
  52. });
  53. });