chore: 判断盲盒数量,确定是否进入新手引导
This commit is contained in:
parent
8f97b0c544
commit
8fb6d5c6b9
@ -108,11 +108,6 @@ struct BlindBoxView: View {
|
||||
|
||||
init(mediaType: BlindBoxMediaType) {
|
||||
self.mediaType = mediaType
|
||||
|
||||
// 检查盲盒列表,如果不存在First/Second盲盒,则跳转到对应的页面重新触发新手引导
|
||||
if mediaType == BlindBoxMediaType.all {
|
||||
print("获取盲盒列表")
|
||||
}
|
||||
}
|
||||
|
||||
// 倒计时
|
||||
@ -162,6 +157,39 @@ struct BlindBoxView: View {
|
||||
startPolling()
|
||||
case .all:
|
||||
print("Loading all content...")
|
||||
// 检查盲盒列表,如果不存在First/Second盲盒,则跳转到对应的页面重新触发新手引导
|
||||
NetworkService.shared.get(
|
||||
path: "/blind_boxs/query",
|
||||
parameters: nil
|
||||
) { (result: Result<APIResponse<[BlindList]>, NetworkError>) in
|
||||
DispatchQueue.main.async {
|
||||
switch result {
|
||||
case .success(let response):
|
||||
if response.data.count == 0 {
|
||||
// 跳转到新手引导-First盲盒页面
|
||||
print("❌ 没有盲盒,跳转到新手引导-First盲盒页面")
|
||||
// return
|
||||
}
|
||||
if response.data.count == 1 && response.data[0].boxType == "First" {
|
||||
// 跳转到新手引导-Second盲盒页面
|
||||
print("❌ 只有First盲盒,跳转到新手引导-Second盲盒页面")
|
||||
// return
|
||||
}
|
||||
|
||||
self.blindList = response.data ?? []
|
||||
// 如果列表为空数组 设置盲盒状态为none
|
||||
if self.blindList.isEmpty {
|
||||
self.animationPhase = .none
|
||||
}
|
||||
print("✅ 成功获取 \(self.blindList.count) 个盲盒")
|
||||
case .failure(let error):
|
||||
self.blindList = []
|
||||
self.animationPhase = .none
|
||||
print("❌ 获取盲盒列表失败:", error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 会员信息
|
||||
NetworkService.shared.get(
|
||||
path: "/membership/personal-center-info",
|
||||
@ -195,27 +223,6 @@ struct BlindBoxView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 盲盒列表
|
||||
NetworkService.shared.get(
|
||||
path: "/blind_boxs/query",
|
||||
parameters: nil
|
||||
) { (result: Result<APIResponse<[BlindList]>, NetworkError>) in
|
||||
DispatchQueue.main.async {
|
||||
switch result {
|
||||
case .success(let response):
|
||||
self.blindList = response.data ?? []
|
||||
// 如果列表为空数组 设置盲盒状态为none
|
||||
if self.blindList.isEmpty {
|
||||
self.animationPhase = .none
|
||||
}
|
||||
print("✅ 成功获取 \(self.blindList.count) 个盲盒")
|
||||
case .failure(let error):
|
||||
self.blindList = []
|
||||
self.animationPhase = .none
|
||||
print("❌ 获取盲盒列表失败:", error.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 轮询接口
|
||||
@ -862,7 +869,7 @@ struct BlindBoxView: View {
|
||||
if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" {
|
||||
// 设置模拟令牌用于Preview
|
||||
let previewToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJqdGkiOjczNzAwMTY5NzMzODE1NzA1NjAsImlkZW50aXR5IjoiNzM1MDQzOTY2MzExNjYxOTc3NyIsImV4cCI6MTc1Nzc1Mzc3NH0.tZ8p5sW4KX6HFoJpJN0e4VmJOAGhTrYD2yTwQwilKpufzqOAfXX4vpGYBurgBIcHj2KmXKX2PQMOeeAtvAypDA"
|
||||
KeychainHelper.saveAccessToken(previewToken)
|
||||
let _ = KeychainHelper.saveAccessToken(previewToken)
|
||||
print("🔑 Preview token set for testing")
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user