From bd635f4af181e1a1d9619e0b9f96bf63bc20cd90 Mon Sep 17 00:00:00 2001 From: wangdl Date: Thu, 28 May 2026 20:17:52 +0800 Subject: [PATCH] feat(ios): IOS-M0-06 + IOS-M0-07 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - LearningSessionService 新增 list() 分页查询 - FileUploadService 新增 deleteFile() 调用 DELETE /files/:id Co-Authored-By: Claude Opus 4.7 --- AIStudyApp/AIStudyApp/Core/Services/APIService.swift | 7 +++++++ .../AIStudyApp/Core/Services/FileUploadService.swift | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/AIStudyApp/AIStudyApp/Core/Services/APIService.swift b/AIStudyApp/AIStudyApp/Core/Services/APIService.swift index 6d7dbaa..557df83 100644 --- a/AIStudyApp/AIStudyApp/Core/Services/APIService.swift +++ b/AIStudyApp/AIStudyApp/Core/Services/APIService.swift @@ -210,6 +210,13 @@ class LearningSessionService { func end(id: String) async throws -> LearningSession { return try await client.request("/learning-sessions/\(id)/end", method: "POST") } + + func list(page: Int = 1, limit: Int = 20) async throws -> [LearningSession] { + return try await client.request("/learning-sessions", queryItems: [ + URLQueryItem(name: "page", value: String(page)), + URLQueryItem(name: "limit", value: String(limit)), + ]) + } } // MARK: - Review diff --git a/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift b/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift index c010470..95adacd 100644 --- a/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift +++ b/AIStudyApp/AIStudyApp/Core/Services/FileUploadService.swift @@ -74,6 +74,11 @@ class FileUploadService { return confirmResp.id } + /// 删除文件(COS + 数据库) + func deleteFile(fileId: String) async throws { + let _: GenericSuccessResponse = try await client.request("/files/\(fileId)", method: "DELETE") + } + /// 获取文件下载 URL func getDownloadUrl(fileId: String) async throws -> String { let detail: FileDetailResponse = try await client.request("/files/\(fileId)")