feat: 添加云盘与消息中心功能
This commit is contained in:
@ -179,6 +179,24 @@ final class OSSUploadService {
|
||||
)
|
||||
}
|
||||
|
||||
/// 上传相册云盘文件,对齐 Android `cloud_driver` / `cloud_driver_test` 路径。
|
||||
func uploadCloudDriveFile(
|
||||
data: Data,
|
||||
fileName: String,
|
||||
fileType: Int,
|
||||
scenicId: Int,
|
||||
onProgress: @escaping (Int) -> Void
|
||||
) async throws -> String {
|
||||
try await uploadFile(
|
||||
data: data,
|
||||
fileName: fileName,
|
||||
fileType: fileType,
|
||||
scenicId: scenicId,
|
||||
moduleType: "cloud_driver",
|
||||
onProgress: onProgress
|
||||
)
|
||||
}
|
||||
|
||||
/// 上传举报摄影师附件,对齐举报提交接口的证据与支付截图。
|
||||
func uploadWildReportAttachment(
|
||||
data: Data,
|
||||
@ -280,7 +298,7 @@ enum OSSUploadPolicy {
|
||||
formatter.timeZone = timeZone
|
||||
formatter.dateFormat = "yyyyMMdd"
|
||||
let currentDate = formatter.string(from: date)
|
||||
let uploadId = uuid.uuidString.replacingOccurrences(of: "-", with: "")
|
||||
let uploadId = uuid.uuidString.replacingOccurrences(of: "-", with: "").lowercased()
|
||||
let safeName = sanitizedFileName(fileName)
|
||||
switch moduleType {
|
||||
case "user_avatar":
|
||||
@ -307,6 +325,16 @@ enum OSSUploadPolicy {
|
||||
return "live_covers/\(currentDate)/\(scenicId)/\(uploadId)_\(safeName)"
|
||||
case "alive_album":
|
||||
return "alive_album/\(currentDate)/\(scenicId)/\(uploadId)_\(safeName)"
|
||||
case "cloud_driver":
|
||||
let userId = AppStore.shared.userId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let ownerId = userId.isEmpty ? String(scenicId) : userId
|
||||
let month = String(currentDate.dropFirst(4).prefix(2))
|
||||
#if DEBUG
|
||||
let root = "cloud_driver_test"
|
||||
#else
|
||||
let root = "cloud_driver"
|
||||
#endif
|
||||
return "\(root)/\(ownerId)/\(String(currentDate.prefix(4)))/\(month)/\(safeName)"
|
||||
case "photog_report":
|
||||
return "photog_report/\(currentDate)/\(scenicId)/\(uploadId)_\(safeName)"
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user