Order.php 1.3 KB

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