Expert.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\controller\admin;
  3. use app\extra\basic\Base;
  4. use app\extra\service\blue\ExpertService;
  5. use app\middleware\AuthMiddleware;
  6. use app\model\blue\BlueExpert;
  7. use DI\Attribute\Inject;
  8. use LinFly\Annotation\Route\Controller;
  9. use LinFly\Annotation\Route\Middleware;
  10. use LinFly\Annotation\Route\Route;
  11. use support\Request;
  12. use support\Response;
  13. /**
  14. * 达人
  15. */
  16. #[Controller(prefix: "/api/expert"),Middleware(AuthMiddleware::class)]
  17. class Expert extends Base
  18. {
  19. #[Inject]
  20. protected BlueExpert $model;
  21. #[Inject]
  22. protected ExpertService $service;
  23. /**
  24. *
  25. * @param Request $request
  26. * @return Response
  27. */
  28. #[Route(path: "list",methods: "get")]
  29. public function getDataList(Request $request): Response
  30. {
  31. try {
  32. $param = $request->all();
  33. $list = $this->service->getList($param);
  34. return successTrans("success.data",pageFormat($list),200);
  35. } catch (\Throwable $throwable) {
  36. return error($throwable->getMessage());
  37. }
  38. }
  39. }