BookCategoryController.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Http\Controllers\KuaiYingYong\Book;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use App\Modules\Book\Services\BookCategoryService;
  6. class BookCategoryController extends Controller
  7. {
  8. /**
  9. * @apiDefine Book 图书
  10. */
  11. /**
  12. * @apiVersion 1.0.0
  13. * @apiDescription 获取分类
  14. * @api {get} books/getCategory 获取分类
  15. * @apiParam {String} [token] token
  16. * @apiHeader {String} [Authorization] token 两个token任选其一
  17. * @apiGroup Book
  18. * @apiName getCategory
  19. * @apiSuccess {int} code 状态码
  20. * @apiSuccess {String} msg 信息
  21. * @apiSuccess {object} data 结果集
  22. * @apiSuccessExample {json} Success-Response:
  23. * HTTP/1.1 200 OK
  24. * {
  25. * code: 0,
  26. * msg: "",
  27. * data: [
  28. * {
  29. * id: 1,
  30. * name: "男频",
  31. * children: [
  32. * {
  33. * id: 7,
  34. * name: "灵异鬼怪"
  35. * },
  36. * {
  37. * id: 8,
  38. * name: "历史穿越"
  39. * },
  40. * {
  41. * id: 30,
  42. * name: "青春爱情"
  43. * }
  44. * ]
  45. * },
  46. * {
  47. * id: 2,
  48. * name: "女频",
  49. * children: [
  50. * {
  51. * id: 26,
  52. * name: "豪门总裁"
  53. * },
  54. * {
  55. * id: 35,
  56. * name: "民国爱情"
  57. * }
  58. * ]
  59. * }
  60. * ]
  61. * }
  62. */
  63. public function getCategory(Request $request){
  64. $res = BookCategoryService::getCategory(true);
  65. return response()->success($res);
  66. }
  67. }