ArticleCategoryController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Services\Common\ArticleCategoryService;
  4. /**
  5. * 文章分类管理-控制器
  6. * @author laravel开发员
  7. * @since 2020/11/11
  8. * Class ArticleCategoryController
  9. * @package App\Http\Controllers\Admin
  10. */
  11. class ArticleCategoryController extends Backend
  12. {
  13. /**
  14. * 构造函数
  15. * @author laravel开发员
  16. * @since 2020/11/11
  17. * ArticleCategoryController constructor.
  18. */
  19. public function __construct()
  20. {
  21. parent::__construct();
  22. $this->service = new ArticleCategoryService();
  23. }
  24. /**
  25. * 获取分类列表
  26. */
  27. public function index()
  28. {
  29. $pageSize = request()->get('limit', 10);
  30. $list = $this->service->getDataList(request()->all(), $pageSize);
  31. $message = array(
  32. "msg" => '操作成功',
  33. "code" => 0,
  34. "data" => isset($list['list']) ? $list['list'] : [],
  35. "count" => isset($list['total']) ? $list['total'] : 0,
  36. );
  37. return $message;
  38. }
  39. /**
  40. * 获取分类选项
  41. */
  42. public function options()
  43. {
  44. $list = $this->service->getOptions();
  45. return response()->json(['code' => 0, 'msg' => '操作成功', 'data' => $list]);
  46. }
  47. /**
  48. * 获取分类详情
  49. */
  50. public function info()
  51. {
  52. return $this->service->info();
  53. }
  54. /**
  55. * 添加或编辑分类
  56. */
  57. public function edit()
  58. {
  59. return $this->service->edit();
  60. }
  61. /**
  62. * 删除分类
  63. */
  64. public function delete()
  65. {
  66. return $this->service->delete();
  67. }
  68. /**
  69. * 设置分类状态
  70. */
  71. public function status()
  72. {
  73. return $this->service->status();
  74. }
  75. }