BookCategoryController.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Http\Controllers\Wap\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}
  15. * 获取分类
  16. * @apiGroup Book
  17. * @apiName getCategory
  18. * @apiSuccess {int} code 状态码
  19. * @apiSuccess {String} msg 信息
  20. * @apiSuccess {object} data 结果集
  21. * @apiSuccessExample {json} Success-Response:
  22. * HTTP/1.1 200 OK
  23. * {
  24. * code: 0,
  25. * msg: "",
  26. * data: [
  27. * {
  28. * id: 1,
  29. * name: "男频",
  30. * children: [
  31. * {
  32. * id: 7,
  33. * name: "灵异鬼怪"
  34. * },
  35. * {
  36. * id: 8,
  37. * name: "历史穿越"
  38. * },
  39. * {
  40. * id: 30,
  41. * name: "青春爱情"
  42. * }
  43. * ]
  44. * },
  45. * {
  46. * id: 2,
  47. * name: "女频",
  48. * children: [
  49. * {
  50. * id: 26,
  51. * name: "豪门总裁"
  52. * },
  53. * {
  54. * id: 35,
  55. * name: "民国爱情"
  56. * }
  57. * ]
  58. * }
  59. * ]
  60. * }
  61. */
  62. public function getCategory(Request $request){
  63. $res = BookCategoryService::getCategory(true);
  64. return response()->success($res);
  65. }
  66. }