Commit 7f1f2d50 by suolong

付费屋观众端最后完善接口

parent 44f547e2
Showing with 244 additions and 35 deletions
{
"images" : [
{
"filename" : "Live_bottom_showTime.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Live_bottom_showTime@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Live_bottom_showTime@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -76,6 +76,11 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -76,6 +76,11 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
/// 付费房试看剩余秒数(用于驱动按钮文案与自动结束) /// 付费房试看剩余秒数(用于驱动按钮文案与自动结束)
@property (nonatomic, assign) NSInteger payRoomPreviewCountdownSeconds; @property (nonatomic, assign) NSInteger payRoomPreviewCountdownSeconds;
@property (nonatomic, strong) dispatch_source_t payRoomRenewalCountdownTimer;
@property (nonatomic, assign) NSInteger payRoomRenewalCountdownSeconds;
@property (nonatomic, assign) BOOL isRequestingPayRoomRenewalViewing;
@property (nonatomic, copy) NSString *payRoomRenewalCountdownRoomId;
@end @end
@implementation FUSLiveHelper @implementation FUSLiveHelper
...@@ -1124,6 +1129,7 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1124,6 +1129,7 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self fus_stopPayRoomPreviewCountdown]; [self fus_stopPayRoomPreviewCountdown];
[self fus_stopPayRoomRenewalCountdown];
UIView *rootView = self.liveVC.view ?: [UIViewController fus_topViewController].view; UIView *rootView = self.liveVC.view ?: [UIViewController fus_topViewController].view;
for (UIView *subview in rootView.subviews.copy) { for (UIView *subview in rootView.subviews.copy) {
...@@ -1238,11 +1244,13 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1238,11 +1244,13 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
{ {
/// 仅观众端进房后需要提示陪伴进度 /// 仅观众端进房后需要提示陪伴进度
if (self.liveType != FUSLiveTypeAudience) { if (self.liveType != FUSLiveTypeAudience) {
[self fus_stopPayRoomRenewalCountdown];
return; return;
} }
/// 仅付费屋场景展示 /// 仅付费屋场景展示
if (self.roomScopeType != FUSLiveRoomScopeTypePay) { if (self.roomScopeType != FUSLiveRoomScopeTypePay) {
[self fus_stopPayRoomRenewalCountdown];
return; return;
} }
...@@ -1269,6 +1277,8 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1269,6 +1277,8 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
} }
weakSelf.payRoomCompanionDataModel = nil; weakSelf.payRoomCompanionDataModel = nil;
}; };
[self fus_startPayRoomRenewalCountdownWithRoomId:(roomId ?: @"")];
} }
/** /**
...@@ -1398,6 +1408,145 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1398,6 +1408,145 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
self.payRoomPreviewCountdownSeconds = 0; self.payRoomPreviewCountdownSeconds = 0;
} }
/// 获取当前展示中的“陪伴弹窗”(仅付费房场景存在,存在则用于进度与数据刷新)
- (FUSPayRoomCompanionPopView *)fus_currentPayRoomCompanionPopView
{
UIView *rootView = [self.currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerFunctionButtons];
UIView *view = [rootView viewWithTag:90917001];
if ([view isKindOfClass:FUSPayRoomCompanionPopView.class]) {
return (FUSPayRoomCompanionPopView *)view;
}
return nil;
}
/// 启动付费房 60 秒轮询计时器:每秒刷新进度条,归零时触发续看接口并重置下一轮
- (void)fus_startPayRoomRenewalCountdownWithRoomId:(NSString *)roomId
{
if ([NSString isNull:roomId]) {
return;
}
if (self.payRoomRenewalCountdownTimer && [self.payRoomRenewalCountdownRoomId isEqualToString:roomId]) {
return;
}
[self fus_stopPayRoomRenewalCountdown];
self.payRoomRenewalCountdownRoomId = roomId;
self.payRoomRenewalCountdownSeconds = 60;
FUSPayRoomCompanionPopView *popView = [self fus_currentPayRoomCompanionPopView];
if (popView) {
[popView fus_updateBillingCountdownWithRemainingSeconds:self.payRoomRenewalCountdownSeconds totalSeconds:60];
}
__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)NSEC_PER_SEC), (uint64_t)NSEC_PER_SEC, (uint64_t)(0.1 * NSEC_PER_SEC));
dispatch_source_set_event_handler(timer, ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
if (strongSelf.liveType != FUSLiveTypeAudience || strongSelf.roomScopeType != FUSLiveRoomScopeTypePay) {
[strongSelf fus_stopPayRoomRenewalCountdown];
return;
}
NSString *currentRoomId = [strongSelf.roomInfoModel.roomId description];
if ([NSString isNull:currentRoomId] || ![currentRoomId isEqualToString:strongSelf.payRoomRenewalCountdownRoomId]) {
[strongSelf fus_stopPayRoomRenewalCountdown];
return;
}
strongSelf.payRoomRenewalCountdownSeconds = MAX(0, strongSelf.payRoomRenewalCountdownSeconds - 1);
FUSPayRoomCompanionPopView *popView = [strongSelf fus_currentPayRoomCompanionPopView];
if (popView) {
[popView fus_updateBillingCountdownWithRemainingSeconds:strongSelf.payRoomRenewalCountdownSeconds totalSeconds:60];
}
if (strongSelf.payRoomRenewalCountdownSeconds <= 0) {
[strongSelf fus_requestPayRoomRenewalViewingWithRoomId:currentRoomId];
strongSelf.payRoomRenewalCountdownSeconds = 60;
if (popView) {
[popView fus_updateBillingCountdownWithRemainingSeconds:strongSelf.payRoomRenewalCountdownSeconds totalSeconds:60];
}
}
});
dispatch_resume(timer);
self.payRoomRenewalCountdownTimer = timer;
}
/// 停止并释放付费房轮询计时器(退房/切换非付费场景/销毁时调用,避免页面退出后继续回调)
- (void)fus_stopPayRoomRenewalCountdown
{
if (self.payRoomRenewalCountdownTimer) {
dispatch_source_cancel(self.payRoomRenewalCountdownTimer);
self.payRoomRenewalCountdownTimer = nil;
}
self.payRoomRenewalCountdownSeconds = 0;
self.payRoomRenewalCountdownRoomId = nil;
self.isRequestingPayRoomRenewalViewing = NO;
}
/// 请求续看接口:用于 60 秒归零后拉取最新 companionData 并刷新弹窗展示
- (void)fus_requestPayRoomRenewalViewingWithRoomId:(NSString *)roomId
{
if (self.isRequestingPayRoomRenewalViewing) {
return;
}
NSString *uid = [[FUSCacheDataShare shareStore].userVerifyInfo.uid description] ?: @"";
NSString *channelId = [self.roomInfoModel.channelId description] ?: @"";
NSString *roundId = [self.roomInfoModel.roundId description] ?: @"";
if ([NSString isNull:roundId]) {
roundId = @"";
}
if ([NSString isNull:uid] || [NSString isNull:roomId] || [NSString isNull:channelId]) {
return;
}
self.isRequestingPayRoomRenewalViewing = YES;
__weak typeof(self) weakSelf = self;
[FUSLiveHttpHelper fus_requestPayRoomRenewalViewingWithUid:uid RoomId:roomId channelId:channelId roundId:roundId succeed:^(NSDictionary *dataDict) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
strongSelf.isRequestingPayRoomRenewalViewing = NO;
NSString *currentRoomId = [strongSelf.roomInfoModel.roomId description];
if ([NSString isNull:currentRoomId] || ![currentRoomId isEqualToString:roomId]) {
return;
}
if (strongSelf.roomScopeType != FUSLiveRoomScopeTypePay || strongSelf.liveType != FUSLiveTypeAudience) {
return;
}
NSDictionary *companionData = [FUSHttpHelper fus_parseJSONDictionaryLayerByLayerWithObject:dataDict[@"companionData"]];
if ([NSDictionary isNull:companionData]) {
return;
}
FUSPayRoomCompanionDataModel *model = [FUSPayRoomCompanionDataModel fus_modelWithDict:companionData];
strongSelf.payRoomCompanionDataModel = model;
dispatch_async(dispatch_get_main_queue(), ^{
FUSPayRoomCompanionPopView *popView = [strongSelf fus_currentPayRoomCompanionPopView];
if (popView) {
[popView fus_updateWithCompanionData:model];
}
});
} failure:^(NSString *msg, NSInteger code) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
strongSelf.isRequestingPayRoomRenewalViewing = NO;
}];
}
/** /**
结束观看直播 结束观看直播
*/ */
...@@ -1688,6 +1837,7 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1688,6 +1837,7 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
*/ */
- (void)fus_leaveCurrentRoom - (void)fus_leaveCurrentRoom
{ {
[self fus_stopPayRoomRenewalCountdown];
// 调用接口离开直播间 // 调用接口离开直播间
[FUSLiveHttpHelper fus_exitRoomWithRoomId:_roomInfoModel.roomId livingType:@"0" vdoid:_streamModel.vdoid success:^(NSDictionary * _Nonnull dataDict) { [FUSLiveHttpHelper fus_exitRoomWithRoomId:_roomInfoModel.roomId livingType:@"0" vdoid:_streamModel.vdoid success:^(NSDictionary * _Nonnull dataDict) {
// [[FUSLiveHelper shareInstance].currentFunctionView.pkHelper fus_removeAllNotification]; // [[FUSLiveHelper shareInstance].currentFunctionView.pkHelper fus_removeAllNotification];
...@@ -2175,6 +2325,7 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -2175,6 +2325,7 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
销毁控制器 销毁控制器
*/ */
- (void)fus_destory { - (void)fus_destory {
[self fus_stopPayRoomRenewalCountdown];
[self fus_quitRoom]; [self fus_quitRoom];
self.liveType = FUSLiveTypeNone; self.liveType = FUSLiveTypeNone;
self.roomType = defaultRoom; self.roomType = defaultRoom;
......
...@@ -1100,6 +1100,19 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -1100,6 +1100,19 @@ NS_ASSUME_NONNULL_BEGIN
roundId:(NSString *)roundId roundId:(NSString *)roundId
succeed:(void (^)(NSDictionary *dataDict))succeed succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure; failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 功能-每分钟申请续费(用户端)
/// @param uid 用户ID(后端字段类型为 number,这里用 NSString 透传,避免整型精度/空值问题)
/// @param roomId 房间ID
/// @param channelId 直播频道ID
/// @param roundId 付费房回合ID
/// @param succeed 成功回调(原样回传服务端 dataDict)
/// @param failure 失败回调(回传 msg 与 code,是否弹框由调用方决定)
+(void)fus_requestPayRoomRenewalViewingWithUid:(NSString *)uid
RoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
/// 切换付费模式V2 /// 切换付费模式V2
/// @param uid 用户ID /// @param uid 用户ID
/// @param fid 主播ID /// @param fid 主播ID
......
...@@ -492,6 +492,7 @@ ...@@ -492,6 +492,7 @@
roomInfoModel.popularScore = [dataDict[@"popularScore"] integerValue]; roomInfoModel.popularScore = [dataDict[@"popularScore"] integerValue];
roomInfoModel.popularRank = [dataDict[@"popularRank"] integerValue]; roomInfoModel.popularRank = [dataDict[@"popularRank"] integerValue];
roomInfoModel.stateSwitch = [FUSLiveRoomStateSwitchModel fus_modelWithDict:dataDict[@"stateSwitch"]]; roomInfoModel.stateSwitch = [FUSLiveRoomStateSwitchModel fus_modelWithDict:dataDict[@"stateSwitch"]];
roomInfoModel.roundId = [dataDict[@"roundId"] description];
[FUSLiveHelper shareInstance].richValue = roomDict[@"rich"]; [FUSLiveHelper shareInstance].richValue = roomDict[@"rich"];
if (FUSConfig.sharedInstanced.devConfigs.enableTestCode) { if (FUSConfig.sharedInstanced.devConfigs.enableTestCode) {
...@@ -3056,6 +3057,30 @@ ...@@ -3056,6 +3057,30 @@
} }
}]; }];
} }
/// 功能-每分钟申请续费(用户端)
+(void)fus_requestPayRoomRenewalViewingWithUid:(NSString *)uid
RoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure
{
NSDictionary *parm = @{@"uid": uid ?: @"",
@"roomId": roomId ?: @"",
@"channelId": channelId ?: @"",
@"roundId": roundId ?: @""};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_livePayRoomRenewalViewing params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
if (succeed) {
succeed(dataDict);
}
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) {
failure(dataDict[@"msg"], code);
}
}];
}
/// 切换付费模式V2 /// 切换付费模式V2
/// @param uid 用户ID /// @param uid 用户ID
/// @param fid 主播ID /// @param fid 主播ID
......
...@@ -11,6 +11,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -11,6 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 是否时长充足(服务端语义:0 表示不足,需要引导充值;非 0 表示充足) /// 是否时长充足(服务端语义:0 表示不足,需要引导充值;非 0 表示充足)
@property (nonatomic, assign) NSInteger isEnough; @property (nonatomic, assign) NSInteger isEnough;
/// 陪伴单价(单位:宝石/分钟)
@property (nonatomic, assign) NSInteger payUnitPrice;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -19,6 +19,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -19,6 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 刷新展示内容(已陪伴/可继续陪伴/是否不足提示/进度条) /// 刷新展示内容(已陪伴/可继续陪伴/是否不足提示/进度条)
- (void)fus_updateWithCompanionData:(FUSPayRoomCompanionDataModel *)companionData; - (void)fus_updateWithCompanionData:(FUSPayRoomCompanionDataModel *)companionData;
/// 刷新“下次计费”进度(用于 60s 轮询续费时每秒更新进度条)
- (void)fus_updateBillingCountdownWithRemainingSeconds:(NSInteger)remainingSeconds totalSeconds:(NSInteger)totalSeconds;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
/// 收起/展开按钮(左/右箭头两张图切换) /// 收起/展开按钮(左/右箭头两张图切换)
@property (nonatomic, strong) UIButton *arrowBtn; @property (nonatomic, strong) UIButton *arrowBtn;
/// 时长不足提示(isEnough=0 显示)
@property (nonatomic, strong) UILabel *tipLabel;
/// 计费进度条(含 thumb 指示点) /// 计费进度条(含 thumb 指示点)
@property (nonatomic, strong) FUSPayRoomCompanionProgressView *progressView; @property (nonatomic, strong) FUSPayRoomCompanionProgressView *progressView;
/// “储值”按钮(isEnough=0 显示) /// “储值”按钮(isEnough=0 显示)
...@@ -73,7 +71,7 @@ ...@@ -73,7 +71,7 @@
} }
CGFloat viewW = 120; CGFloat viewW = 120;
CGFloat viewH = (companionData.isEnough == 0 ? 160 : 123); CGFloat viewH = (companionData.isEnough == 1 ? 160 : 123);
CGFloat viewX = 10; CGFloat viewX = 10;
CGFloat viewY = UIView.fus_SafeTop + 205; CGFloat viewY = UIView.fus_SafeTop + 205;
FUSPayRoomCompanionPopView *popView = [[FUSPayRoomCompanionPopView alloc] initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)]; FUSPayRoomCompanionPopView *popView = [[FUSPayRoomCompanionPopView alloc] initWithFrame:CGRectMake(viewX, viewY, viewW, viewH)];
...@@ -140,14 +138,6 @@ ...@@ -140,14 +138,6 @@
self.progressView = [[FUSPayRoomCompanionProgressView alloc] initWithFrame:CGRectMake(contentPadding, self.nextBillingLabel.bottom + 4, contentW, progressH)]; self.progressView = [[FUSPayRoomCompanionProgressView alloc] initWithFrame:CGRectMake(contentPadding, self.nextBillingLabel.bottom + 4, contentW, progressH)];
[self.contentView addSubview:self.progressView]; [self.contentView addSubview:self.progressView];
y = self.progressView.bottom + 6;
self.tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(contentPadding, y, contentW, 10)];
self.tipLabel.font = [UIFont fus_themeFont:8];
self.tipLabel.textColor = [UIColor colorWithRed:(255.0 / 255.0) green:(86.0 / 255.0) blue:(86.0 / 255.0) alpha:1.0];
self.tipLabel.text = [NSString fus_localString:@"时长不足,建议充值"];
self.tipLabel.hidden = YES;
[self.contentView addSubview:self.tipLabel];
self.dashLine2Layer = [CAShapeLayer layer]; self.dashLine2Layer = [CAShapeLayer layer];
self.dashLine2Layer.strokeColor = [UIColor colorWithWhite:1 alpha:0.22].CGColor; self.dashLine2Layer.strokeColor = [UIColor colorWithWhite:1 alpha:0.22].CGColor;
self.dashLine2Layer.fillColor = UIColor.clearColor.CGColor; self.dashLine2Layer.fillColor = UIColor.clearColor.CGColor;
...@@ -156,7 +146,7 @@ ...@@ -156,7 +146,7 @@
[self.contentView.layer addSublayer:self.dashLine2Layer]; [self.contentView.layer addSublayer:self.dashLine2Layer];
self.dashLine2Layer.path = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 0, 0)].CGPath; self.dashLine2Layer.path = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 0, 0)].CGPath;
y = self.tipLabel.bottom + 10; y = self.progressView.bottom + 12;
self.continueLabel = [[UILabel alloc] initWithFrame:CGRectMake(contentPadding, y, contentW, 12)]; self.continueLabel = [[UILabel alloc] initWithFrame:CGRectMake(contentPadding, y, contentW, 12)];
self.continueLabel.font = [UIFont fus_themeFont:8]; self.continueLabel.font = [UIFont fus_themeFont:8];
self.continueLabel.textColor = [UIColor colorWithWhite:1 alpha:0.9]; self.continueLabel.textColor = [UIColor colorWithWhite:1 alpha:0.9];
...@@ -215,15 +205,13 @@ ...@@ -215,15 +205,13 @@
self.lastCompanionData = companionData; self.lastCompanionData = companionData;
NSInteger companionTime = companionData.companionTime; NSInteger companionTime = companionData.companionTime;
NSInteger canCompanionTime = companionData.canCompanionTime; NSInteger canCompanionTime = companionData.canCompanionTime;
NSInteger totalTime = MAX(0, companionTime) + MAX(0, canCompanionTime);
self.companionLabel.text = [NSString stringWithFormat:[NSString fus_localString:@"已陪伴:%ld 分钟"], (long)MAX(0, companionTime)]; self.companionLabel.text = [NSString stringWithFormat:[NSString fus_localString:@"已陪伴:%ld 分钟"], (long)MAX(0, companionTime)];
self.continueLabel.text = [NSString stringWithFormat:[NSString fus_localString:@"您可继续陪伴 %ld 分钟"], (long)MAX(0, canCompanionTime)]; self.continueLabel.text = [NSString stringWithFormat:[NSString fus_localString:@"您可继续陪伴 %ld 分钟"], (long)MAX(0, canCompanionTime)];
self.tipLabel.hidden = (companionData.isEnough != 0); self.rechargeBtn.hidden = (companionData.isEnough != 1);
self.rechargeBtn.hidden = (companionData.isEnough != 0);
CGFloat targetHeight = (companionData.isEnough == 0 ? self.rechargeHeight : self.normalHeight); CGFloat targetHeight = (companionData.isEnough == 1 ? self.rechargeHeight : self.normalHeight);
self.originalHeight = targetHeight; self.originalHeight = targetHeight;
if (self.arrowBtn.isSelected == NO && CGAffineTransformIsIdentity(self.transform)) { if (self.arrowBtn.isSelected == NO && CGAffineTransformIsIdentity(self.transform)) {
self.height = targetHeight; self.height = targetHeight;
...@@ -232,7 +220,10 @@ ...@@ -232,7 +220,10 @@
self.coverBtn.frame = self.bounds; self.coverBtn.frame = self.bounds;
} }
NSInteger unitPrice = MAX(0, self.unitPricePerMinute); NSInteger unitPrice = MAX(0, companionData.payUnitPrice);
if (unitPrice <= 0) {
unitPrice = MAX(0, self.unitPricePerMinute);
}
NSString *priceText = [NSString stringWithFormat:@"%ld /%@", (long)unitPrice,[NSString fus_localString:@"分钟"]]; NSString *priceText = [NSString stringWithFormat:@"%ld /%@", (long)unitPrice,[NSString fus_localString:@"分钟"]];
NSMutableAttributedString *priceAttr = [[NSMutableAttributedString alloc] initWithString:priceText attributes:@{ NSMutableAttributedString *priceAttr = [[NSMutableAttributedString alloc] initWithString:priceText attributes:@{
NSFontAttributeName: self.priceLabel.font ?: [UIFont boldSystemFontOfSize:8], NSFontAttributeName: self.priceLabel.font ?: [UIFont boldSystemFontOfSize:8],
...@@ -246,18 +237,6 @@ ...@@ -246,18 +237,6 @@
} }
self.priceLabel.attributedText = priceAttr; self.priceLabel.attributedText = priceAttr;
CGFloat progress = 0;
NSInteger billingTime = MAX(0, self.billingTimeMinutes);
if (billingTime > 0) {
NSInteger usedInCycle = (NSInteger)(MAX(0, companionTime) % billingTime);
progress = (CGFloat)usedInCycle / (CGFloat)billingTime;
} else if (totalTime > 0) {
progress = (CGFloat)MAX(0, companionTime) / (CGFloat)totalTime;
} else {
progress = 0.7;
}
[self.progressView fus_setProgress:progress animated:YES];
CGFloat dashLeft = 16; CGFloat dashLeft = 16;
CGFloat dashRight = self.contentView.width - 16; CGFloat dashRight = self.contentView.width - 16;
CGFloat y1 = CGRectGetMaxY(self.companionLabel.frame) + 6; CGFloat y1 = CGRectGetMaxY(self.companionLabel.frame) + 6;
...@@ -273,6 +252,16 @@ ...@@ -273,6 +252,16 @@
self.dashLine2Layer.path = path2.CGPath; self.dashLine2Layer.path = path2.CGPath;
} }
/// 付费房续看轮询:将“剩余秒数”换算为 1~0 的进度值,用于每秒刷新进度条
- (void)fus_updateBillingCountdownWithRemainingSeconds:(NSInteger)remainingSeconds totalSeconds:(NSInteger)totalSeconds
{
NSInteger safeTotalSeconds = MAX(1, totalSeconds);
NSInteger safeRemainingSeconds = MIN(safeTotalSeconds, MAX(0, remainingSeconds));
CGFloat progress = (CGFloat)safeRemainingSeconds / (CGFloat)safeTotalSeconds;
[self.progressView fus_setProgress:progress animated:NO];
}
- (void)fus_clickArrowBtnAction:(UIButton *)sender { - (void)fus_clickArrowBtnAction:(UIButton *)sender {
self.userInteractionEnabled = NO; self.userInteractionEnabled = NO;
...@@ -281,7 +270,6 @@ ...@@ -281,7 +270,6 @@
self.companionLabel.hidden = YES; self.companionLabel.hidden = YES;
self.nextBillingLabel.hidden = YES; self.nextBillingLabel.hidden = YES;
self.tipLabel.hidden = YES;
self.continueLabel.hidden = YES; self.continueLabel.hidden = YES;
self.diamondIconView.hidden = YES; self.diamondIconView.hidden = YES;
self.priceLabel.hidden = YES; self.priceLabel.hidden = YES;
...@@ -346,11 +334,6 @@ ...@@ -346,11 +334,6 @@
if (self.rechargeHandler) { if (self.rechargeHandler) {
self.rechargeHandler(); self.rechargeHandler();
} }
[self fus_dismissView];
}
- (void)fus_dismissView {
[self removeFromSuperview];
} }
@end @end
...@@ -549,6 +549,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -549,6 +549,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)fus_URL_livePayRoomPreview; + (NSString *)fus_URL_livePayRoomPreview;
/// 功能-付费进入陪伴(用户端) /// 功能-付费进入陪伴(用户端)
+ (NSString *)fus_URL_livePayRoomPayViewing; + (NSString *)fus_URL_livePayRoomPayViewing;
/// 功能-每分钟申请续费(用户端)
+ (NSString *)fus_URL_livePayRoomRenewalViewing;
/// 获取首页自动跳转直播间 /// 获取首页自动跳转直播间
+ (NSString *)fus_URL_indexGetSuccessRecommendResult; + (NSString *)fus_URL_indexGetSuccessRecommendResult;
/// 切换付费模式V2 /// 切换付费模式V2
......
...@@ -903,6 +903,12 @@ ...@@ -903,6 +903,12 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/payRoom/payViewing"]; return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/payRoom/payViewing"];
} }
/// 功能-每分钟申请续费(用户端)
+ (NSString *)fus_URL_livePayRoomRenewalViewing
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/payRoom/renewalViewing"];
}
/// 切换付费模式V2 /// 切换付费模式V2
+ (NSString *)fus_URL_liveChangePay + (NSString *)fus_URL_liveChangePay
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment