feat: 添加云盘与消息中心功能

This commit is contained in:
2026-07-09 22:37:43 +08:00
parent 8e356973bd
commit f20ec7f06c
91 changed files with 5437 additions and 89 deletions

View File

@ -0,0 +1,165 @@
//
// CloudDriveModels.swift
// suixinkan
//
import Foundation
/// / Android `CloudFileEntity`
struct CloudFile: Codable, Sendable, Equatable, Hashable {
let id: Int
let parentFolderId: Int
let fileUrl: String
let coverUrl: String
let updatedAt: String
let name: String
let createdAt: String
let childNum: Int
let type: Int
let fileSize: Int64
enum CodingKeys: String, CodingKey {
case id
case parentFolderId = "parent_folder_id"
case fileUrl = "file_url"
case coverUrl = "cover_url"
case updatedAt = "updated_at"
case name
case createdAt = "created_at"
case childNum = "child_num"
case type
case fileSize = "file_size"
}
init(
id: Int = 0,
parentFolderId: Int = 0,
fileUrl: String = "",
coverUrl: String = "",
updatedAt: String = "",
name: String = "",
createdAt: String = "",
childNum: Int = 0,
type: Int = 0,
fileSize: Int64 = 0
) {
self.id = id
self.parentFolderId = parentFolderId
self.fileUrl = fileUrl
self.coverUrl = coverUrl
self.updatedAt = updatedAt
self.name = name
self.createdAt = createdAt
self.childNum = childNum
self.type = type
self.fileSize = fileSize
}
///
var isFolder: Bool { type == 99 }
///
var isImage: Bool { type == 2 }
///
var isVideo: Bool { type == 1 }
///
var isSelectableMedia: Bool { isImage || isVideo }
}
///
struct CloudFileListResponse: Codable, Sendable, Equatable {
let total: Int
let list: [CloudFile]
init(total: Int = 0, list: [CloudFile] = []) {
self.total = total
self.list = list
}
}
///
struct CloudPathItem: Codable, Sendable, Equatable, Hashable {
let id: Int
let name: String
}
///
struct CloudUploadPermissionResponse: Decodable, Sendable, Equatable {
let canUpload: Bool
let reason: String
enum CodingKeys: String, CodingKey {
case canUpload = "can_upload"
case reason
}
}
///
struct CloudFileDeleteRequest: Encodable, Sendable, Equatable {
let list: [CloudFileOperationItem]
}
///
struct CloudFileMoveRequest: Encodable, Sendable, Equatable {
let targetFolderId: Int
let list: [CloudFileOperationItem]
enum CodingKeys: String, CodingKey {
case targetFolderId = "target_folder_id"
case list
}
}
/// /
struct CloudFileOperationItem: Codable, Sendable, Equatable {
let id: Int
let type: Int
}
///
struct CloudFolderCreateRequest: Encodable, Sendable, Equatable {
let parentFolderId: Int
let name: String
enum CodingKeys: String, CodingKey {
case parentFolderId = "parent_folder_id"
case name
}
}
///
struct CloudFileUploadRequest: Encodable, Sendable, Equatable {
let parentFolderId: Int
let fileUrl: String
let fileName: String
enum CodingKeys: String, CodingKey {
case parentFolderId = "parent_folder_id"
case fileUrl = "file_url"
case fileName = "file_name"
}
}
///
struct CloudFolderModifyRequest: Encodable, Sendable, Equatable {
let fileId: Int
let name: String
enum CodingKeys: String, CodingKey {
case fileId = "id"
case name
}
}
///
struct CloudFileModifyRequest: Encodable, Sendable, Equatable {
let fileId: Int
let fileName: String
enum CodingKeys: String, CodingKey {
case fileId = "id"
case fileName = "file_name"
}
}