refactor: 调整盲盒返回结构
This commit is contained in:
parent
40ef986c6f
commit
9e965c1e4e
@ -75,19 +75,36 @@ struct BlindBoxView: View {
|
|||||||
}
|
}
|
||||||
// 盲盒列表
|
// 盲盒列表
|
||||||
struct BlindList: Codable, Identifiable {
|
struct BlindList: Codable, Identifiable {
|
||||||
let id: Int64
|
// API 返回为字符串,这里按字符串处理
|
||||||
|
let id: String
|
||||||
let boxCode: String
|
let boxCode: String
|
||||||
let userId: Int64
|
let userId: String
|
||||||
let name: String
|
let name: String
|
||||||
let boxType: String
|
let boxType: String
|
||||||
let features: String?
|
let features: String?
|
||||||
let resultFileId: Int64?
|
let resultFile: FileInfo?
|
||||||
let status: String
|
let status: String
|
||||||
let workflowInstanceId: String?
|
let workflowInstanceId: String?
|
||||||
let videoGenerateTime: String?
|
let videoGenerateTime: String?
|
||||||
let createTime: String
|
let createTime: String
|
||||||
let coverFileId: Int64?
|
let coverFile: FileInfo?
|
||||||
let description: String
|
let description: String?
|
||||||
|
|
||||||
|
struct FileInfo: Codable {
|
||||||
|
let id: String
|
||||||
|
let fileName: String?
|
||||||
|
let url: String?
|
||||||
|
// 为了兼容任意元数据结构,这里使用字典的最宽松版本
|
||||||
|
// 如果后续需要更强类型,可以引入自定义的 AnyCodable/JSONValue
|
||||||
|
let metadata: [String: String]?
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey {
|
||||||
|
case id
|
||||||
|
case fileName = "file_name"
|
||||||
|
case url
|
||||||
|
case metadata
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case id
|
case id
|
||||||
@ -96,12 +113,12 @@ struct BlindBoxView: View {
|
|||||||
case name
|
case name
|
||||||
case boxType = "box_type"
|
case boxType = "box_type"
|
||||||
case features
|
case features
|
||||||
case resultFileId = "result_file_id"
|
case resultFile = "result_file"
|
||||||
case status
|
case status
|
||||||
case workflowInstanceId = "workflow_instance_id"
|
case workflowInstanceId = "workflow_instance_id"
|
||||||
case videoGenerateTime = "video_generate_time"
|
case videoGenerateTime = "video_generate_time"
|
||||||
case createTime = "create_time"
|
case createTime = "create_time"
|
||||||
case coverFileId = "cover_file_id"
|
case coverFile = "cover_file"
|
||||||
case description
|
case description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,13 +180,13 @@ struct BlindBoxView: View {
|
|||||||
|
|
||||||
init(from listItem: BlindList) {
|
init(from listItem: BlindList) {
|
||||||
self.init(
|
self.init(
|
||||||
id: listItem.id,
|
id: Int64(listItem.id) ?? 0,
|
||||||
boxCode: listItem.boxCode,
|
boxCode: listItem.boxCode,
|
||||||
userId: listItem.userId,
|
userId: Int64(listItem.userId) ?? 0,
|
||||||
name: listItem.name,
|
name: listItem.name,
|
||||||
boxType: listItem.boxType,
|
boxType: listItem.boxType,
|
||||||
features: listItem.features,
|
features: listItem.features,
|
||||||
url: nil,
|
url: listItem.resultFile?.url,
|
||||||
status: listItem.status,
|
status: listItem.status,
|
||||||
workflowInstanceId: listItem.workflowInstanceId,
|
workflowInstanceId: listItem.workflowInstanceId,
|
||||||
videoGenerateTime: listItem.videoGenerateTime,
|
videoGenerateTime: listItem.videoGenerateTime,
|
||||||
|
|||||||
@ -23,7 +23,8 @@ enum AppRoute: Hashable {
|
|||||||
case .login:
|
case .login:
|
||||||
LoginView()
|
LoginView()
|
||||||
case .avatarBox:
|
case .avatarBox:
|
||||||
AvatarBoxView()
|
// AvatarBoxView has been removed; route to BlindBoxView as replacement
|
||||||
|
BlindBoxView(mediaType: .all)
|
||||||
case .feedbackView:
|
case .feedbackView:
|
||||||
FeedbackView()
|
FeedbackView()
|
||||||
case .feedbackDetail(let type):
|
case .feedbackDetail(let type):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user