success($this->service->getList($this->request->all())); } /** * 保存配置 * @param SettingConfigRequest $request * @return \Psr\Http\Message\ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("save"), Permission("setting:config:save"), OperationLog] public function save(SettingConfigRequest $request): \Psr\Http\Message\ResponseInterface { return $this->service->save($request->validated()) ? $this->success() : $this->error(); } /** * 更新配置 * @param SettingConfigRequest $request * @return \Psr\Http\Message\ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("update"), Permission("setting:config:update"), OperationLog] public function update(SettingConfigRequest $request): \Psr\Http\Message\ResponseInterface { return $this->service->updated($this->request->input('key'), $request->validated()) ? $this->success() : $this->error(); } /** * 按 keys 更新配置 * @param SettingConfigRequest $request * @return \Psr\Http\Message\ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("updateByKeys"), Permission("setting:config:update"), OperationLog] public function updateByKeys(): \Psr\Http\Message\ResponseInterface { return $this->service->updatedByKeys($this->request->all()) ? $this->success() : $this->error(); } /** * 删除配置 * @param string $key * @return \Psr\Http\Message\ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[DeleteMapping("delete"), Permission("setting:config:delete"), OperationLog] public function delete(): \Psr\Http\Message\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 */ #[PostMapping("clearCache"), Permission("setting:config:clearCache"), OperationLog] public function clearCache(): \Psr\Http\Message\ResponseInterface { return $this->service->clearCache() ? $this->success() : $this->error(); } }