| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\controller\api\cutter;
- use app\extra\basic\Base;
- use app\extra\service\cutter\CutterTaskService;
- use DI\Attribute\Inject;
- use LinFly\Annotation\Route\Controller;
- use LinFly\Annotation\Route\Route;
- use support\Request;
- use support\Response;
- #[Controller(prefix: "/api/cutter/task")]
- class CutterTaskController extends Base
- {
- #[Inject]
- protected CutterTaskService $service;
- #[Route(path: "lst",methods: "get")]
- public function getList(Request $request): Response
- {
- try {
- $param = $request->get();
- $param['status'] = 1;
- $param['is_del'] = 0;
- $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0);
- return successTrans("success.data",$list);
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- #[Route(path: "info/{id}",methods: "get")]
- public function info($id): Response
- {
- try {
- $take = $this->service->getOne(["id"=>$id]);
- if ($take->isEmpty()) return errorTrans("empty.error");
- return successTrans("success.data",$take->toArray(),200);
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- }
|