Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
pidan
/
FuSiLive
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5e3d79f8
authored
Jun 25, 2026
by
suolong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加兜底轮训策略
parent
e23e18c8
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
172 additions
and
15 deletions
FuSiLive.xcworkspace/xcshareddata/swiftpm/Package.resolved
FuSiLive.xcworkspace/xcuserdata/server.xcuserdatad/UserInterfaceState.xcuserstate
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHelper.h
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHelper.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.h
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.h
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.m
FuSiLive.xcworkspace/xcshareddata/swiftpm/Package.resolved
deleted
100644 → 0
View file @
e23e18c8
{
"originHash" : "e5d0f68effe33090a2fe9ffff53474a349a46eb9093528d7ce8c0e56fd3cd927",
"pins" : [
{
"identity" : "tiktok-business-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tiktok/tiktok-business-ios-sdk",
"state" : {
"revision" : "4d330d4da158190d2c67b2142c2bd36c9eb5291e",
"version" : "1.6.1"
}
}
],
"version" : 3
}
FuSiLive.xcworkspace/xcuserdata/server.xcuserdatad/UserInterfaceState.xcuserstate
View file @
5e3d79f8
No preview for this file type
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m
View file @
5e3d79f8
...
...
@@ -1865,6 +1865,7 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
if
(
code
==
1
)
{
[
self
.
resentJoinRoomTimer
invalidate
];
self
.
resentJoinRoomTimer
=
nil
;
[[
FUSLiveHelper
shareInstance
]
fus_startShowTimeBuyVerifyPolling
];
}
if
(
code
!=
1
&&
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHelper.h
View file @
5e3d79f8
...
...
@@ -286,6 +286,12 @@ typedef NS_ENUM(NSInteger,FUSLiveRoomScopeType) {
roundId
:(
NSString
*
)
roundId
tipText
:(
NSString
*
)
tipText
;
/// 进房成功后启动未购票资格校验轮询:首次 30 秒,后续按服务端 nexttimes 调度。
-
(
void
)
fus_startShowTimeBuyVerifyPolling
;
/// 停止未购票资格校验轮询,退出直播间或命中无权限时调用。
-
(
void
)
fus_stopShowTimeBuyVerifyPolling
;
// 最小化直播间
+
(
void
)
fus_minimizeLiveCompletion
:
(
void
(
^
__nullable
)(
void
))
completion
;
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHelper.m
View file @
5e3d79f8
...
...
@@ -85,12 +85,21 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
@property
(
nonatomic
,
assign
)
BOOL
isRequestingPayRoomRenewalViewing
;
@property
(
nonatomic
,
copy
)
NSString
*
payRoomRenewalCountdownRoomId
;
/// 限时表演未购票资格校验定时器:首次 30 秒,后续按服务端 nexttimes 调度。
@property
(
nonatomic
,
strong
)
dispatch_source_t
showTimeBuyVerifyTimer
;
/// 当前校验绑定的房间ID,切房后用于拦截旧请求回调。
@property
(
nonatomic
,
copy
)
NSString
*
showTimeBuyVerifyRoomId
;
/// 避免同一时间并发发起多次资格校验请求。
@property
(
nonatomic
,
assign
)
BOOL
isRequestingShowTimeBuyVerify
;
@end
@implementation
FUSLiveHelper
static
NSInteger
const
kFUSPayRoomCompanionPopViewTagRight
=
90917001
;
static
NSInteger
const
kFUSPayRoomCompanionPopViewTagLeft
=
90917002
;
static
NSInteger
const
kFUSShowTimeBuyVerifyInitialDelayMs
=
30
*
1000
;
static
NSInteger
const
kFUSShowTimeBuyVerifyMinimumDelayMs
=
1000
;
/**
* 获取单例
...
...
@@ -1136,6 +1145,7 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
roundId
:
(
NSString
*
)
roundId
tipText
:
(
NSString
*
)
tipText
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
NSString
*
currentRoomId
=
([
NSString
isNull
:
roomId
]
?
(
self
.
roomInfoModel
.
roomId
?:
@""
)
:
roomId
);
NSString
*
safeChannelId
=
([
NSString
isNull
:
channelId
]
?
(
self
.
roomInfoModel
.
channelId
?:
@""
)
:
channelId
);
...
...
@@ -1190,6 +1200,116 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
});
}
/// 进房成功后启动未购票资格校验轮询:首轮固定 30 秒,后续完全按服务端 nexttimes 驱动。
-
(
void
)
fus_startShowTimeBuyVerifyPolling
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
if
(
self
.
liveType
!=
FUSLiveTypeAudience
)
{
return
;
}
NSString
*
roomId
=
self
.
roomInfoModel
.
roomId
?:
@""
;
if
([
NSString
isNull
:
roomId
])
{
return
;
}
self
.
showTimeBuyVerifyRoomId
=
roomId
;
[
self
fus_scheduleShowTimeBuyVerifyPollingAfterMs
:
kFUSShowTimeBuyVerifyInitialDelayMs
];
}
/// 停止未购票资格校验轮询,退出直播间、切房或被踢时统一调用。
-
(
void
)
fus_stopShowTimeBuyVerifyPolling
{
if
(
self
.
showTimeBuyVerifyTimer
)
{
dispatch_source_cancel
(
self
.
showTimeBuyVerifyTimer
);
self
.
showTimeBuyVerifyTimer
=
nil
;
}
self
.
isRequestingShowTimeBuyVerify
=
NO
;
self
.
showTimeBuyVerifyRoomId
=
@""
;
}
/// 按服务端返回的毫秒数安排下一次校验;-1 表示结束轮询。
-
(
void
)
fus_scheduleShowTimeBuyVerifyPollingAfterMs
:
(
NSInteger
)
delayMs
{
if
(
delayMs
<
0
)
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
return
;
}
NSString
*
roomId
=
self
.
roomInfoModel
.
roomId
?:
@""
;
if
(
self
.
liveType
!=
FUSLiveTypeAudience
||
[
NSString
isNull
:
roomId
])
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
return
;
}
if
(
self
.
showTimeBuyVerifyTimer
)
{
dispatch_source_cancel
(
self
.
showTimeBuyVerifyTimer
);
self
.
showTimeBuyVerifyTimer
=
nil
;
}
NSInteger
finalDelayMs
=
MAX
(
kFUSShowTimeBuyVerifyMinimumDelayMs
,
delayMs
);
self
.
showTimeBuyVerifyRoomId
=
roomId
;
__weak
typeof
(
self
)
weakSelf
=
self
;
dispatch_source_t
timer
=
dispatch_source_create
(
DISPATCH_SOURCE_TYPE_TIMER
,
0
,
0
,
dispatch_get_main_queue
());
dispatch_source_set_timer
(
timer
,
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)
finalDelayMs
*
NSEC_PER_MSEC
),
DISPATCH_TIME_FOREVER
,
(
uint64_t
)(
0
.
1
*
NSEC_PER_SEC
));
dispatch_source_set_event_handler
(
timer
,
^
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
!
strongSelf
)
{
return
;
}
if
(
strongSelf
.
showTimeBuyVerifyTimer
)
{
dispatch_source_cancel
(
strongSelf
.
showTimeBuyVerifyTimer
);
strongSelf
.
showTimeBuyVerifyTimer
=
nil
;
}
[
strongSelf
fus_requestShowTimeBuyVerifyWithRoomId
:
roomId
];
});
self
.
showTimeBuyVerifyTimer
=
timer
;
dispatch_resume
(
timer
);
}
/// 执行一次未购票资格校验:命中无票时直接复用现有踢去购票入口逻辑。
-
(
void
)
fus_requestShowTimeBuyVerifyWithRoomId
:
(
NSString
*
)
roomId
{
if
([
NSString
isNull
:
roomId
]
||
self
.
liveType
!=
FUSLiveTypeAudience
)
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
return
;
}
if
(
self
.
isRequestingShowTimeBuyVerify
)
{
return
;
}
self
.
isRequestingShowTimeBuyVerify
=
YES
;
__weak
typeof
(
self
)
weakSelf
=
self
;
[
FUSLiveHttpHelper
fus_ticketShowVerifyBuyHasWithRoomId
:
roomId
succeed
:
^
(
NSInteger
nextTimes
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
!
strongSelf
)
{
return
;
}
strongSelf
.
isRequestingShowTimeBuyVerify
=
NO
;
if
(
strongSelf
.
liveType
!=
FUSLiveTypeAudience
||
!
[
strongSelf
.
roomInfoModel
.
roomId
isEqualToString
:
roomId
])
{
return
;
}
[
strongSelf
fus_scheduleShowTimeBuyVerifyPollingAfterMs
:
nextTimes
];
});
}
failure
:^
(
NSString
*
msg
,
NSInteger
code
,
NSInteger
nextTimes
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
!
strongSelf
)
{
return
;
}
strongSelf
.
isRequestingShowTimeBuyVerify
=
NO
;
if
(
strongSelf
.
liveType
!=
FUSLiveTypeAudience
||
!
[
strongSelf
.
roomInfoModel
.
roomId
isEqualToString
:
roomId
])
{
return
;
}
if
(
code
==
-
40013
)
{
[
strongSelf
fus_handleShowTimeKickToBuyEntryWithRoomId
:
roomId
channelId
:(
strongSelf
.
roomInfoModel
.
channelId
?:
@""
)
roundId
:
(
strongSelf
.
roomInfoModel
.
roundId
?:
@""
)
tipText
:
(
msg
?:
@""
)];
return
;
}
[
strongSelf
fus_scheduleShowTimeBuyVerifyPollingAfterMs
:
nextTimes
];
});
}];
}
-
(
void
)
fus_requestTicketShowBuyGetDataAndFillEntry
:
(
FUSLiveShowTimeAudienceEntryMainView
*
)
entry
roomId
:
(
NSString
*
)
roomId
channelId
:
(
NSString
*
)
channelId
...
...
@@ -2012,6 +2132,7 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
}
-
(
void
)
fus_quitRoom
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
[[
FUSLiveHelper
shareInstance
].
liveMinimizeView
removeFromSuperview
];
[
FUSLiveHelper
shareInstance
].
liveMinimizeView
=
nil
;
if
([[
FUSLiveHelper
shareInstance
]
liveType
]
==
FUSLiveTypeAnchor
)
{
...
...
@@ -2790,6 +2911,7 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
*/
-
(
void
)
fus_destory
{
[
self
fus_stopPayRoomRenewalCountdown
];
[
self
fus_stopShowTimeBuyVerifyPolling
];
[
self
fus_quitRoom
];
self
.
liveType
=
FUSLiveTypeNone
;
self
.
roomType
=
defaultRoom
;
...
...
@@ -3000,6 +3122,7 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
#pragma mark - Other
-
(
void
)
dealloc
{
[
self
fus_stopShowTimeBuyVerifyPolling
];
[
self
fus_stopPayRoomPreviewCountdown
];
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.h
View file @
5e3d79f8
...
...
@@ -1011,6 +1011,16 @@ NS_ASSUME_NONNULL_BEGIN
succeed
:(
void
(
^
)(
FUSTicketShowCollectTicketToggleResultModel
*
model
))
succeed
failure
:(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
))
failure
;
/// Ticket Show - 功能 - 校验观众是否仍有购票观看资格
/// 接口:POST /ticketshow/verify/buy/has
/// 说明:观众端进房后延迟轮询,服务端返回下一次校验时间,-1 表示停止校验
/// @param roomId 房间ID
/// @param succeed 成功回调,返回下一次拉取时间(毫秒)
/// @param failure 失败回调,返回错误信息/错误码/下一次拉取时间(毫秒,-1 表示停止)
+
(
void
)
fus_ticketShowVerifyBuyHasWithRoomId
:(
NSString
*
)
roomId
succeed
:(
void
(
^
)(
NSInteger
nextTimes
))
succeed
failure
:(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
,
NSInteger
nextTimes
))
failure
;
/// Ticket Show - 功能 - 观众端购买票
/// 接口:POST /ticketshow/user/buy
/// @param roomId 房间ID
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.m
View file @
5e3d79f8
...
...
@@ -3311,6 +3311,29 @@
}];
}
+
(
void
)
fus_ticketShowVerifyBuyHasWithRoomId
:
(
NSString
*
)
roomId
succeed
:
(
void
(
^
)(
NSInteger
nextTimes
))
succeed
failure
:
(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
,
NSInteger
nextTimes
))
failure
{
NSString
*
uid
=
FUSCacheDataShare
.
shareStore
.
userDetailInfo
.
uid
;
if
([
NSString
isNull
:
uid
]
||
[
NSString
isNull
:
roomId
])
{
if
(
failure
)
failure
([
NSString
fus_localString
:
@"参数错误"
],
-
3
,
-
1
);
return
;
}
NSDictionary
*
params
=
@{
@"uid"
:
uid
,
@"roomId"
:
roomId
};
[
FUSHttpHelper
postRequestBinaryWithUrl
:
FUSShowRoomURLs
.
fus_URL_TicketShow_Verify_Buy_Has
params
:
params
success
:^
(
NSDictionary
*
_Nullable
dataDict
,
int
code
)
{
NSInteger
nextTimes
=
[[
dataDict
[
@"nexttimes"
]
description
]
integerValue
];
if
(
succeed
)
succeed
(
nextTimes
);
}
failure
:^
(
NSDictionary
*
_Nullable
dataDict
,
int
code
)
{
NSInteger
nextTimes
=
[[
dataDict
[
@"nexttimes"
]
description
]
integerValue
];
if
(
failure
)
failure
(
dataDict
[
@"msg"
],
code
,
nextTimes
);
}];
}
+
(
void
)
fus_ticketShowUserBuyWithRoomId
:
(
NSString
*
)
roomId
channelId
:
(
NSString
*
)
channelId
roundId
:
(
NSString
*
)
roundId
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.h
View file @
5e3d79f8
...
...
@@ -605,6 +605,9 @@ NS_ASSUME_NONNULL_BEGIN
/// Ticket Show - 视图 - 购票弹窗数据(观众端:购票入口弹窗展示前拉取)
+
(
NSString
*
)
fus_URL_TicketShow_Buy_GetData
;
/// Ticket Show - 功能 - 校验观众是否仍有购票观看资格
+
(
NSString
*
)
fus_URL_TicketShow_Verify_Buy_Has
;
/// Ticket Show - 功能 - 观众端购票(观众端:购票弹窗确认购买)
+
(
NSString
*
)
fus_URL_TicketShow_User_Buy
;
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.m
View file @
5e3d79f8
...
...
@@ -1000,6 +1000,12 @@
return
[
FUSConfig
.
sharedInstanced
.
pathConfigs
apiUrl
:
@"/ticketshow/buy/getdata"
];
}
/// Ticket Show - 功能 - 校验观众是否仍有购票观看资格
+
(
NSString
*
)
fus_URL_TicketShow_Verify_Buy_Has
{
return
[
FUSConfig
.
sharedInstanced
.
pathConfigs
apiUrl
:
@"/ticketshow/verify/buy/has"
];
}
/// Ticket Show - 功能 - 观众端购票(观众端:购票弹窗确认购买)
+
(
NSString
*
)
fus_URL_TicketShow_User_Buy
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment