CutterTaskController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\controller\api\cutter;
  3. use app\extra\basic\Base;
  4. use app\extra\service\cutter\CutterTaskService;
  5. use DI\Attribute\Inject;
  6. use LinFly\Annotation\Route\Controller;
  7. use LinFly\Annotation\Route\Route;
  8. use support\Request;
  9. use support\Response;
  10. #[Controller(prefix: "/api/cutter/task")]
  11. class CutterTaskController extends Base
  12. {
  13. #[Inject]
  14. protected CutterTaskService $service;
  15. #[Route(path: "lst",methods: "get")]
  16. public function getList(Request $request): Response
  17. {
  18. try {
  19. $param = $request->get();
  20. $param['status'] = 1;
  21. $param['is_del'] = 0;
  22. $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
  23. return successTrans("success.data",$list);
  24. } catch (\Throwable $throwable) {
  25. return error($throwable->getMessage());
  26. }
  27. }
  28. #[Route(path: "info/{id}",methods: "get")]
  29. public function info($id): Response
  30. {
  31. try {
  32. $take = $this->service->getOne(["id"=>$id]);
  33. if ($take->isEmpty()) return errorTrans("empty.error");
  34. return successTrans("success.data",$take->toArray(),200);
  35. } catch (\Throwable $throwable) {
  36. return error($throwable->getMessage());
  37. }
  38. }
  39. }