Commit 931163fc by suolong

更新陪伴中和试看的userlist

parent 41ac5dbe
Showing with 802 additions and 83 deletions
...@@ -112,5 +112,83 @@ ...@@ -112,5 +112,83 @@
landmarkType = "7"> landmarkType = "7">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "4B4C9D12-5F36-4B96-BE77-C1250DFEBE1B"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/Push/LiveStartView/FUSLiveStartSetPrivacyView.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "355"
endingLineNumber = "355"
landmarkName = "FUSLiveStartSetPrivacyView"
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "B74BD247-B090-42F6-B87A-B0E8C990E91A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "741"
endingLineNumber = "741"
landmarkName = "-initPushPrepareView"
landmarkType = "7">
<Locations>
<Location
uuid = "B74BD247-B090-42F6-B87A-B0E8C990E91A - 1b41df9b0d1316b3"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__48-[FUSLiveMainViewController initPushPrepareView]_block_invoke_3"
moduleName = "FuSiLive"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Volumes/MovingDrive/fusi/Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "742"
endingLineNumber = "742">
</Location>
<Location
uuid = "B74BD247-B090-42F6-B87A-B0E8C990E91A - 1b41df9b0d1316fa"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__48-[FUSLiveMainViewController initPushPrepareView]_block_invoke_4"
moduleName = "FuSiLive"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Volumes/MovingDrive/fusi/Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Controller/FUSLiveMainViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "744"
endingLineNumber = "744">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "F4BE1479-4F1D-4880-9016-00D4F7B4CCA0"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/PayRoom/FUSPayRoomViewerListView.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "94"
endingLineNumber = "94"
landmarkName = "-fus_loadData"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>
...@@ -1780,6 +1780,10 @@ ...@@ -1780,6 +1780,10 @@
00F0A0132F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */; }; 00F0A0132F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */; };
00F0A0142F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */; }; 00F0A0142F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */; };
BEEAB2632D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2612D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift */; }; BEEAB2632D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2612D34CC60008CD059 /* FUSLiveStartSetPrivacyView.swift */; };
A1B2C3D4E5F60718293A4B6C /* FUSPayRoomViewerPopView.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B6A /* FUSPayRoomViewerPopView.h */; };
A1B2C3D4E5F60718293A4B6D /* FUSPayRoomViewerPopView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B6B /* FUSPayRoomViewerPopView.m */; };
A1B2C3D4E5F60718293A4B8B /* FUSPayRoomViewerListView.h in Headers */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B7C /* FUSPayRoomViewerListView.h */; };
A1B2C3D4E5F60718293A4B8D /* FUSPayRoomViewerListView.m in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B7D /* FUSPayRoomViewerListView.m */; };
BEEAB2642D34CC60008CD059 /* FUSLiveStartContentWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2602D34CC60008CD059 /* FUSLiveStartContentWarningView.swift */; }; BEEAB2642D34CC60008CD059 /* FUSLiveStartContentWarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2602D34CC60008CD059 /* FUSLiveStartContentWarningView.swift */; };
BEEAB2652D34CC60008CD059 /* FUSLiveStartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2622D34CC60008CD059 /* FUSLiveStartView.swift */; }; BEEAB2652D34CC60008CD059 /* FUSLiveStartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2622D34CC60008CD059 /* FUSLiveStartView.swift */; };
BEEAB2662D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2552D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift */; }; BEEAB2662D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEAB2552D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift */; };
...@@ -4136,6 +4140,10 @@ ...@@ -4136,6 +4140,10 @@
BEEAB2522D3380FA008CD059 /* FusAnchorRewardView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FusAnchorRewardView.m; sourceTree = "<group>"; }; BEEAB2522D3380FA008CD059 /* FusAnchorRewardView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FusAnchorRewardView.m; sourceTree = "<group>"; };
00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FusAnchorPayRoomView.h; sourceTree = "<group>"; }; 00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FusAnchorPayRoomView.h; sourceTree = "<group>"; };
00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FusAnchorPayRoomView.m; sourceTree = "<group>"; }; 00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FusAnchorPayRoomView.m; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B6A /* FUSPayRoomViewerPopView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSPayRoomViewerPopView.h; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B6B /* FUSPayRoomViewerPopView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSPayRoomViewerPopView.m; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B7C /* FUSPayRoomViewerListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSPayRoomViewerListView.h; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B7D /* FUSPayRoomViewerListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSPayRoomViewerListView.m; sourceTree = "<group>"; };
BEEAB2552D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautyFavoritesEditView.swift; sourceTree = "<group>"; }; BEEAB2552D34CC60008CD059 /* FUSLiveStartBeautyFavoritesEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautyFavoritesEditView.swift; sourceTree = "<group>"; };
BEEAB2562D34CC60008CD059 /* FUSLiveStartBeautyFavoritesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautyFavoritesView.swift; sourceTree = "<group>"; }; BEEAB2562D34CC60008CD059 /* FUSLiveStartBeautyFavoritesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautyFavoritesView.swift; sourceTree = "<group>"; };
BEEAB2572D34CC60008CD059 /* FUSLiveStartBeautySetItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautySetItemView.swift; sourceTree = "<group>"; }; BEEAB2572D34CC60008CD059 /* FUSLiveStartBeautySetItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartBeautySetItemView.swift; sourceTree = "<group>"; };
...@@ -7734,6 +7742,10 @@ ...@@ -7734,6 +7742,10 @@
children = ( children = (
00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */, 00F0A0112F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h */,
00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */, 00F0A0122F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m */,
A1B2C3D4E5F60718293A4B6A /* FUSPayRoomViewerPopView.h */,
A1B2C3D4E5F60718293A4B6B /* FUSPayRoomViewerPopView.m */,
A1B2C3D4E5F60718293A4B7C /* FUSPayRoomViewerListView.h */,
A1B2C3D4E5F60718293A4B7D /* FUSPayRoomViewerListView.m */,
); );
path = PayRoom; path = PayRoom;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -8764,6 +8776,8 @@ ...@@ -8764,6 +8776,8 @@
BED658DE2C5B745E00668116 /* FUSAudiencePopView.h in Headers */, BED658DE2C5B745E00668116 /* FUSAudiencePopView.h in Headers */,
BEEAB2532D3380FA008CD059 /* FusAnchorRewardView.h in Headers */, BEEAB2532D3380FA008CD059 /* FusAnchorRewardView.h in Headers */,
00F0A0132F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h in Headers */, 00F0A0132F5F0A1B00C0FFEE /* FusAnchorPayRoomView.h in Headers */,
A1B2C3D4E5F60718293A4B6C /* FUSPayRoomViewerPopView.h in Headers */,
A1B2C3D4E5F60718293A4B8B /* FUSPayRoomViewerListView.h in Headers */,
BED65A572C5B745F00668116 /* FUSLiveTreasureBoxRecordDetailView.h in Headers */, BED65A572C5B745F00668116 /* FUSLiveTreasureBoxRecordDetailView.h in Headers */,
BED658C02C5B745E00668116 /* FUSLiveHalfWebViewCatalogueView.h in Headers */, BED658C02C5B745E00668116 /* FUSLiveHalfWebViewCatalogueView.h in Headers */,
BED65A542C5B745F00668116 /* FUSLiveTreasureBoxListIconView.h in Headers */, BED65A542C5B745F00668116 /* FUSLiveTreasureBoxListIconView.h in Headers */,
...@@ -10703,6 +10717,8 @@ ...@@ -10703,6 +10717,8 @@
BED65A2E2C5B745F00668116 /* FUSLiveShareHttpHelper.m in Sources */, BED65A2E2C5B745F00668116 /* FUSLiveShareHttpHelper.m in Sources */,
BEEAB2542D3380FA008CD059 /* FusAnchorRewardView.m in Sources */, BEEAB2542D3380FA008CD059 /* FusAnchorRewardView.m in Sources */,
00F0A0142F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m in Sources */, 00F0A0142F5F0A1B00C0FFEE /* FusAnchorPayRoomView.m in Sources */,
A1B2C3D4E5F60718293A4B6D /* FUSPayRoomViewerPopView.m in Sources */,
A1B2C3D4E5F60718293A4B8D /* FUSPayRoomViewerListView.m in Sources */,
BED65ABF2C5B745F00668116 /* FUSHomeNovaListBroadcastHelper.m in Sources */, BED65ABF2C5B745F00668116 /* FUSHomeNovaListBroadcastHelper.m in Sources */,
BED6598C2C5B745E00668116 /* FUSLiveDewIncreaseView.m in Sources */, BED6598C2C5B745E00668116 /* FUSLiveDewIncreaseView.m in Sources */,
BE189DE22C733B460008418B /* FSRSettingOnlineViewController.m in Sources */, BE189DE22C733B460008418B /* FSRSettingOnlineViewController.m in Sources */,
...@@ -19,6 +19,7 @@ FOUNDATION_EXPORT const unsigned char FUSShowRoomModuleVersionString[]; ...@@ -19,6 +19,7 @@ FOUNDATION_EXPORT const unsigned char FUSShowRoomModuleVersionString[];
#import "FUSLiveHttpHelper.h" #import "FUSLiveHttpHelper.h"
#import "FUSShowRoomCenterBunble.h" #import "FUSShowRoomCenterBunble.h"
#import "FUSShowRoomURLs.h" #import "FUSShowRoomURLs.h"
#import "FUSPayRoomViewerPopView.h"
#import "FUSCheckInDayRewardModel.h" #import "FUSCheckInDayRewardModel.h"
#import "FUSCheckInRewardItemModel.h" #import "FUSCheckInRewardItemModel.h"
......
...@@ -938,12 +938,6 @@ typedef NS_ENUM(NSInteger, FUSStreamState) { ...@@ -938,12 +938,6 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
}]; }];
FUSSwiftLiveHelper.shared.roomInfoModel.channelId = [dict[@"channelId"] description];
if (![NSString isNull:roundId]) {
FUSSwiftLiveHelper.shared.roomInfoModel.roundId = roundId;
[FUSLiveHelper shareInstance].roomInfoModel.roundId = roundId;
}
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveUDKeys.fus_IS_JOIN_ROOM_SUCCESS object:@(YES)]; [[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveUDKeys.fus_IS_JOIN_ROOM_SUCCESS object:@(YES)];
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
@property (nonatomic, copy) NSString *isdisplay; // 是否显示(是否机器人)(0:否、1:是) @property (nonatomic, copy) NSString *isdisplay; // 是否显示(是否机器人)(0:否、1:是)
@property (nonatomic, copy) NSString *isHide; //是否是神秘人 @property (nonatomic, copy) NSString *isHide; //是否是神秘人
@property (nonatomic, copy) NSString *isVip; //是否是神秘人
@property (nonatomic, copy) NSString *realLevel; //真实的等级 @property (nonatomic, copy) NSString *realLevel; //真实的等级
@property (nonatomic, copy) NSString *realUid; //真实的uid @property (nonatomic, copy) NSString *realUid; //真实的uid
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
/// 是否付费(0:未付费、1:已付费) /// 是否付费(0:未付费、1:已付费)
@property (nonatomic, assign) BOOL inPay; @property (nonatomic, assign) BOOL inPay;
/// 拥有宝石(0:无、1:有) /// 拥有宝石(0:无、1:有)
@property (nonatomic, assign) BOOL haveGem; @property (nonatomic, assign) BOOL haveGem;
......
...@@ -10,6 +10,22 @@ ...@@ -10,6 +10,22 @@
@implementation FUSOnlineUserModel @implementation FUSOnlineUserModel
+ (NSDictionary *)modelCustomPropertyMapper {
return @{
@"nickname": @[@"nickname", @"nickeName"],
@"isHide": @[@"isHide", @"inHide"],
@"lev": @[@"lev", @"level"]
};
}
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
if (![self.privilege isKindOfClass:NSDictionary.class]) {
NSInteger richPower = self.isVip.integerValue > 0 ? 1 : 0;
self.privilege = @{@"richPower": @(richPower)};
}
return YES;
}
- (instancetype)init { - (instancetype)init {
self = [super init]; self = [super init];
if (self) { if (self) {
......
...@@ -1073,6 +1073,23 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -1073,6 +1073,23 @@ NS_ASSUME_NONNULL_BEGIN
cancel:(NSString *)cancel cancel:(NSString *)cancel
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
/// @param roomId 房间ID
/// @param channelId 直播频道ID
/// @param roundId 付费房回合ID
/// @param listType 表单类型0陪伴中列表 1试看中列表
/// @param page 页数
/// @param failure 0
+(void)fus_requestGetPayRoomUserLisWithUid:(NSString *)uid
RoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
listType:(NSString *)listType
page:(NSString *)page
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure;
@end @end
......
...@@ -2821,11 +2821,7 @@ ...@@ -2821,11 +2821,7 @@
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_Live_Before_GetLiveInfo params:@{} success:^(NSDictionary * _Nullable dataDict, int code) { [FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_Live_Before_GetLiveInfo params:@{} success:^(NSDictionary * _Nullable dataDict, int code) {
NSDictionary *liveGasStation = dataDict[@"liveGasStation"]; NSDictionary *liveGasStation = dataDict[@"liveGasStation"];
// roundId:付费房回合ID。用于“开播前/恢复直播”的场景同步当前回合,后续付费房数据请求会依赖该值进行准确匹配。
NSString *roundId = [dataDict[@"roundId"] description];
if (![NSString isNull:roundId] && FUSLiveHelper.shareInstance.roomInfoModel) {
FUSLiveHelper.shareInstance.roomInfoModel.roundId = roundId;
}
if (succeed) succeed(liveGasStation[@"publicizeConfig"], if (succeed) succeed(liveGasStation[@"publicizeConfig"],
liveGasStation[@"gasStationConfig"]); liveGasStation[@"gasStationConfig"]);
...@@ -3002,4 +2998,37 @@ ...@@ -3002,4 +2998,37 @@
if (failure) failure(dataDict[@"msg"],code); if (failure) failure(dataDict[@"msg"],code);
}]; }];
} }
/// 视图-获取用户列表:陪伴中、试看中
/// @param uid 用户ID
/// @param roomId 房间ID
/// @param channelId 直播频道ID
/// @param roundId 付费房回合ID
/// @param listType 表单类型0陪伴中列表 1试看中列表
/// @param page 页数
/// @param failure 0
+(void)fus_requestGetPayRoomUserLisWithUid:(NSString *)uid
RoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
listType:(NSString *)listType
page:(NSString *)page
succeed:(void (^)(NSDictionary *dataDict))succeed
failure:(void(^)(NSString *msg,NSInteger code))failure
{
NSDictionary *parm = @{@"uid": uid,
@"roomId":roomId,
@"channelId":channelId,
@"roundId":roundId,
@"listType":listType,
@"page":page};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_liveGetPayRoomUserList params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
if (succeed) {
succeed(dataDict);
}
}failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
@end @end
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSPayRoomViewerListView : UIView
@property (nonatomic, copy) void(^clickUserHandler)(NSDictionary *userDict);
@property (nonatomic, copy) void(^totalUserChangedHandler)(NSInteger total);
- (void)showUserListWithListType:(NSInteger)listType;
@end
NS_ASSUME_NONNULL_END
#import "FUSPayRoomViewerListView.h"
#import "FUSAudienceTableViewCell.h"
#import "FUSLiveHelper.h"
#import "FUSLiveHttpHelper.h"
@interface FUSPayRoomViewerListView () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) FUSEmptyView *emptyView;
@property (nonatomic, strong) NSMutableArray<FUSOnlineUserModel *> *userList;
@property (nonatomic, strong) NSMutableSet<NSString *> *userIdSet;
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, assign) NSInteger listType;
@end
@implementation FUSPayRoomViewerListView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStylePlain];
self.tableView.backgroundColor = [UIColor fus_appBGColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.rowHeight = 60;
self.tableView.tableFooterView = [[UIView alloc] init];
[self.tableView registerClass:[FUSAudienceTableViewCell class] forCellReuseIdentifier:[FUSAudienceTableViewCell cellIdentifer]];
[self addSubview:self.tableView];
self.userList = [NSMutableArray array];
self.userIdSet = [NSMutableSet set];
self.emptyView = [[FUSEmptyView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, 400)];
self.emptyView.contentAligment = FUSEmptyViewAligmentCenter;
[self.emptyView fus_setEmptyViewIcon:UIImage.fus_emptyImg title:[NSString fus_localString:@"暂无数据"] buttonTittle:nil];
self.emptyView.imageScale = 0.3;
self.emptyView.contentVerticalOffset = -20;
self.emptyView.backgroundColor = [UIColor clearColor];
__weak typeof(self) weakSelf = self;
self.tableView.mj_header = [FUSRefreshHeader headerWithRefreshingBlock:^{
[weakSelf fus_reloadData];
}];
self.tableView.mj_footer = [FUSRefreshAutoFooter footerWithRefreshingBlock:^{
[weakSelf fus_loadMoreData];
}];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
self.tableView.frame = self.bounds;
}
- (void)showUserListWithListType:(NSInteger)listType {
self.listType = MAX(0, MIN(1, listType));
[self fus_reloadData];
}
- (void)fus_reloadData {
self.page = 1;
[self fus_loadData];
}
- (void)fus_loadMoreData {
self.page++;
[self fus_loadData];
}
- (void)fus_loadData {
NSString *uid = [[FUSCacheDataShare shareStore].userVerifyInfo.uid description];
FUSRoomInfoModel *roomInfoModel = [FUSLiveHelper shareInstance].roomInfoModel;
NSString *roomId = [roomInfoModel.roomId description];
NSString *channelId = [roomInfoModel.channelId description];
NSString *roundId = [roomInfoModel.roundId description];
if ([NSString isNull:roundId]) {
roundId = @"";
}
if ([NSString isNull:uid] || [NSString isNull:roomId] || [NSString isNull:channelId]) {
[self.tableView.mj_header endRefreshing];
[self.tableView.mj_footer endRefreshing];
return;
}
__weak typeof(self) weakSelf = self;
[FUSLiveHttpHelper fus_requestGetPayRoomUserLisWithUid:uid RoomId:roomId channelId:channelId roundId:roundId listType:[NSString stringWithFormat:@"%zd", self.listType] page:[NSString stringWithFormat:@"%zd", self.page] succeed:^(NSDictionary *dataDict) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
NSDictionary *payload = [dataDict[@"data"] isKindOfClass:NSDictionary.class] ? dataDict[@"data"] : dataDict;
NSInteger respPage = [payload[@"page"] integerValue];
if (respPage > 0) {
strongSelf.page = respPage;
}
NSInteger total = [payload[@"total"] integerValue];
NSArray *list = [payload[@"list"] isKindOfClass:NSArray.class] ? payload[@"list"] : @[];
if (strongSelf.page <= 1) {
[strongSelf.userList removeAllObjects];
[strongSelf.userIdSet removeAllObjects];
}
NSMutableArray<FUSOnlineUserModel *> *newUsers = [NSMutableArray array];
for (NSDictionary *userDict in list) {
FUSOnlineUserModel *model = [FUSOnlineUserModel fus_modelWithDict:userDict];
if (model.uid.length <= 0) {
continue;
}
if ([strongSelf.userIdSet containsObject:model.uid]) {
continue;
}
[strongSelf.userIdSet addObject:model.uid];
[newUsers addObject:model];
}
[strongSelf.userList addObjectsFromArray:newUsers];
if (strongSelf.userList.count > 0) {
strongSelf.tableView.tableFooterView = [[UIView alloc] init];
} else {
strongSelf.tableView.tableFooterView = strongSelf.emptyView;
[strongSelf.tableView.mj_footer endRefreshingWithNoMoreData];
}
[strongSelf.tableView reloadData];
if (strongSelf.totalUserChangedHandler) {
strongSelf.totalUserChangedHandler(total > 0 ? total : strongSelf.userList.count);
}
[strongSelf.tableView.mj_header endRefreshing];
if (newUsers.count == 0) {
[strongSelf.tableView.mj_footer endRefreshingWithNoMoreData];
} else {
[strongSelf.tableView.mj_footer endRefreshing];
}
} failure:^(NSString *msg, NSInteger code) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf.tableView.mj_header endRefreshing];
[strongSelf.tableView.mj_footer endRefreshing];
if (![NSString isNull:msg]) {
[FUSDialogView fus_showDialog:msg];
}
}];
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.userList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FUSAudienceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[FUSAudienceTableViewCell cellIdentifer] forIndexPath:indexPath];
cell.userModel = self.userList[indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (self.clickUserHandler && indexPath.row < self.userList.count) {
self.clickUserHandler(self.userList[indexPath.row].fus_getDictionary);
}
}
@end
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface FUSPayRoomViewerPopView : UIView
@property (nonatomic, copy) void(^clickUserHandler)(NSDictionary *userDict);
+ (FUSPayRoomViewerPopView *)fus_showPayRoomViewerPopViewWithRootView:(UIView *)rootView;
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView;
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView startIndex:(NSInteger)startIndex;
- (void)fus_dismissView;
@end
NS_ASSUME_NONNULL_END
#import "FUSPayRoomViewerPopView.h"
#import "FUSSegmentControlView.h"
#import "FUSShowRoomCenterBunble.h"
#import "FUSPayRoomViewerListView.h"
@interface FUSPayRoomViewerPopView () <UIScrollViewDelegate>
@property (nonatomic, strong) UIButton *bgBtn;
@property (nonatomic, strong) UIView *contentView;
@property (nonatomic, strong) UIButton *closeBtn;
@property (nonatomic, strong) FUSSegmentControlView *segmentView;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) FUSPayRoomViewerListView *accompanyUserView;
@property (nonatomic, strong) FUSPayRoomViewerListView *trialUserView;
@property (nonatomic, assign) NSInteger startIndex;
@end
@implementation FUSPayRoomViewerPopView
+ (FUSPayRoomViewerPopView *)fus_showPayRoomViewerPopViewWithRootView:(UIView *)rootView {
return [self fus_showWithRootView:rootView];
}
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView {
return [self fus_showWithRootView:rootView startIndex:0];
}
+ (FUSPayRoomViewerPopView *)fus_showWithRootView:(UIView *)rootView startIndex:(NSInteger)startIndex {
if (!rootView) {
return nil;
}
for (UIView *subview in rootView.subviews) {
if ([subview isKindOfClass:[FUSPayRoomViewerPopView class]]) {
FUSPayRoomViewerPopView *existView = (FUSPayRoomViewerPopView *)subview;
[rootView bringSubviewToFront:existView];
NSInteger index = MAX(0, MIN(1, startIndex));
[existView.segmentView fus_setSelectedItem:index autoCallBack:YES];
[existView fus_showUserList];
return existView;
}
}
FUSPayRoomViewerPopView *popView = [[FUSPayRoomViewerPopView alloc] initWithFrame:UIView.fus_screenFrame];
popView.startIndex = MAX(0, MIN(1, startIndex));
[rootView addSubview:popView];
[popView.segmentView fus_setSelectedItem:popView.startIndex autoCallBack:YES];
[popView fus_showUserList];
return popView;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.bgBtn.frame = self.bounds;
[self.bgBtn addTarget:self action:@selector(fus_dismissView) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.bgBtn];
self.contentView = [[UIView alloc] initWithFrame:CGRectMake(0, UIView.fus_screenH, UIView.fus_screenW, 632)];
self.contentView.backgroundColor = UIColor.whiteColor;
[self.contentView addRoundedCorners:UIRectCornerTopLeft|UIRectCornerTopRight withRadii:CGSizeMake(16, 16)];
[self addSubview:self.contentView];
self.closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.closeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_board_close"] forState:UIControlStateNormal];
self.closeBtn.frame = CGRectMake(UIView.fus_screenW - 44, 0, 44, 44);
[self.closeBtn addTarget:self action:@selector(fus_dismissView) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.closeBtn];
self.segmentView = [[FUSSegmentControlView alloc] initWithFrame:CGRectMake(19, 0, UIView.fus_screenW - 70, 44) withItems:@[[NSString fus_localString:@"陪伴中"], [NSString fus_localString:@"试看中"]]];
self.segmentView.space = 27;
self.segmentView.alignment = FUSSegmentControlAlignmentLeft;
[self.segmentView fus_setUnderLineSelectedImage:UIImage.fus_segmentSelected];
[self.contentView addSubview:self.segmentView];
__weak typeof(self) weakSelf = self;
self.segmentView.selectItemBlock = ^(NSInteger index, NSString * _Nonnull itemText) {
weakSelf.scrollView.contentOffset = CGPointMake(index * weakSelf.scrollView.width, 0);
};
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.segmentView.bottom, self.width, self.contentView.height - self.segmentView.height)];
self.scrollView.contentSize = CGSizeMake(self.width * 2, self.scrollView.height);
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.pagingEnabled = YES;
self.scrollView.delegate = self;
[self.contentView addSubview:self.scrollView];
self.accompanyUserView = [[FUSPayRoomViewerListView alloc] initWithFrame:self.scrollView.bounds];
self.accompanyUserView.clickUserHandler = ^(NSDictionary * _Nonnull userDict) {
if (weakSelf.clickUserHandler) {
weakSelf.clickUserHandler(userDict);
}
[weakSelf fus_dismissView];
};
[self.scrollView addSubview:self.accompanyUserView];
self.trialUserView = [[FUSPayRoomViewerListView alloc] initWithFrame:self.scrollView.bounds];
self.trialUserView.x = self.scrollView.width;
self.trialUserView.clickUserHandler = ^(NSDictionary * _Nonnull userDict) {
if (weakSelf.clickUserHandler) {
weakSelf.clickUserHandler(userDict);
}
[weakSelf fus_dismissView];
};
[self.scrollView addSubview:self.trialUserView];
}
return self;
}
- (void)fus_showUserList {
__weak typeof(self) weakSelf = self;
self.accompanyUserView.totalUserChangedHandler = ^(NSInteger total) {
[weakSelf.segmentView fus_setImageForIndex:0 title:[NSString stringWithFormat:@"%@ %zd", [NSString fus_localString:@"陪伴中"], total]];
};
[self.accompanyUserView showUserListWithListType:0];
self.trialUserView.totalUserChangedHandler = ^(NSInteger total) {
[weakSelf.segmentView fus_setImageForIndex:1 title:[NSString stringWithFormat:@"%@ %zd", [NSString fus_localString:@"试看中"], total]];
};
[self.trialUserView showUserListWithListType:1];
[self.segmentView fus_setSelectedItem:self.startIndex autoCallBack:YES];
[UIView animateWithDuration:0.3 animations:^{
self.contentView.bottom = UIView.fus_screenH;
}];
}
- (void)fus_dismissView {
[UIView animateWithDuration:0.3 animations:^{
self.contentView.top = UIView.fus_screenH;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
NSInteger page = scrollView.contentOffset.x / scrollView.width;
[self.segmentView fus_setSelectedItem:page autoCallBack:NO];
}
@end
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#import "FUSLiveHelper.h" #import "FUSLiveHelper.h"
#import "FUSLiveHttpHelper.h" #import "FUSLiveHttpHelper.h"
#import "FUSPayRoomViewerPopView.h"
@interface FUSPayRoomPayViewingData : FUSBaseModel @interface FUSPayRoomPayViewingData : FUSBaseModel
@property (nonatomic, copy) NSString *payViewingNum; @property (nonatomic, copy) NSString *payViewingNum;
...@@ -69,6 +70,7 @@ ...@@ -69,6 +70,7 @@
@property (nonatomic, strong) UIView *statsBackgroundView; @property (nonatomic, strong) UIView *statsBackgroundView;
@property (nonatomic, strong) UIView *statsSeparatorView1; @property (nonatomic, strong) UIView *statsSeparatorView1;
@property (nonatomic, strong) UIView *statsSeparatorView2; @property (nonatomic, strong) UIView *statsSeparatorView2;
@property (nonatomic, strong) UIButton *statsTapButton;
@property (nonatomic, assign) BOOL didRequestPayRoomData; @property (nonatomic, assign) BOOL didRequestPayRoomData;
@property (nonatomic, assign) BOOL isRequestingPayRoomData; @property (nonatomic, assign) BOOL isRequestingPayRoomData;
...@@ -106,9 +108,9 @@ ...@@ -106,9 +108,9 @@
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveGiftChangeNotification:) name:STR(ROOM_CID_GIFT_CHANGE) object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveGiftChangeNotification:) name:STR(ROOM_CID_GIFT_CHANGE) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneEnterRoomNotification:) name:STR(ROOM_CID_SOMEBODY_JOIN) object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneEnterRoomNotification:) name:STR(ROOM_CID_SOMEBODY_JOIN) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneExitRoomNotification:) name:STR(ROOM_CID_EXIT) object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveSomeoneExitRoomNotification:) name:STR(ROOM_CID_EXIT) object:nil];
self.backgroundColor = UIColor.clearColor; self.backgroundColor = UIColor.clearColor;
self.clipsToBounds = NO; self.clipsToBounds = NO;
...@@ -169,6 +171,10 @@ ...@@ -169,6 +171,10 @@
[self.statsBackgroundView addSubview:label]; [self.statsBackgroundView addSubview:label];
} }
self.statsTapButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.statsTapButton addTarget:self action:@selector(fus_clickStatsAction:forEvent:) forControlEvents:UIControlEventTouchUpInside];
[self.statsBackgroundView addSubview:self.statsTapButton];
self.statsSeparatorView1 = [[UIView alloc] initWithFrame:CGRectMake(10, itemH, statsW - 20, 0.5)]; self.statsSeparatorView1 = [[UIView alloc] initWithFrame:CGRectMake(10, itemH, statsW - 20, 0.5)];
self.statsSeparatorView1.backgroundColor = [UIColor colorWithWhite:1 alpha:0.15]; self.statsSeparatorView1.backgroundColor = [UIColor colorWithWhite:1 alpha:0.15];
[self.statsBackgroundView addSubview:self.statsSeparatorView1]; [self.statsBackgroundView addSubview:self.statsSeparatorView1];
...@@ -230,6 +236,7 @@ ...@@ -230,6 +236,7 @@
self.accompanyLabel.frame = CGRectMake(9, 0, statsW - 9, itemH); self.accompanyLabel.frame = CGRectMake(9, 0, statsW - 9, itemH);
self.trialLabel.frame = CGRectMake(9, itemH, statsW - 9, itemH); self.trialLabel.frame = CGRectMake(9, itemH, statsW - 9, itemH);
self.incomeLabel.frame = CGRectMake(9, itemH * 2.0, statsW - 9, itemH); self.incomeLabel.frame = CGRectMake(9, itemH * 2.0, statsW - 9, itemH);
self.statsTapButton.frame = self.statsBackgroundView.bounds;
self.statsSeparatorView1.frame = CGRectMake(10, itemH, statsW - 20, 0.5); self.statsSeparatorView1.frame = CGRectMake(10, itemH, statsW - 20, 0.5);
self.statsSeparatorView2.frame = CGRectMake(10, itemH * 2.0, statsW - 20, 0.5); self.statsSeparatorView2.frame = CGRectMake(10, itemH * 2.0, statsW - 20, 0.5);
...@@ -239,6 +246,23 @@ ...@@ -239,6 +246,23 @@
self.coverBtn.frame = self.bounds; self.coverBtn.frame = self.bounds;
} }
- (void)fus_clickStatsAction:(UIButton *)sender forEvent:(UIEvent *)event {
UITouch *touch = event.allTouches.anyObject;
if (!touch) {
return;
}
CGPoint point = [touch locationInView:self.statsBackgroundView];
CGFloat itemH = self.statsBackgroundView.height / 3.0;
NSInteger startIndex = 0;
if (point.y >= itemH && point.y < itemH * 2.0) {
startIndex = 1;
}
UIView *rootView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
[FUSPayRoomViewerPopView fus_showWithRootView:rootView startIndex:startIndex];
}
- (void)fus_requestPayRoomDataIfNeeded { - (void)fus_requestPayRoomDataIfNeeded {
[self fus_requestPayRoomDataWithForce:NO]; [self fus_requestPayRoomDataWithForce:NO];
} }
...@@ -356,9 +380,6 @@ ...@@ -356,9 +380,6 @@
- (void)fus_refreshContentTexts { - (void)fus_refreshContentTexts {
NSString *accompanyValue = [self.payRoomDataModel.payViewingData.payViewingNum description]; NSString *accompanyValue = [self.payRoomDataModel.payViewingData.payViewingNum description];
if ([NSString isNull:accompanyValue]) { if ([NSString isNull:accompanyValue]) {
accompanyValue = [[FUSLiveHelper shareInstance].roomInfoModel.num description];
}
if ([NSString isNull:accompanyValue]) {
accompanyValue = @"0"; accompanyValue = @"0";
} }
...@@ -369,9 +390,6 @@ ...@@ -369,9 +390,6 @@
NSString *incomeValue = [self.payRoomDataModel.incomeData.income description]; NSString *incomeValue = [self.payRoomDataModel.incomeData.income description];
if ([NSString isNull:incomeValue]) { if ([NSString isNull:incomeValue]) {
incomeValue = [[FUSLiveHelper shareInstance].roomInfoModel.bonds description];
}
if ([NSString isNull:incomeValue]) {
incomeValue = @"0"; incomeValue = @"0";
} }
...@@ -380,34 +398,34 @@ ...@@ -380,34 +398,34 @@
self.incomeLabel.attributedText = [self fus_incomeLineWithValue:incomeValue]; self.incomeLabel.attributedText = [self fus_incomeLineWithValue:incomeValue];
} }
- (void)fus_recieveGiftChangeNotification:(NSNotification *)notification { //- (void)fus_recieveGiftChangeNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object; // FUSSocketMessageModel *messageModel = notification.object;
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) { // if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return; // return;
} // }
NSDictionary *dict = [messageModel fus_getJsonDict]; // NSDictionary *dict = [messageModel fus_getJsonDict];
NSString *bonds = [dict[@"bonds"] description]; // NSString *bonds = [dict[@"bonds"] description];
if (![NSString isNull:bonds]) { // if (![NSString isNull:bonds]) {
[FUSLiveHelper shareInstance].roomInfoModel.bonds = bonds; // [FUSLiveHelper shareInstance].roomInfoModel.bonds = bonds;
} // }
[self fus_refreshContentTexts]; // [self fus_refreshContentTexts];
} //}
- (void)fus_recieveSomeoneEnterRoomNotification:(NSNotification *)notification { //- (void)fus_recieveSomeoneEnterRoomNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object; // FUSSocketMessageModel *messageModel = notification.object;
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) { // if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return; // return;
} // }
[self fus_refreshContentTexts]; // [self fus_refreshContentTexts];
} //}
- (void)fus_recieveSomeoneExitRoomNotification:(NSNotification *)notification { //- (void)fus_recieveSomeoneExitRoomNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object; // FUSSocketMessageModel *messageModel = notification.object;
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) { // if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return; // return;
} // }
[self fus_refreshContentTexts]; // [self fus_refreshContentTexts];
} //}
- (void)fus_clickArrowBtnAction:(UIButton *)sender { - (void)fus_clickArrowBtnAction:(UIButton *)sender {
......
...@@ -69,6 +69,8 @@ import FUSCommon ...@@ -69,6 +69,8 @@ import FUSCommon
var itemViewList:[FUSLiveStartSetPrivacyItemView] = [] var itemViewList:[FUSLiveStartSetPrivacyItemView] = []
var clickHandler:((FUSLiveRoomScopeType) -> Void)? var clickHandler:((FUSLiveRoomScopeType) -> Void)?
private var isRequestingLiveBeforeReadyInfo = false
public override convenience init(frame: CGRect) { public override convenience init(frame: CGRect) {
self.init(frame: frame, requestType: 0) self.init(frame: frame, requestType: 0)
...@@ -130,9 +132,15 @@ import FUSCommon ...@@ -130,9 +132,15 @@ import FUSCommon
.fus_localString("已关闭窗帘,玩家输入密码打开"), .fus_localString("已关闭窗帘,玩家输入密码打开"),
.fus_localString("玩家需付费观看")] .fus_localString("玩家需付费观看")]
} else { } else {
iconImagesList = ["live_start_openScope_cell","live_start_passwordScope_cell"/*,"live_start_intimacyScope_cell"*/] iconImagesList = ["live_start_openScope_cell",
titlesList = [String.fus_localString("公开屋"), .fus_localString("私享屋")/*, .fus_localString("亲密圈")*/] "live_start_passwordScope_cell",
subTitlesList = [String.fus_localString("所有人可进入房间"), .fus_localString("已关闭窗帘,玩家输入密码打开")/*, .fus_localString("仅亲密好友可进入房间")*/] "live_start_payScope_cell"]
titlesList = [String.fus_localString("公开屋"),
.fus_localString("私享屋"),
.fus_localString("付费屋")]
subTitlesList = [String.fus_localString("所有人可进入房间"),
.fus_localString("已关闭窗帘,玩家输入密码打开"),
.fus_localString("玩家需付费观看")]
} }
let itemHeight = 56.0 let itemHeight = 56.0
...@@ -177,23 +185,26 @@ import FUSCommon ...@@ -177,23 +185,26 @@ import FUSCommon
self.fus_dismissWithAnimation() self.fus_dismissWithAnimation()
}else if self.requestType == 1 { }else if self.requestType == 1 {
if self.scopeType == .open { let currentScopeType = FUSLiveHelper.shareInstance().roomScopeType // 相同类型则无需请求
self.fus_changeScopeRequest(scopeType: self.scopeType, password: "") if currentScopeType == self.scopeType {
} else { self.fus_dismissWithAnimation()
return
UIView.animate(withDuration: 0.3) { }
self.contentView.y = UIView.fus_screenH()
} completion: { _ in if self.scopeType == .pay { // 切到“付费屋”
self.fus_changeToPayScopeRequest()
FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in return
}
guard let self = self else { return }
//在内部请求 if self.scopeType == .open { // 切到“公开屋”
if succeed { self.fus_changeToOpenScopeRequest()
self.fus_changeScopeRequest(scopeType: self.scopeType, password: password) return
} }
})
} UIView.animate(withDuration: 0.3) { // 切到“私享屋”
self.contentView.y = UIView.fus_screenH()
} completion: { _ in
self.fus_prepareToChangePasswordScope()
} }
} }
...@@ -221,20 +232,20 @@ import FUSCommon ...@@ -221,20 +232,20 @@ import FUSCommon
case 1: case 1:
self.scopeType = .password self.scopeType = .password
case 2: case 2:
if requestType == 0 { if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData { // 判断是否允许付费屋
if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData { if (payData.enable ?? "0").intValue != 1 {
if (payData.enable ?? "0").intValue != 1 { FUSAlertView.showAlert(withTitle: payData.warnTitle ?? "",
FUSAlertView.showAlert(withTitle: payData.warnTitle ?? "", message: payData.warnSubTitle ?? "",
message: payData.warnSubTitle ?? "", cancelButtonTitle: nil,
cancelButtonTitle: nil, otherButtonTitles: [String.fus_localString("知道了")])
otherButtonTitles: [String.fus_localString("知道了")]) break
break } else {
} else { self.scopeType = .pay
self.scopeType = .pay }
} } else { // 缺少配置时先拉取一次
self.fus_requestLiveBeforeReadyIfNeeded { [weak self] in
self?.fus_itemDidSelected(index: index)
} }
} else {
self.scopeType = .pay
} }
// case 2: // case 2:
// self.scopeType = .intimacy // self.scopeType = .intimacy
...@@ -262,7 +273,7 @@ import FUSCommon ...@@ -262,7 +273,7 @@ import FUSCommon
case .password: case .password:
return 1 return 1
case .pay: case .pay:
return requestType == 0 ? 2 : 0 return 2
// case .intimacy: // case .intimacy:
// return 2 // return 2
@unknown default: @unknown default:
...@@ -284,6 +295,13 @@ import FUSCommon ...@@ -284,6 +295,13 @@ import FUSCommon
} }
/// 设置/取消“私享屋”(密码房)
/// - 设计说明:
/// - scopeType == .password:调用 /live/change/password(0) 开启私享屋(设置密码)
/// - scopeType == .open:调用 /live/change/password(1) 取消私享屋(恢复公开)
/// - 注意:
/// - “付费屋 → 公开屋”不调用该接口(由 /live/change/pay(cancel=1) 撤销付费并回到公开)
/// - “付费屋 → 私享屋”需先撤销付费,再进入设置密码流程
private func fus_changeScopeRequest(scopeType: FUSLiveRoomScopeType, password:String) { private func fus_changeScopeRequest(scopeType: FUSLiveRoomScopeType, password:String) {
guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { return } guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { return }
...@@ -298,6 +316,7 @@ import FUSCommon ...@@ -298,6 +316,7 @@ import FUSCommon
// FUSIndicator.dismissProgress() // FUSIndicator.dismissProgress()
FUSLoadingIndicator.fus_dismiss() FUSLoadingIndicator.fus_dismiss()
FUSLiveHelper.shareInstance().roomScopeType = scopeType FUSLiveHelper.shareInstance().roomScopeType = scopeType
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
// switch scopeType{ // switch scopeType{
// case .open: // case .open:
//// FUSDialogView.fus_showDialog(.fus_localString("房间已切换到全公开模式,所有人可进入房间")) //// FUSDialogView.fus_showDialog(.fus_localString("房间已切换到全公开模式,所有人可进入房间"))
...@@ -314,6 +333,169 @@ import FUSCommon ...@@ -314,6 +333,169 @@ import FUSCommon
FUSDialogView.fus_showDialog(msg) FUSDialogView.fus_showDialog(msg)
}) })
} }
private func fus_requestLiveBeforeReadyIfNeeded(completion: @escaping () -> Void) {
if self.isRequestingLiveBeforeReadyInfo {
return
}
self.isRequestingLiveBeforeReadyInfo = true
FUSLiveHttpHelper.fus_requestLiveBeforeReady { [weak self] model in
self?.isRequestingLiveBeforeReadyInfo = false
if FUSLiveHelper.shareInstance().liveBeforeReadyInfo == nil {
FUSLiveHelper.shareInstance().liveBeforeReadyInfo = model
}
completion()
} failure: { [weak self] msg, code in
self?.isRequestingLiveBeforeReadyInfo = false
FUSDialogView.fus_showDialog(msg)
}
}
/// 切到“公开屋”的业务约定
/// - 若当前为“付费屋”,仅调用 /live/change/pay(cancel=1) 撤销付费;
/// 撤销成功后直接设置 .open 并刷新 UI,不调用 /live/change/password;
/// 同时清空 roundId(由撤销流程内部完成)
/// - 若当前非“付费屋”,走密码接口取消私享(如有)恢复公开
private func fus_changeToOpenScopeRequest() {
if FUSLiveHelper.shareInstance().roomScopeType == .pay {
self.fus_requestChangePay(cancel: true) { [weak self] succeed in
guard let self = self else { return }
if !succeed {
return
}
FUSLiveHelper.shareInstance().roomScopeType = .open
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
self.fus_dismissWithAnimation()
}
} else {
self.fus_changeScopeRequest(scopeType: .open, password: "")
}
}
private func fus_prepareToChangePasswordScope() {
if FUSLiveHelper.shareInstance().roomScopeType == .pay {
self.fus_requestChangePay(cancel: true) { [weak self] succeed in
guard let self = self else { return }
if !succeed {
UIView.animate(withDuration: 0.25) {
self.contentView.frame = CGRectMake(0, UIView.fus_screenH() - self.contentViewHeight, UIView.fus_screenW(), self.contentViewHeight)
}
return
}
self.fus_showPasswordSettingView()
}
} else {
self.fus_showPasswordSettingView()
}
}
private func fus_showPasswordSettingView() {
FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in
guard let self = self else { return }
if succeed {
self.fus_changeScopeRequest(scopeType: self.scopeType, password: password)
} else {
UIView.animate(withDuration: 0.25) {
self.contentView.frame = CGRectMake(0, UIView.fus_screenH() - self.contentViewHeight, UIView.fus_screenW(), self.contentViewHeight)
}
}
})
}
private func fus_changeToPayScopeRequest() {
if FUSLiveHelper.shareInstance().roomScopeType == .pay {
self.fus_dismissWithAnimation()
return
}
if FUSLiveHelper.shareInstance().roomScopeType == .password {
self.fus_requestCancelPassword { [weak self] succeed in
guard let self = self else { return }
if !succeed {
return
}
self.fus_requestChangePay(cancel: false, completion: nil)
}
} else {
self.fus_requestChangePay(cancel: false, completion: nil)
}
}
/// 取消“私享屋”(密码房)
/// - 用途:用于“私享屋 → 公开屋”或“私享屋 → 付费屋”前的取消操作
/// - 注意:“付费屋 → 公开屋”不调用该接口,由 /live/change/pay(cancel=1) 撤销付费
private func fus_requestCancelPassword(completion: @escaping (Bool) -> Void) {
guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else {
completion(false)
return
}
FUSLoadingIndicator.fus_show(canTouch: true)
FUSLiveHttpHelper.fus_requestChangedPassword(1, fid: roomID.intValue, password: "", success: {
FUSLoadingIndicator.fus_dismiss()
FUSLiveHelper.shareInstance().roomScopeType = .open
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
completion(true)
}, failure: { msg, code in
FUSLoadingIndicator.fus_dismiss()
FUSDialogView.fus_showDialog(msg)
completion(false)
})
}
/// 切换“付费屋”接口封装
/// - 参数:
/// - cancel: "0" 表示开启付费(切到付费屋);"1" 表示撤销付费(回到公开屋)
/// - 成功后:
/// - cancel == "0":同步 roundId(付费回合ID),设置 .pay 并刷新 UI
/// - cancel == "1":清空 roundId,设置 .open 并刷新 UI
/// - 注意:“付费屋 → 私享屋”需先撤销付费(cancel=1),再进入密码流程
private func fus_requestChangePay(cancel: Bool, completion: ((Bool) -> Void)?) {
guard let uid = FUSCacheDataShare.shareStore().userDetailInfo.uid,
let fid = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else {
completion?(false)
return
}
FUSLoadingIndicator.fus_show(canTouch: true)
FUSLiveHttpHelper.fus_requestLiveChangePay(withUid: uid, fid: fid, cancel: cancel ? "1" : "0", succeed: { [weak self] dataDict in
guard let self = self else { return }
FUSLoadingIndicator.fus_dismiss()
if cancel {
FUSLiveHelper.shareInstance().roomInfoModel?.roundId = ""
FUSSwiftLiveHelper.shared.roomInfoModel?.roundId = ""
FUSLiveHelper.shareInstance().roomScopeType = .open
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
completion?(true)
return
}
let payload = (dataDict as? [AnyHashable: Any])?["data"] as? [AnyHashable: Any] ?? (dataDict as? [AnyHashable: Any]) ?? [:]
let changePayData = payload["changePayData"] as? [AnyHashable: Any] ?? [:]
var roundId = ""
if let rawRoundId = changePayData["roundId"], !(rawRoundId is NSNull) {
roundId = String(describing: rawRoundId)
} else if let rawRoundId = payload["roundId"], !(rawRoundId is NSNull) {
roundId = String(describing: rawRoundId)
}
print(roundId)
FUSLiveHelper.shareInstance().roomInfoModel?.roundId = roundId
FUSSwiftLiveHelper.shared.roomInfoModel?.roundId = roundId
FUSLiveHelper.shareInstance().roomScopeType = .pay
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
self.fus_dismissWithAnimation()
completion?(true)
}, failure: { msg, code in
FUSLoadingIndicator.fus_dismiss()
FUSDialogView.fus_showDialog(msg)
completion?(false)
})
}
} }
......
...@@ -547,6 +547,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -547,6 +547,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)fus_URL_indexGetSuccessRecommendResult; + (NSString *)fus_URL_indexGetSuccessRecommendResult;
/// 切换付费模式V2 /// 切换付费模式V2
+ (NSString *)fus_URL_liveChangePay; + (NSString *)fus_URL_liveChangePay;
/// 视图-获取用户列表:陪伴中、试看中
+ (NSString *)fus_URL_liveGetPayRoomUserList;
@end @end
......
...@@ -892,7 +892,11 @@ ...@@ -892,7 +892,11 @@
{ {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/change/pay"]; return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/change/pay"];
} }
/// 视图-获取用户列表:陪伴中、试看中
+ (NSString *)fus_URL_liveGetPayRoomUserList
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/payRoom/getPayRoomUserList"];
}
@end @end
......
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