success($this->service->getPageList($this->request->all())); } /** * 获取日志列表分页数据 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("logPageList")] public function logPageList(): ResponseInterface { return $this->success($this->logService->getPageList($this->request->all())); } /** * 保存数据 * @param SettingCrontabRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("save"), Permission("setting:crontab:save"), OperationLog] public function save(SettingCrontabRequest $request): ResponseInterface { return $this->success(['id' => $this->service->save($request->all())]); } /** * 立即执行定时任务 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("run"), Permission("setting:crontab:run"), OperationLog] public function run(): ResponseInterface { $id = $this->request->input('id', null); if (is_null($id)) { return $this->error(); } else { return $this->service->run($id) ? $this->success() : $this->error(); } } /** * 获取一条数据信息 * @param int $id * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("read/{id}"), Permission("setting:crontab:read")] public function read(int $id): ResponseInterface { return $this->success($this->service->read($id)); } /** * 更新数据 * @param int $id * @param SettingCrontabRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("update/{id}"), Permission("setting:crontab:update"), OperationLog] public function update(int $id, SettingCrontabRequest $request): ResponseInterface { return $this->service->update($id, $request->all()) ? $this->success() : $this->error(); } /** * 单个或批量删除 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[DeleteMapping("delete"), Permission("setting:crontab:delete")] public function delete(): ResponseInterface { return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error(); } /** * 删除定时任务日志 * @return \Psr\Http\Message\ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[DeleteMapping("deleteCrontabLog"), Permission("setting:crontab:deleteCrontabLog"), OperationLog("删除定时任务日志")] public function deleteCrontabLog(): \Psr\Http\Message\ResponseInterface { return $this->logService->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error(); } /** * 更改状态 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("changeStatus"), Permission("setting:crontab:update"), OperationLog] public function changeStatus(): ResponseInterface { return $this->service->changeStatus((int) $this->request->input('id'), (string) $this->request->input('status')) ? $this->success() : $this->error(); } }