api.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Application Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register all of the routes for an application.
  8. | It is a breeze. Simply tell Lumen the URIs it should respond to
  9. | and give it the Closure to call when that URI is requested.
  10. |
  11. */
  12. $api = app('Dingo\Api\Routing\Router');
  13. $api->version('v1', [
  14. 'namespace' => 'App\Http\Controllers',
  15. ], function ($api) {
  16. //登录
  17. $api->post('login', 'AuthController@authenticate');
  18. $api->group(['middleware' => 'auth:api'], function ($api) {
  19. //注册
  20. $api->post('reg', 'AuthController@register');
  21. //登出
  22. $api->post('logout', 'AuthController@logout');
  23. //刷新身份令牌
  24. $api->post('refresh', 'AuthController@refresh');
  25. });
  26. $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
  27. //用户列表
  28. $api->get('user', 'UserController@index');
  29. //用户列表
  30. $api->get('memberList', 'MemberController@memberList');
  31. //用户详情
  32. $api->post('memberView', 'MemberController@view');
  33. //修改状态
  34. $api->put('updateStatus', 'MemberController@updateStatus');
  35. //设置属性
  36. $api->post('setAttr', 'MemberController@setAttr');
  37. //公共配置
  38. $api->post('configIndex', 'ConfigController@index');
  39. //专题列表
  40. $api->get('/subject/index', 'CmsSubjectController@index');
  41. //新增专题
  42. $api->post('/subject/create', 'CmsSubjectController@create');
  43. //查看某专题
  44. $api->post('/subject/view', 'CmsSubjectController@view');
  45. //编辑专题
  46. $api->post('/subject/edit', 'CmsSubjectController@edit');
  47. //删除专题
  48. $api->post('/subject/delete', 'CmsSubjectController@delete');
  49. });
  50. });