api.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. $api->group(['middleware' => 'jwt.chxq_auth'], function ($api) {
  17. //配置
  18. $api->get('config', 'ConfigController@index');
  19. $api->group(['namespace' => 'Post'], function ($api) {
  20. //发布内容
  21. $api->post('post', 'PostController@create');
  22. //内容列表
  23. $api->get('post', 'PostController@index');
  24. //内容详情
  25. $api->get('post/detail', 'PostController@detail');
  26. //推荐内容
  27. $api->put('post/suggest', 'PostController@suggest');
  28. //删除内容
  29. $api->delete('post/delete', 'PostController@delete');
  30. //隐藏内容
  31. $api->put('post/hide', 'PostController@hide');
  32. //增加数据
  33. $api->put('post/addData', 'PostController@addData');
  34. //评论列表
  35. $api->get('post/comment', 'PostController@commentList');
  36. //评论&回复
  37. $api->post('post/comment', 'PostController@comment');
  38. //删除评论
  39. $api->delete('post/comment/delete', 'PostController@commentDelete');
  40. //日志列表
  41. $api->get('post/log', 'PostController@log');
  42. });
  43. });
  44. });