Compare commits

7 Commits
master ... dev

Author SHA1 Message Date
启星
604b2a3275 提交 2025-10-17 12:19:53 +08:00
启星
284ef1025a 提交 2025-10-17 11:41:09 +08:00
启星
2b477e8912 提交 2025-10-15 17:21:09 +08:00
启星
3ba569dfa3 提交 2025-10-13 15:06:59 +08:00
启星
d1be1ab3a7 Merge branch 'master' into dev 2025-10-13 14:32:43 +08:00
启星
de1d090b93 暂时提交 2025-10-13 14:16:49 +08:00
启星
0879779fb3 提交 2025-10-12 16:20:30 +08:00
98 changed files with 1694 additions and 348 deletions

View File

@@ -787,7 +787,7 @@
"$(inherited)",
"$(SDKROOT)/usr/lib/swift",
);
MARKETING_VERSION = 1.0.8;
MARKETING_VERSION = 1.0.10;
PRODUCT_BUNDLE_IDENTIFIER = com.xscm.midi;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -853,7 +853,7 @@
"$(inherited)",
"$(SDKROOT)/usr/lib/swift",
);
MARKETING_VERSION = 1.0.8;
MARKETING_VERSION = 1.0.10;
PRODUCT_BUNDLE_IDENTIFIER = com.xscm.midi;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -74,6 +74,13 @@
ReferencedContainer = "container:QXLive.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "DYLD_PRINT_LIBRARIES"
value = "YES"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -50,6 +50,13 @@
ReferencedContainer = "container:QXLive.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "DYLD_PRINT_LIBRARIES"
value = "YES"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@@ -208,54 +208,6 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "95816189-2F62-46D5-8996-37DB842006D9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "QXLive/Base/QXGlobal.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "237"
endingLineNumber = "237"
landmarkName = "-joinRoomWithRoomId:isRejoin:navagationController:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "77861036-E0D7-430E-A184-C587BCE81B20"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "QXLive/Base/QXGlobal.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "348"
endingLineNumber = "348"
landmarkName = "-vibrationFeedback"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "5BF5F01C-DE88-4830-9FC7-B13A8F8D8F06"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "QXLive/HomePage(&#x58f0;&#x64ad;)/Controlller/QXHomeViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "298"
endingLineNumber = "298"
landmarkName = "-popFirstRechargeView"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -266,28 +218,12 @@
filePath = "QXLive/HomePage(&#x58f0;&#x64ad;)/Controlller/QXHomeViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "265"
endingLineNumber = "265"
startingLineNumber = "272"
endingLineNumber = "272"
landmarkName = "-popNiceGiftView"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "17ADC5CF-3CFE-4059-B7EA-0CE3B4FA037A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "QXLive/HomePage(&#x58f0;&#x64ad;)/View/&#x623f;&#x95f4;/QXRoomBottomView.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "359"
endingLineNumber = "359"
landmarkName = "-didClickSendWithText:model:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -320,5 +256,37 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "EE5372A8-67EE-4ED3-ACC6-96AF55FD878F"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "QXLive/HomePage(&#x58f0;&#x64ad;)/View/&#x623f;&#x95f4;/QXRoomTitleView.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "349"
endingLineNumber = "349"
landmarkName = "-setRoomCollect:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "9043E93D-2910-4D2C-B503-E82326BA842B"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "QXLive/&#x6d3b;&#x52a8;/&#x5de1;&#x4e50;&#x4f1a;/QXMeetActivityView.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "852"
endingLineNumber = "852"
landmarkName = "-setModel:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@@ -20,6 +20,7 @@
#import "QXTimer.h"
#import <TIMPush/TIMPushManager.h>
#import "QXManagerMqtt.h"
#import "QXRedPacketManager.h"
@interface QXGlobal()
@property (nonatomic,assign)BOOL isLogin;
@@ -299,6 +300,8 @@
-(void)quitRoomWithRoomId:(NSString *)roomId{
[UIApplication sharedApplication].idleTimerDisabled = NO;
///
[[QXRedPacketManager sharedManager] destoryRedpacketInfo];
///
[[QXGiftPlayerManager shareManager] destroyEffectSvga];
/// 退
@@ -310,6 +313,7 @@
/// 退
[[QXRoomMessageManager shared] quitGroupWithRoomId:roomId];
[[QXGlobal shareGlobal].offLineDict removeAllObjects];
[[NSNotificationCenter defaultCenter] removeObserver:self];
if (_roomVC) {
///
[_roomVC.seatContentView destroyViews];

View File

@@ -10,6 +10,7 @@
@implementation QXDynamicTopicCell
-(void)setModel:(QXTopicModel *)model{
_model = model;
[self.topicImageView sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:nil];
self.titleLabel.text = model.title;
self.countLabel.text = [NSString localizedStringWithFormat:QXText(@"%@条动态"),[NSString qx_showHotCountNum:model.count.longLongValue]];

View File

@@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
-(void)didClickSendWithText:(NSString*)text model:(QXDynamicCommentListModel*)model;
-(void)didResignFirstResponder;
@end
@interface QXDynamicCommentInputView : UIView

View File

@@ -98,6 +98,11 @@
[textField resignFirstResponder];
return YES;
}
-(void)textFieldDidEndEditing:(UITextField *)textField{
if (self.delegate && [self.delegate respondsToSelector:@selector(didResignFirstResponder)]) {
[self.delegate didResignFirstResponder];
}
}
-(void)setModel:(QXDynamicCommentListModel *)model{
_model = model;
}

View File

@@ -10,6 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface QXHomeViewController : QXBaseViewController
-(void)popFirstRechargeView;
-(void)giftScrollViewShowWithModel:(QXGiftScrollModel*)model;
-(void)giftScrollViewShowWithModelList:(NSArray<QXGiftScrollModel*>*)list;
@end

View File

@@ -52,6 +52,8 @@
@property (nonatomic,strong)QXAppstoreHomeView *appStoreView;
@property (nonatomic,strong)SDCycleScrollView *rechargePermissionView;
@property (nonatomic,strong)NSMutableArray *rechargePermissionArray;
@property (nonatomic,strong)QXRechargePermissionModel *permissionModel;
@end
@implementation QXHomeViewController
@@ -60,6 +62,7 @@
[super viewDidLoad];
// Do any additional setup after loading the view.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(rechargeSuccess) name:noticeAlipayResult object:nil];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
@@ -133,7 +136,7 @@
// make.width.height.mas_equalTo(ScaleWidth(57));
// }];
[self getBanner];
// [self getRechargePermission];
[self getRechargePermission];
self.appStoreView.hidden = YES;
[self.view addSubview:self.appStoreView];
@@ -153,6 +156,9 @@
[self getTopRoomList];
[self getBanner];
}
-(void)rechargeSuccess{
[self getRechargePermission];
}
- (void)requestSlideToolData {
@weakify(self)
[QXHomePageNetwork homeRoomLabelListsuccessBlock:^(NSArray<QXMyRoomType *> * _Nonnull list) {
@@ -185,6 +191,7 @@
@weakify(self)
[QXHomePageNetwork getRechargePermissionSuccessBlock:^(QXRechargePermissionModel * _Nonnull model) {
@strongify(self)
self.permissionModel = model;
[self.rechargePermissionArray removeAllObjects];
NSMutableArray *imgs = [NSMutableArray array];
if (model.day_drop_permission.intValue == 1) {
@@ -233,7 +240,7 @@
}];
};
self.nPeopleRechargeView.rechargeActionBlock = ^(NSString * _Nonnull money) {
self.nPeopleRechargeView.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) {
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
QXLOG(@"页面关闭");
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
@@ -241,6 +248,7 @@
model.money = money;
recharge.selectedModel = model;
recharge.isPop = YES;
recharge.gift_bag_id = gift_bag_id;
recharge.isOnlyDisplayPayType = YES;
[recharge showInView:KEYWINDOW];
}];
@@ -260,9 +268,17 @@
}];
};
view.getActionBlock = ^{
view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) {
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
QXLOG(@"页面关闭");
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
QXRechargeListModel *model = [[QXRechargeListModel alloc] init];
model.money = money;
recharge.selectedModel = model;
recharge.isPop = YES;
recharge.gift_bag_id = gift_bag_id;
recharge.isOnlyDisplayPayType = YES;
[recharge showInView:KEYWINDOW];
}];
};
@@ -277,6 +293,9 @@
}];
}
-(void)popFirstRechargeView{
if (self.permissionModel.first_charge_permission.intValue != 1) {
return;
}
MJWeakSelf
QXFirstRechargeView *view = [[QXFirstRechargeView alloc] init];
view.closeActionBlock = ^{
@@ -285,9 +304,17 @@
}];
};
view.getActionBlock = ^{
view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) {
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
QXLOG(@"页面关闭");
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
QXRechargeListModel *model = [[QXRechargeListModel alloc] init];
model.money = money;
recharge.selectedModel = model;
recharge.isPop = YES;
recharge.gift_bag_id = gift_bag_id;
recharge.isOnlyDisplayPayType = YES;
[recharge showInView:KEYWINDOW];
}];
};

View File

@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface QXRedBagRecordCell : UITableViewCell
@property (nonatomic,strong)QXDrawRedpacketRecordModel *recordModel;
+(instancetype)cellWithTabelView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,6 +6,7 @@
//
#import "QXRedBagRecordViewController.h"
#import "QXMineNetwork.h"
@class QXRedBagRecordCell;
@interface QXRedBagRecordViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *topView;
@@ -18,6 +19,7 @@
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)QXDrawRedPacketModel *model;
@end
@implementation QXRedBagRecordViewController
@@ -40,10 +42,10 @@
self.senderNameLabel = [[UILabel alloc] init];
self.senderNameLabel.textColor = RGB16(0xffffff);
self.senderNameLabel.font = [UIFont systemFontOfSize:18];
self.senderNameLabel.text = @"傻狗涛的红包";
self.senderNameLabel.text = @"-";
[self.topView addSubview:self.senderNameLabel];
[self.senderNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView).offset(41);;
make.centerX.equalTo(self.topView).offset(41-13);;
make.top.equalTo(self.topView).offset(92);
}];
@@ -58,7 +60,7 @@
}];
self.remarkLabel = [[UILabel alloc] init];
self.remarkLabel.text = @"恭喜发财大吉大利";
self.remarkLabel.text = @"-";
self.remarkLabel.textColor = RGB16(0xffffff);
self.remarkLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.remarkLabel];
@@ -71,7 +73,7 @@
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = [UIFont boldSystemFontOfSize:19];
self.moneyLabel.textColor = RGB16(0xffffff);
self.moneyLabel.text = @"5000金币";
self.moneyLabel.text = @"0金币";
[self.topView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
@@ -80,7 +82,7 @@
self.bottomLabel = [[UILabel alloc] init];
self.bottomLabel.textColor = RGB16(0xffffff);
self.bottomLabel.text = @"已存入金币";
self.bottomLabel.text = @"已存入钱包";
self.bottomLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.bottomLabel];
[self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -126,14 +128,41 @@
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:backBtn];
}
-(void)setRedbagId:(NSString *)redbagId{
_redbagId = redbagId;
MJWeakSelf
[QXMineNetwork getRedpacketRecordWithRedpacketId:redbagId successBlock:^(QXDrawRedPacketModel* model) {
weakSelf.model = model;
weakSelf.remarkLabel.text = model.redpacket_info.remark;
[weakSelf.senderHeaderImageView sd_setImageWithURL:[NSURL URLWithString:model.redpacket_info.avatar]];
weakSelf.senderNameLabel.text = [NSString stringWithFormat:@"%@的红包",model.redpacket_info.nickname];
NSString *coinStr = @"";
if (weakSelf.model.redpacket_info.coin_type.intValue == 1) {
weakSelf.bottomLabel.text = @"已存入金币";
coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount?model.my_record.amount:@"0",@"金币"];
}else{
weakSelf.bottomLabel.text = @"已存入钻石";
coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount?model.my_record.amount:@"0",@"钻石"];
}
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:coinStr];
[attr yy_setFont:[UIFont boldSystemFontOfSize:46] range:[coinStr rangeOfString:[NSString stringWithFormat:@"%@",model.my_record.amount?model.my_record.amount:@"0"]]];
weakSelf.moneyLabel.attributedText = attr;
weakSelf.countLabel.text = [NSString stringWithFormat:@"已领取%ld/%@",model.redpacket_info.total_count.integerValue-model.redpacket_info.left_count.integerValue,model.redpacket_info.total_count];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
return self.model.records.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRedBagRecordCell *cell = [QXRedBagRecordCell cellWithTabelView:tableView];
cell.recordModel = self.model.records[indexPath.row];
return cell;
}
-(void)backAction{
@@ -172,6 +201,13 @@
}
return self;
}
-(void)setRecordModel:(QXDrawRedpacketRecordModel *)recordModel{
_recordModel = recordModel;
self.nameLabel.text = recordModel.nickname;
[self.userHeaderImageView sd_setImageWithURL:[NSURL URLWithString:recordModel.avatar]];
self.timeLabel.text = recordModel.createtime;
self.moneyLabel.text = recordModel.amount;
}
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
[self.contentView addSubview:self.bgView];

View File

@@ -0,0 +1,16 @@
//
// QXRoomViewController+Activity.h
// QXLive
//
// Created by 启星 on 2025/10/15.
//
#import "QXRoomViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController (Activity)
-(void)initActivityObeserver;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,36 @@
//
// QXRoomViewController+Activity.m
// QXLive
//
// Created by on 2025/10/15.
//
#import "QXRoomViewController+Activity.h"
#import "QXMeetActivityDriftView.h"
@implementation QXRoomViewController (Activity)
-(void)initActivityObeserver{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateProgress:) name:noticeXLHNotice object:nil];
}
-(void)updateProgress:(NSNotification *)notice{
QXMeetActivityDriftModel *model = notice.object;
if (model.from_type == QXMeetActivityTypeAcLock) {
[self.meetView updateUserAndGiftInfoWithModel:model];
self.acTagView.end_time = model.end_time.longLongValue;
return;
}
if (model.from_type == QXMeetActivityTypeAcProgress) {
[self.skyView updateProgress:model.xlh_data];
[self.ageView updateProgress:model.xlh_data];
[self.timeView updateProgress:model.xlh_data];
}
if (model.xlh_data.status.intValue == 1) {
self.acTagView.end_time = model.xlh_data.end_time;
[self.view addSubview:self.acTagView];
}else{
[self.acTagView stopTimer];
[self.acTagView removeFromSuperview];
}
}
@end

View File

@@ -115,7 +115,7 @@
}
-(void)meetActivityGiftInfoIsUpdate:(QXRoomChatListModel *)giftInfo{
[self.meetView updateUserAndGiftInfoWithModel:giftInfo];
self.acTagView.end_time = giftInfo.end_time.longLongValue;
// [self.meetView updateUserAndGiftInfoWithModel:giftInfo];
// self.acTagView.end_time = giftInfo.end_time.longLongValue;
}
@end

View File

@@ -0,0 +1,16 @@
//
// QXRoomViewController+RedPacket.h
// QXLive
//
// Created by 启星 on 2025/10/13.
//
#import "QXRoomViewController.h"
#import "QXRedPacketManager.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController (RedPacket)<QXRedPacketManagerDelegate>
-(void)initRedpacketManager;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,119 @@
//
// QXRoomViewController+RedPacket.m
// QXLive
//
// Created by on 2025/10/13.
//
#import "QXRoomViewController+RedPacket.h"
#import "QXMineNetwork.h"
@implementation QXRoomViewController (RedPacket)
-(void)recievedRedPacket:(QXRedPacketModel *)model{
self.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPacket:model];
}
-(void)redPacketDidFinished:(NSString *)redpacket_id{
[[QXRedPacketManager sharedManager] removeRedPacket:redpacket_id];
NSArray *arr = [QXRedPacketManager sharedManager].allRedPackets;
if (self.redbagListView) {
self.redbagListView.dataArray = arr;
}
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",arr.count];
}
-(void)initRedpacketManager{
[QXRedPacketManager sharedManager].delegate = self;
[[QXRedPacketManager sharedManager] startCheckTimer];
//
[self getRedBagList];
}
-(void)getRedBagList{
MJWeakSelf
[QXMineNetwork getRedpacketListWithRoomId:self.roomId successBlock:^(NSArray<QXRedPacketModel *> * _Nonnull list) {
if (list.count > 0) {
weakSelf.redBagTagView.count = [NSString stringWithFormat:@"%ld",list.count];
weakSelf.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPackets:list];
}else{
[[QXRedPacketManager sharedManager] removeAllRedpackets];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
#pragma mark - QXRedPacketManagerDelegate
///
-(void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
///
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
if (self.redbagDrawView.redpacketModel != nil && self.redbagDrawView.redpacketModel.countdown > 0) {
if (self.redbagDrawView.redpacketModel.type.intValue == 1) {
[self.redbagDrawView changeViewType:(QXRedBagDrawTypeOpen)];
}else{
if (self.redbagDrawView.isFromToComment) {
[self.redbagDrawView changeViewType:(QXRedBagDrawTypeOpen)];
}
}
}
}
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPackets:(NSArray<QXRedPacketModel *> *)redPackets remainingCount:(NSInteger)remainingCount{
self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacketTime:(long)time redPacket:(QXRedPacketModel *)redPacket {
///
if (self.redbagDrawView.redpacketModel != nil && self.redbagDrawView.redpacketModel.countdown > 0 && time>=0) {
if (self.redbagDrawView.redpacketModel.type.intValue == 1) {
//
if ([self.redbagDrawView.redpacketModel.conditions containsString:@"1"]) {
//
if (self.roomModel.user_info.is_collect.intValue == 1) {
///
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}else{
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}else{
if (self.redbagDrawView.isFromToComment) {
//
if ([self.redbagDrawView.redpacketModel.conditions containsString:@"1"]) {
//
if (self.roomModel.user_info.is_collect.intValue == 1) {
///
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}else{
if (redPacket == self.redbagDrawView.redpacketModel) {
self.redbagDrawView.needTime = time;
}
}
}
}
}
///
if (self.redbagListView.dataArray.count > 0) {
NSInteger index = [self.redbagListView.dataArray indexOfObject:redPacket];
[self.redbagListView updateRedpacketTimeWithIndex:index time:time];
}
}
@end

View File

@@ -20,6 +20,11 @@
#import "QXTimePraizeView.h"/// 时空之巅
#import "QXMeetActivityView.h"
#import "QXActivityTagView.h"
/// 红包
#import "QXRedBagTagView.h"
#import "QXRedBagDrawView.h"
#import "QXRedBagListView.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomViewController : QXBaseViewController<QXRoomMessageManagerDelegate,QXRoomSeatDelegate>
@@ -39,6 +44,11 @@ NS_ASSUME_NONNULL_BEGIN
/// 发送礼物
@property (nonatomic,strong)QXSendGiftView *sendGiftView;
/// 红包入口
@property (nonatomic,strong)QXRedBagTagView *redBagTagView;
@property (nonatomic,strong)QXRedBagDrawView *redbagDrawView;
@property (nonatomic,strong)QXRedBagListView *redbagListView;
@property (nonatomic,strong)QXActivityTagView *acTagView;
@property (nonatomic,strong)QXSkyPraizeView *skyView;

View File

@@ -31,9 +31,9 @@
#import "QXRoomViewController+Friend.h"
#import "QXAllRoomHourRankView.h"
#import "QXRedBagSendView.h"
#import "QXRedBagTagView.h"
#import "QXRedBagDrawView.h"
#import "QXRedBagListView.h"
#import "QXRoomViewController+RedPacket.h"
#import "QXRoomViewController+Activity.h"
#import "QXRedBagRecordViewController.h"
@interface QXRoomViewController ()<
QXRoomBottomViewDelegate,
@@ -81,10 +81,7 @@ QXRoomUserInfoViewDelegate
@property (nonatomic,strong)QXAllRoomHourRankView *hourRankView;
@property (nonatomic,strong)QXAllRoomHourRankTagView *hourRankIconView;
///
@property (nonatomic,strong)QXRedBagTagView *redBagTagView;
@property (nonatomic,strong)QXRedBagDrawView *redbagDrawView;
@property (nonatomic,strong)QXRedBagListView *redbagListView;
@end
@implementation QXRoomViewController
@@ -92,7 +89,7 @@ QXRoomUserInfoViewDelegate
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self initRedpacketManager];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
@@ -136,6 +133,7 @@ QXRoomUserInfoViewDelegate
-(void)initSubViews{
// [self updateBgImage:@"room_background"];
[self initActivityObeserver];
self.bgImageHidden = YES;
self.roomBgImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
// self.roomBgImageView.image = [UIImage imageNamed:@"room_background"];
@@ -211,7 +209,7 @@ QXRoomUserInfoViewDelegate
}
[self.view addSubview:self.hourRankIconView];
// [self.view addSubview:self.redBagTagView];
[self.view addSubview:self.redBagTagView];
[self setupEffectView];
// [self.view addSubview:self.headlineView];
@@ -1375,7 +1373,9 @@ QXRoomUserInfoViewDelegate
}
-(void)didSendMessage:(NSString *)message redpacketModel:(nonnull QXRedPacketModel *)redpacketModel{
if (redpacketModel) {
self.redbagDrawView.type = QXRedBagDrawTypeOpen;
// self.redbagDrawView.type = QXRedBagDrawTypeOpen;
self.redbagDrawView.isFromToComment = YES;
self.redbagDrawView.redpacketModel = redpacketModel;
[self.redbagDrawView showInView:self.view];
}
}
@@ -1495,6 +1495,7 @@ QXRoomUserInfoViewDelegate
break;
case QXRoomSettingTypeSendRedBag:{
QXRedBagSendView *redbagView = [[QXRedBagSendView alloc] init];
redbagView.room_id = self.roomId;
[redbagView showInView:self.view];
}
break;
@@ -1928,15 +1929,24 @@ QXRoomUserInfoViewDelegate
-(QXRedBagTagView *)redBagTagView{
if (!_redBagTagView) {
_redBagTagView = [[QXRedBagTagView alloc] init];
_redBagTagView.hidden = YES;
MJWeakSelf
_redBagTagView.startBlock = ^(BOOL isList) {
weakSelf.redbagListView.dataArray = @[@"",@"",@"",@"",@""];
[weakSelf.redbagListView showInView:weakSelf.view];
return;
if (isList) {
weakSelf.redbagListView.dataArray = [QXRedPacketManager sharedManager].allRedPackets;
[weakSelf.redbagListView showInView:weakSelf.view];
}else{
[weakSelf.redbagDrawView showInView:weakSelf.view];
QXRedPacketModel *model = [QXRedPacketManager sharedManager].allRedPackets.firstObject;
if (model.is_qiang.intValue == 1) {
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = model.redpacket_id;
[weakSelf.navigationController pushViewController:vc animated:YES];
}else{
weakSelf.redbagDrawView.isFromToComment = NO;
weakSelf.redbagDrawView.isCollectedRoom = weakSelf.roomModel.user_info.is_collect.intValue==1;
weakSelf.redbagDrawView.redpacketModel = model;
[weakSelf.redbagDrawView showInView:weakSelf.view];
}
}
};
}
@@ -1945,10 +1955,14 @@ QXRoomUserInfoViewDelegate
-(QXRedBagDrawView *)redbagDrawView{
if (!_redbagDrawView) {
_redbagDrawView = [[QXRedBagDrawView alloc] init];
_redbagDrawView.room_id = self.roomId;
MJWeakSelf
_redbagDrawView.toInputPwdBlock = ^(NSString * _Nonnull password, QXRedPacketModel * _Nonnull redpacketModel) {
[weakSelf.bottomView inputMessageWithName:password redpacketModel:redpacketModel];
};
_redbagDrawView.collectRoomBlock = ^{
[weakSelf.titleView setRoomCollect:YES];
};
}
return _redbagDrawView;
}
@@ -1956,10 +1970,17 @@ QXRoomUserInfoViewDelegate
if (!_redbagListView) {
_redbagListView = [[QXRedBagListView alloc] init];
MJWeakSelf
_redbagListView.didSelectedRedBlock = ^{
weakSelf.redbagDrawView.redpacketModel = [QXRedPacketModel new];
weakSelf.redbagDrawView.type = QXRedBagDrawTypePwdSend;
[weakSelf.redbagDrawView showInView:weakSelf.view];
_redbagListView.didSelectedRedBlock = ^(QXRedPacketModel * _Nonnull model) {
if (model.is_qiang.intValue == 1) {
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = model.redpacket_id;
[weakSelf.navigationController pushViewController:vc animated:YES];
}else{
weakSelf.redbagDrawView.isFromToComment = NO;
weakSelf.redbagDrawView.isCollectedRoom = weakSelf.roomModel.user_info.is_collect.intValue==1;
weakSelf.redbagDrawView.redpacketModel = model;
[weakSelf.redbagDrawView showInView:weakSelf.view];
}
};
}

View File

@@ -15,6 +15,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong)NSString *name;
/// 礼包名称
@property (nonatomic,strong)NSString *bag_name;
/// 礼包名称
@property (nonatomic,strong)NSString *gift_bag_id;
/// 1 可以充值 0 不可充值
@property (nonatomic,strong)NSString *status;
@property (nonatomic,strong)NSString *title1;
@@ -47,5 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong)NSString *time;
/// 礼物列表
@property (nonatomic,strong)NSArray <QXGiftModel*>*gift_list;
/// 礼包id
@property (nonatomic,strong)NSString *gift_bag_id;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,20 +8,77 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class QXDrawRedpacketRecordModel,QXRedpacketStatisticsModel;
@interface QXRedPacketModel : NSObject
@property (nonatomic, copy) NSString *packetId; // 红包唯一ID
@property (nonatomic, assign) NSInteger type; // 红包类型
@property (nonatomic, assign) long long end_time; // 倒计时时间(秒)
@property (nonatomic, assign) CGFloat amount; // 红包金额
@property (nonatomic, strong) NSDate *createTime; // 创建时间
@property (nonatomic, assign) BOOL isAvailable; // 是否可领取
@property (nonatomic, assign) NSInteger position; // 在房间中的位置标识
/// 红包唯一ID
@property (nonatomic, strong) NSString *redpacket_id;
/// 口令
@property (nonatomic, strong) NSString *password;
/// 倒计时 截止时间 为0时是立刻
@property (nonatomic, strong) NSString *countdown;
/// 红包总金额
@property (nonatomic, strong) NSString* total_amount;
/// 房间id
@property (nonatomic, strong) NSString* room_id;
/// 红包类型 1 普通红包 2 口令红包
@property (nonatomic, strong) NSString* type;
/// 红包总数
@property (nonatomic, strong) NSString *total_count;
/// 1 金币红包 2 钻石红包
@property (nonatomic, strong) NSString *coin_type;
/// 用户id
@property (nonatomic, strong) NSString *user_id;
/// 用户昵称
@property (nonatomic, strong) NSString *nickname;
/// 用户头像
@property (nonatomic, strong) NSString *avatar;
/// 红包多久后消失
@property (nonatomic, strong) NSString *redpacket_time;
/// 条件
@property (nonatomic, strong) NSString *conditions;
/// 红包备注
@property (nonatomic, strong) NSString *remark;
/// 红包可以开抢的时间 为时间戳
@property (nonatomic, assign) long start_time; // 倒计时时间(秒)
/// 剩余金额
@property (nonatomic, strong) NSString *left_amount;
/// 剩余数量
@property (nonatomic, strong) NSString *left_count;
/// 是否已经抢过该红包 1- 是 0-没有抢过
@property (nonatomic, strong) NSString *is_qiang;
// 计算剩余时间
/// 是否可领取
@property (nonatomic, assign) BOOL isAvailable;
/// 计算剩余时间
- (long)remainingTime;
// 检查是否可领取
/// 检查是否可领取
- (BOOL)canOpenNow;
@end
@interface QXDrawRedPacketModel : NSObject
@property (nonatomic,strong)QXRedPacketModel* redpacket_info;
@property (nonatomic,strong)QXDrawRedpacketRecordModel* my_record;
@property (nonatomic,strong)NSArray<QXDrawRedpacketRecordModel*>* records;
@end
@interface QXDrawRedpacketRecordModel : NSObject
/// 房间id
@property (nonatomic, strong) NSString* record_id;
/// 红包id
@property (nonatomic, strong) NSString* redpacket_id;
/// 用户id
@property (nonatomic, strong) NSString* user_id;
/// 头像
@property (nonatomic, strong) NSString* avatar;
/// 昵称
@property (nonatomic, strong) NSString* nickname;
/// 抢红包时间
@property (nonatomic, strong) NSString* createtime;
/// 金额
@property (nonatomic, strong) NSString* amount;
@end
NS_ASSUME_NONNULL_END

View File

@@ -13,7 +13,7 @@
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
//
long long milliseconds = (long long)(timeInterval);
needTime = self.end_time - milliseconds;
needTime = self.start_time - milliseconds;
return needTime;
}
@@ -21,3 +21,20 @@
return [self remainingTime] <= 0;
}
@end
@implementation QXDrawRedPacketModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"redpacket_info": @"QXRedPacketModel",
@"my_record": @"QXDrawRedpacketRecordModel",
@"records": @"QXDrawRedpacketRecordModel",
};
}
@end
@implementation QXDrawRedpacketRecordModel
@end

View File

@@ -23,5 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong)NSString *total_price;
@property (nonatomic,strong)NSString *label_icon;
@property (nonatomic,assign)NSInteger xlh_status;
/// 1有红包=0 没有红包
@property (nonatomic,assign)NSInteger redpacket_status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -32,6 +32,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,strong)UILabel *statusLabel;
@property (nonatomic,strong)UIImageView *redpacketImageView;
@property (nonatomic,assign)NSInteger rankNumber;
@property (nonatomic,strong)QXRoomHourRankSubModel *model;
@end

View File

@@ -246,7 +246,18 @@
make.width.height.mas_equalTo(12);
}];
self.redpacketImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"redbag_tag_icon"]];
[self.contentView addSubview:self.redpacketImageView];
[self.redpacketImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.right.mas_equalTo(-5);
make.centerY.equalTo(self.contentView);
make.width.mas_equalTo(60);
make.height.mas_equalTo(60);
}];
self.activityBgView = [[UIView alloc] init];
self.activityBgView.hidden = YES;
[self.contentView addSubview:self.activityBgView];
[self.activityBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.right.mas_equalTo(-5);
@@ -353,17 +364,22 @@
self.nameLabel.text = model.room_name;
[self.labelImageView sd_setImageWithURL:[NSURL URLWithString:model.label_icon]];
self.hotLabel.text = [NSString qx_showHotCountNum:model.total_price.longLongValue];
if (model.xlh_status == 0) {
self.activityBgView.hidden = YES;
}else if (model.xlh_status == 2){
self.activityBgView.hidden = NO;
self.activityStatusBgImageView.image = [UIImage imageNamed:@"activity_status_will"];
self.statusLabel.text = @"即将开始";
if (model.redpacket_status > 0) {
self.redpacketImageView.hidden = NO;
}else{
self.activityBgView.hidden = NO;
self.activityStatusBgImageView.image = [UIImage imageNamed:@"activity_status_ing"];
self.statusLabel.text = @"进行中";
self.redpacketImageView.hidden = YES;
}
// if (model.xlh_status == 0) {
// self.activityBgView.hidden = YES;
// }else if (model.xlh_status == 2){
// self.activityBgView.hidden = NO;
// self.activityStatusBgImageView.image = [UIImage imageNamed:@"activity_status_will"];
// self.statusLabel.text = @"即将开始";
// }else{
// self.activityBgView.hidden = NO;
// self.activityStatusBgImageView.image = [UIImage imageNamed:@"activity_status_ing"];
// self.statusLabel.text = @"进行中";
// }
}
@end

View File

@@ -350,7 +350,7 @@
}
-(void)inputMessageWithName:(NSString *)message redpacketModel:(QXRedPacketModel*)redpacketModel{
self.redpacketModel = redpacketModel;
self.commentView.textField.text = [NSString stringWithFormat:@"%@",message];
self.commentView.textField.text = [NSString stringWithFormat:@"#口令红包 %@",message];
[self.vc.view addSubview:self.commentView];
[self.commentView.textField becomeFirstResponder];
}
@@ -364,14 +364,18 @@
[[QXGlobal shareGlobal] finishTask];
[[QXRoomMessageManager shared] sendChatMessage:text messageType:(QXRoomMessageTypeText) needInsertMessage:YES];
self.commentView.textField.text = @"";
[self.vc.view endEditing:YES];
if (self.redpacketModel == nil) {
[self.vc.view endEditing:YES];
return;
}
if (self.delegate && [self.delegate respondsToSelector:@selector(didSendMessage:redpacketModel:)]) {
[self.delegate didSendMessage:text redpacketModel:self.redpacketModel];
NSString*password = [NSString stringWithFormat:@"#口令红包 %@",self.redpacketModel.password];
if ([text isEqualToString:password]) {
if (self.delegate && [self.delegate respondsToSelector:@selector(didSendMessage:redpacketModel:)]) {
[self.delegate didSendMessage:text redpacketModel:self.redpacketModel];
}
}
self.redpacketModel = nil;
[self.vc.view endEditing:YES];
}
- (void)keyboardWillHide:(NSNotification *)notification {
@@ -395,7 +399,9 @@
self.commentView.y = keyboardFrame.origin.y-TabbarContentHeight;
}];
}
-(void)didResignFirstResponder{
self.redpacketModel = nil;
}
-(QXDynamicCommentInputView *)commentView{
if (!_commentView) {
_commentView = [[QXDynamicCommentInputView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, TabbarContentHeight)];

View File

@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,weak)id<QXRoomSeatDelegate>delegate;
-(void)setRoomCollect:(BOOL)isCollect;
-(void)onlineNumberIsAdd:(BOOL)isAdd;
-(void)setOnlineNumber:(NSString*)onlineNumber;
@end

View File

@@ -344,10 +344,19 @@
self.rankView.roomId = self.roomId;
[self.rankView showInView:self.viewController.view];
}
-(void)setRoomCollect:(BOOL)isCollect{
self.roomModel.user_info.is_collect = isCollect?@"1":@"0";
self.followBtn.selected = isCollect?YES:NO;
}
-(void)followAction:(UIButton*)sender{
MJWeakSelf
[QXDynamicNetwork followWithUserId:self.roomId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
sender.selected = !sender.selected;
weakSelf.followBtn.selected = !weakSelf.followBtn.selected;
if (weakSelf.followBtn.selected) {
weakSelf.roomModel.user_info.is_collect = @"1";
}else{
weakSelf.roomModel.user_info.is_collect = @"0";
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];

View File

@@ -10,27 +10,31 @@
typedef NS_ENUM(NSInteger) {
/// 打开红包
QXRedBagDrawTypeOpen = 0,
/// 倒计时
/// 倒计时
QXRedBagDrawTypeTimeDown,
/// 收藏房间
/// 收藏房间
QXRedBagDrawTypeCollect,
/// 手慢了被领完了
QXRedBagDrawTypeFinished,
/// 口令红包发送评论
/// 发送评论领红包
QXRedBagDrawTypePwdSend,
/// 口令红包倒计时
QXRedBagDrawTypePwdTimeDown,
/// 口令红包收藏房间
QXRedBagDrawTypePwdCollect,
/// 需要完成两个任务
/// 需要完成两个收藏房间和倒计时
QXRedBagDrawTypePwdAllTask,
}QXRedBagDrawType;
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagDrawView : UIView
@property (nonatomic,strong)QXRedPacketModel *redpacketModel;
@property (nonatomic,assign)QXRedBagDrawType type;
@property (nonatomic,strong)NSString *room_id;
/// 是否已经收藏过房间
@property (nonatomic,assign)BOOL isCollectedRoom;
/// 倒计时
@property (nonatomic,assign)long needTime;
/// 是否是发送评论地方过来
@property (nonatomic,assign)BOOL isFromToComment;
@property (nonatomic,copy)void(^toInputPwdBlock)(NSString *password,QXRedPacketModel*redpacketModel);
@property (nonatomic,copy)void(^collectRoomBlock)(void);
-(void)changeViewType:(QXRedBagDrawType)type;
-(void)showInView:(UIView*)view;
-(void)hide;
@end

View File

@@ -7,10 +7,13 @@
#import "QXRedBagDrawView.h"
#import "QXRedBagRecordViewController.h"
#import "QXMineNetwork.h"
@class QXRedBagTimeDownView;
@interface QXRedBagDrawView()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UIImageView *pwdImageView;
@property (nonatomic,strong)UIImageView *userHeaderImageView;
@property (nonatomic,strong)UILabel *userNameLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@@ -29,6 +32,9 @@
@property (nonatomic,strong)UILabel *pwdTitleLable;
///
@property (nonatomic,strong)UILabel *bottomLabel;
@property (nonatomic,assign)QXRedBagDrawType drawType;
@property (nonatomic,assign)BOOL isDrawNet;
@end
@implementation QXRedBagDrawView
- (instancetype)init
@@ -42,6 +48,7 @@
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)];
[self addSubview:self.bgView];
@@ -49,6 +56,12 @@
self.bgImageView.image = [UIImage imageNamed:@"room_draw_redbag_bg"];
[self.bgView addSubview:self.bgImageView];
self.pwdImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_packet_pwd_icon"]];
self.pwdImageView.frame = CGRectMake(0, 0, 119, 41);
self.pwdImageView.hidden = YES;
[self.bgView addSubview:self.pwdImageView];
self.closeBtn = [[UIButton alloc] init];
[self.closeBtn setImage:[UIImage imageNamed:@"room_redbag_close"] forState:(UIControlStateNormal)];
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
@@ -122,13 +135,13 @@
@weakify(self)
self.timeDownView.btnBlcok = ^(QXRedBagDrawType type) {
@strongify(self);
if (type == QXRedBagDrawTypePwdCollect) {
if (type == QXRedBagDrawTypeCollect) {
///
[self setType:(QXRedBagDrawTypeOpen)];
[self collectRoom];
return;
}
if (self.toInputPwdBlock) {
self.toInputPwdBlock(@"傻狗涛来了,大家都让一让",self.redpacketModel);
self.toInputPwdBlock(self.redpacketModel.password,self.redpacketModel);
}
[self hide];
};
@@ -162,7 +175,7 @@
}];
self.drawTitleLabel = [[UILabel alloc] init];
self.drawTitleLabel.text = @"口令红包参与条件";
self.drawTitleLabel.text = @"红包参与条件";
self.drawTitleLabel.textColor = RGB16(0xffffff);
self.drawTitleLabel.textAlignment = NSTextAlignmentCenter;
self.drawTitleLabel.font = [UIFont systemFontOfSize:12];
@@ -197,6 +210,22 @@
make.centerX.equalTo(self.bgView);;
}];
}
-(void)collectRoom{
MJWeakSelf
[QXMineNetwork roomCollectWithType:@"1" room_id:self.room_id successBlock:^(NSDictionary * _Nonnull dict) {
if (weakSelf.collectRoomBlock) {
weakSelf.collectRoomBlock();
}
weakSelf.isCollectedRoom = YES;
if ([weakSelf.redpacketModel canOpenNow]) {
[weakSelf setType:(QXRedBagDrawTypeOpen)];
}else{
[weakSelf setType:QXRedBagDrawTypeTimeDown];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
/**
///
QXRedBagDrawTypeOpen = 0,
@@ -213,13 +242,68 @@
///
QXRedBagDrawTypePwdCollect,
*/
-(void)setIsCollectedRoom:(BOOL)isCollectedRoom{
_isCollectedRoom = isCollectedRoom;
}
-(void)setRedpacketModel:(QXRedPacketModel *)redpacketModel{
_redpacketModel = redpacketModel;
[self setType:[self getDrawTypeWithRedpacktModel:redpacketModel]];
self.remarkLabel.text = redpacketModel.remark;
[self.userHeaderImageView sd_setImageWithURL:[NSURL URLWithString:redpacketModel.avatar]];
self.userNameLabel.text = [NSString stringWithFormat:@"%@的红包",redpacketModel.nickname];
self.commentTitleLabel.text = [NSString stringWithFormat:@"发送评论:%@",redpacketModel.password];
if (redpacketModel.type.intValue == 2) {
self.pwdImageView.hidden = NO;
}else{
self.pwdImageView.hidden = YES;
}
if (self.drawType == QXRedBagDrawTypeOpen) {
self.pwdBgView.hidden = YES;
self.bottomLabel.hidden = YES;
}else{
self.pwdBgView.hidden = NO;
self.bottomLabel.hidden = NO;
if (redpacketModel.type.intValue == 2) {
self.commentTitleLabel.hidden = NO;
}else{
self.commentTitleLabel.hidden = YES;
}
if (redpacketModel.conditions.intValue == 0) {
self.pwdTitleLable.hidden = YES;
self.drawTitleLabel.hidden = YES;
}else{
self.pwdTitleLable.hidden = NO;
self.drawTitleLabel.hidden = NO;
if ([redpacketModel.conditions isEqualToString:@"1,2"]) {
self.pwdTitleLable.text = @"收藏房间,仅麦上用户";
}else if ([redpacketModel.conditions isEqualToString:@"1"]) {
self.pwdTitleLable.text = @"收藏房间";
}else if ([redpacketModel.conditions isEqualToString:@"1"]) {
self.pwdTitleLable.text = @"仅麦上用户";
}
}
}
}
-(void)setIsFromToComment:(BOOL)isFromToComment{
_isFromToComment = isFromToComment;
}
-(void)setNeedTime:(long)needTime{
_needTime = needTime;
NSInteger min = (needTime % 3600) / 60;
NSInteger second = needTime % 60;
self.timeDownView.timeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld后开启红包",min,(long)second];
}
-(void)changeViewType:(QXRedBagDrawType)type{
[self setType:type];
}
-(void)setType:(QXRedBagDrawType)type{
_type = type;
_drawType = type;
switch (type) {
case QXRedBagDrawTypeOpen:{
self.openBtn.hidden = NO;
self.remarkLabel.text = @"恭喜发财,大吉大利";
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.hidden = YES;
self.bottomLabel.hidden = YES;
@@ -237,53 +321,34 @@
break;
case QXRedBagDrawTypeCollect:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"恭喜发财,大吉大利";
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypeCollect;
self.timeDownView.hidden = NO;
self.bottomLabel.hidden = NO;
self.pwdBgView.hidden = YES;
[self performSelector:@selector(changeType) afterDelay:2];
self.pwdBgView.hidden = NO;
self.commentTitleLabel.hidden = YES;
self.pwdTitleLable.text= @"收藏房间";
}
break;
case QXRedBagDrawTypeTimeDown:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"恭喜发财,大吉大利";
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypeTimeDown;
self.timeDownView.hidden = NO;
self.bottomLabel.hidden = NO;
self.pwdBgView.hidden = YES;
[self performSelector:@selector(changeType) afterDelay:2];
}
break;
case QXRedBagDrawTypePwdSend:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"恭喜发财,大吉大利";
self.remarkLabel.text = self.redpacketModel.remark;
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypePwdSend;
self.timeDownView.hidden = NO;
self.pwdBgView.hidden = NO;
self.pwdTitleLable.hidden = YES;
}
break;
case QXRedBagDrawTypePwdTimeDown:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"恭喜发财,大吉大利";
self.recordBtn.hidden = YES;
self.timeDownView.type = QXRedBagDrawTypePwdTimeDown;
self.timeDownView.hidden = NO;
self.bottomLabel.hidden = NO;
self.pwdBgView.hidden = YES;
[self performSelector:@selector(changeType) afterDelay:2];
}
break;
case QXRedBagDrawTypePwdCollect:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"手慢了,红包被领完了";
self.recordBtn.hidden = NO;
}
break;
case QXRedBagDrawTypePwdAllTask:{
self.openBtn.hidden = YES;
self.remarkLabel.text = @"手慢了,红包被领完了";
@@ -294,49 +359,104 @@
break;
}
}
-(void)changeType{
[self setType:QXRedBagDrawTypeOpen];
}
#pragma mark - action
-(void)closeAction{
[self hide];
}
-(void)openAction{
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
//
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
//
rotationAnimation.duration = 0.5;
rotationAnimation.cumulative = YES;
rotationAnimation.removedOnCompletion = NO;
//MAXFLOAT
rotationAnimation.repeatCount = MAXFLOAT;
[self.openBtn.layer addAnimation:rotationAnimation forKey:@"openRedBagAnimate"];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.openBtn.layer removeAnimationForKey:@"openRedBagAnimate"];
BOOL isDrawed = NO;
if (isDrawed) {
MJWeakSelf
if (self.isDrawNet) {
return;
}
self.isDrawNet = YES;
[QXMineNetwork drawRedpacketWithRedpacketId:self.redpacketModel.redpacket_id successBlock:^(NSString * _Nonnull code) {
weakSelf.isDrawNet = NO;
weakSelf.redpacketModel.is_qiang = @"1";
if (code.intValue == 1) {
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = @"";
[self.viewController.navigationController pushViewController:vc animated:YES];
[self hide];
vc.redbagId = weakSelf.redpacketModel.redpacket_id;
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
[weakSelf hide];
}else if (code.intValue == 2){
showToast(@"您已抢过该红包");
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = weakSelf.redpacketModel.redpacket_id;
[weakSelf.viewController.navigationController pushViewController:vc animated:YES];
[weakSelf hide];
}else{
[self setType:QXRedBagDrawTypeFinished];
[weakSelf setType:QXRedBagDrawTypeFinished];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
weakSelf.isDrawNet = NO;
showToast(msg);
}];
// CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
// //
// rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI];
// //
// rotationAnimation.duration = 0.5;
// rotationAnimation.cumulative = YES;
// rotationAnimation.removedOnCompletion = NO;
// //MAXFLOAT
// rotationAnimation.repeatCount = MAXFLOAT;
// [self.openBtn.layer addAnimation:rotationAnimation forKey:@"openRedBagAnimate"];
//
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self.openBtn.layer removeAnimationForKey:@"openRedBagAnimate"];
//
// BOOL isDrawed = NO;
// if (isDrawed) {
// QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
// vc.redbagId = @"";
// [self.viewController.navigationController pushViewController:vc animated:YES];
// [self hide];
// }else{
// [self setType:QXRedBagDrawTypeFinished];
// }
//
// });
});
}
-(void)recordAction{
QXRedBagRecordViewController *vc = [[QXRedBagRecordViewController alloc] init];
vc.redbagId = @"";
vc.redbagId = self.redpacketModel.redpacket_id;
[self.viewController.navigationController pushViewController:vc animated:YES];
[self hide];
}
-(QXRedBagDrawType)getDrawTypeWithRedpacktModel:(QXRedPacketModel*)model{
self.drawType = QXRedBagDrawTypeOpen;
if (model.type.intValue == 1) {
//
self.drawType = QXRedBagDrawTypeOpen;
///
if (model.countdown.intValue > 0) {
if ([model remainingTime]>0) {
self.drawType = QXRedBagDrawTypeTimeDown;
}
}
///
if ([model.conditions containsString:@"1"] && !self.isCollectedRoom){
self.drawType = QXRedBagDrawTypeCollect;
}
}else{
//
self.drawType = QXRedBagDrawTypePwdSend;
if (self.isFromToComment) {
if ([model.conditions containsString:@"1"] && !self.isCollectedRoom){
self.drawType = QXRedBagDrawTypeCollect;
}else{
if ([self.redpacketModel canOpenNow]) {
[self setType:(QXRedBagDrawTypeOpen)];
}else{
[self setType:QXRedBagDrawTypeTimeDown];
}
}
}
}
return self.drawType;
}
-(void)showInView:(UIView *)view{
self.bgView.y = -SCREEN_HEIGHT;
[view addSubview:self];
@@ -348,6 +468,7 @@
}
-(void)hide{
self.redpacketModel = nil;
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
@@ -374,8 +495,7 @@
self.timeLabel.text = @"收藏房间抢红包";
}
break;
case QXRedBagDrawTypeTimeDown:
case QXRedBagDrawTypePwdTimeDown:{
case QXRedBagDrawTypeTimeDown:{
self.timeLabel.text = @"00:00后开启红包";
}
break;
@@ -383,11 +503,6 @@
self.timeLabel.text = @"发送评论抢红包";
}
break;
case QXRedBagDrawTypePwdCollect:{
self.timeLabel.text = @"收藏房间抢红包";
}
break;
case QXRedBagDrawTypePwdAllTask:{
self.timeLabel.text = @"完成任务抢红包";
}
@@ -398,7 +513,7 @@
}
-(void)btnClick{
if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypePwdCollect) {
if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypeCollect) {
if (self.btnBlcok) {
self.btnBlcok(self.type);
}

View File

@@ -10,14 +10,20 @@
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagListView : UIView
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSArray <QXRedPacketModel*>*dataArray;
@property (nonatomic,copy)void(^didSelectedRedBlock)(QXRedPacketModel*model);
-(void)showInView:(UIView *)view;
-(void)hide;
@property (nonatomic,copy)void(^didSelectedRedBlock)(void);
-(void)updateRedpacketTimeWithIndex:(NSInteger)index time:(long)time;
@end
@interface QXRedBagListCell : UICollectionViewCell
@property (nonatomic,strong)QXRedPacketModel* redpacketModel;
@property (nonatomic,strong)UIImageView *redBagImageView;
@property (nonatomic,strong)UIImageView *pwdImageView;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,assign)long endTime;
@end
NS_ASSUME_NONNULL_END

View File

@@ -28,6 +28,7 @@
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bigBgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-375)/2, (SCREEN_HEIGHT-480)/2, 375, 480)];
[self addSubview:self.bigBgView];
@@ -40,7 +41,7 @@
[self.bigBgView addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(280);
make.height.mas_equalTo(252);
make.height.mas_equalTo(272);
make.centerX.equalTo(self.bigBgView);
make.top.mas_equalTo(60);
}];
@@ -72,7 +73,7 @@
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(66,66);
layout.itemSize = CGSizeMake(66,86);
layout.minimumLineSpacing =20;
layout.minimumInteritemSpacing =16;
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
@@ -92,15 +93,19 @@
make.top.mas_equalTo(156);
}];
}
-(void)setDataArray:(NSMutableArray *)dataArray{
-(void)updateRedpacketTimeWithIndex:(NSInteger)index time:(long)time{
QXRedBagListCell *cell = [self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
cell.endTime = time;
}
-(void)setDataArray:(NSArray<QXRedPacketModel *> *)dataArray{
_dataArray = dataArray;
if (dataArray.count >3) {
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(338);
make.height.mas_equalTo(358);
}];
}else{
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(252);
make.height.mas_equalTo(272);
}];
}
[self.collectionView reloadData];
@@ -110,11 +115,13 @@
}
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXRedBagListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRedBagListCell" forIndexPath:indexPath];
cell.redpacketModel = self.dataArray[indexPath.row];
return cell;
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
QXRedPacketModel *model = self.dataArray[indexPath.row];
if (self.didSelectedRedBlock) {
self.didSelectedRedBlock();
self.didSelectedRedBlock(model);
}
[self hide];
}
@@ -152,12 +159,69 @@
}
return self;
}
-(void)setRedpacketModel:(QXRedPacketModel *)redpacketModel{
_redpacketModel = redpacketModel;
self.redBagImageView.image = [UIImage imageNamed:redpacketModel.is_qiang.intValue==1?@"red_bag_list_is_get_icon":@"red_bag_list_icon"];
self.pwdImageView.hidden = redpacketModel.type.intValue!=2;
self.nameLabel.text = redpacketModel.nickname;
if (self.redpacketModel.countdown.intValue==0) {
self.timeLabel.hidden = YES;
}
}
-(void)setEndTime:(long)endTime{
if (self.redpacketModel.countdown.intValue==0) {
self.timeLabel.hidden = YES;
return;
}
if (endTime<=0) {
self.timeLabel.hidden = YES;
return;
}
self.timeLabel.hidden = NO;
NSInteger min = (endTime % 3600) / 60;
NSInteger second = endTime % 60;
self.timeLabel.text = [NSString stringWithFormat:@" %02ld:%02ld ",min,second];
}
-(void)initSubviews{
self.redBagImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_icon"]];
[self.contentView addSubview:self.redBagImageView];
[self.redBagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
make.top.mas_equalTo(4);
make.height.mas_equalTo(66);
make.width.mas_equalTo(66);
make.centerX.equalTo(self.contentView);
}];
self.pwdImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_bag_list_pwd_icon"]];
[self.contentView addSubview:self.pwdImageView];
[self.pwdImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self.contentView);
make.width.mas_equalTo(34);
make.height.mas_equalTo(18);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0xffffff);
[self.timeLabel addRoundedCornersWithRadius:6];
self.timeLabel.hidden = YES;
self.timeLabel.backgroundColor = RGB16A(0x000000, 0.25);
self.timeLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.redBagImageView);
make.centerX.equalTo(self.contentView);
make.height.mas_equalTo(12);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xD04248);
self.nameLabel.font = [UIFont systemFontOfSize:12];
[self.contentView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.centerX.equalTo(self.contentView);
make.height.mas_equalTo(12);
}];
}

View File

@@ -10,6 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagSendView : UIView
@property (nonatomic,strong)NSString *room_id;
-(void)showInView:(UIView*)view;
-(void)hide;
@end

View File

@@ -7,6 +7,7 @@
#import "QXRedBagSendView.h"
#import <WebKit/WebKit.h>
#import "QXMineNetwork.h"
@interface QXRedBagSendView()<UITextFieldDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *bgImageView;
@@ -36,7 +37,10 @@
@property (nonatomic,strong)NSString *redBagContentType;
///
@property (nonatomic,strong)NSString *redBagTime;
/// 0 1 2 ,
@property (nonatomic,strong)NSString *conditions;
@property (nonatomic,strong)NSString *coin;
@property (nonatomic,strong)NSString *earnings;
@property (nonatomic,strong)UIView* nextContentView;
@@ -67,6 +71,7 @@
///
@property (nonatomic,assign)BOOL isFromRule;
@property (nonatomic,assign)BOOL isSendNet;
@end
@implementation QXRedBagSendView
@@ -82,11 +87,16 @@
}
-(void)initSubviews{
///
self.redBagType = @"1";
///
self.redBagContentType = @"1";
///
self.redBagTime = @"0";
///
self.conditions = @"0";
self.timeArray = @[@0,@1,@2,@5,@10];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)];
[self addSubview:self.bgView];
@@ -165,8 +175,20 @@
[self initNextContentView];
[self initRuleView];
[self getMyWallet];
}
-(void)getMyWallet{
MJWeakSelf
[QXMineNetwork getWalletInfoSuccessBlock:^(NSString * _Nonnull coin, NSString * _Nonnull earnings, NSString * _Nonnull title, NSString * _Nonnull url) {
weakSelf.coin = coin;
weakSelf.earnings = coin;
weakSelf.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)initFirstContentView{
self.firstContentView = [[UIView alloc] init];
@@ -477,6 +499,7 @@
pwdTextField.textColor = RGB16(0x666666);
pwdTextField.textAlignment = NSTextAlignmentRight;
pwdTextField.returnKeyType = UIReturnKeyDone;
pwdTextField.keyboardType = UIKeyboardTypeNumberPad;
pwdTextField.placeholder = @"请输入红包金额";
self.moneyTextField = pwdTextField;
[topBgView addSubview:pwdTextField];
@@ -531,6 +554,7 @@
countTextField.textAlignment = NSTextAlignmentRight;
countTextField.returnKeyType = UIReturnKeyDone;
countTextField.placeholder = @"请输入红包数量";
countTextField.keyboardType = UIKeyboardTypeNumberPad;
self.countTextField = countTextField;
[countBgView addSubview:countTextField];
[countTextField mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -680,6 +704,12 @@
#pragma mark - action
-(void)nextAction{
if (self.redBagType.intValue == 2) {
if (![self.pwdTextField.text isExist]) {
showToast(@"请输入口令");
return;
}
}
self.currentPage = 1;
if (self.redBagContentType.intValue == 1) {
self.moneyUnitLabel.text = @"金币";
@@ -703,7 +733,39 @@
}];
}
-(void)commitAction{
if (![self.moneyTextField.text isExist]) {
showToast(@"请输入红包金额");
return;
}
if (![self.countTextField.text isExist]) {
showToast(@"请输入红包数量");
return;
}
if (self.countTextField.text.longLongValue > self.moneyTextField.text.longLongValue) {
showToast(@"红包数量不能大于红包金额");
return;
}
if (self.isSendNet) {
return;
}
self.isSendNet = YES;
[QXMineNetwork createRedpacketWithType:self.redBagType
password:self.pwdTextField.text
coin_type:self.redBagContentType
total_amount:self.moneyTextField.text
total_count:self.countTextField.text
conditions:self.conditions
countdown:self.redBagTime
room_id:self.room_id
remark:self.remarkTextField.text
successBlock:^(NSDictionary * _Nonnull dict) {
self.isSendNet = NO;
showToast(@"发送成功");
[self hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
self.isSendNet = NO;
showToast(msg);
}];
}
-(void)helpAction{
@@ -761,6 +823,7 @@
make.top.equalTo(self.firstTopView.mas_bottom).offset(12);
}];
self.redBagType = @"1";
self.pwdTextField.text = @"";
}else{
self.pwdRedBagBtn.selected = YES;
self.normalRedBagBtn.selected = NO;
@@ -784,6 +847,7 @@
}];
self.coinRedBagBtn.selected = YES;
self.redBagContentType = @"1";
self.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
}else{
self.coinRedBagBtn.selected = NO;
[self.scrollBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
@@ -792,6 +856,7 @@
}];
self.diamondRedBagBtn.selected = YES;
self.redBagContentType = @"2";
self.moneyLabel.text = [NSString stringWithFormat:@"%@钻石可用",self.earnings];
}
}
-(void)drawAuthAction:(UIButton*)sender{
@@ -815,6 +880,18 @@
self.noDrawAuthBtn.selected = YES;
}
}
if (self.collectDrawAuthBtn.selected && self.upSeatDrawAuthBtn.selected) {
self.conditions = @"1,2";
}else{
if (self.collectDrawAuthBtn.selected) {
self.conditions = @"1";
}else if (self.upSeatDrawAuthBtn.selected) {
self.conditions = @"2";
}else{
self.conditions = @"0";
}
}
}
-(void)redBagTimeAction:(UIButton*)sender{
if (sender.selected == YES) {

View File

@@ -29,15 +29,13 @@
}
-(void)initSubviews{
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"redbag_tag_icon"]];
self.imageView.frame = CGRectMake(0, 0, self.redTagHeight, self.redTagWidth);
[self addSubview:self.imageView];
self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, 20)];
self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, self.width-10, 20)];
self.countLabel.textAlignment = NSTextAlignmentRight;
self.countLabel.font = [UIFont boldSystemFontOfSize:14];
self.countLabel.font = [UIFont boldSystemFontOfSize:18];
self.countLabel.textColor = RGB16(0xFFFEB2);
[self addSubview:self.countLabel];
@@ -49,7 +47,7 @@
[self addGestureRecognizer:panRecognizer];
}
-(void)btnClick{
BOOL isList = self.count.intValue>0?YES:NO;
BOOL isList = self.count.intValue>1?YES:NO;
if (self.startBlock) {
self.startBlock(isList);
}
@@ -57,6 +55,11 @@
-(void)setCount:(NSString *)count{
_count = count;
self.countLabel.text = [NSString stringWithFormat:@"x%@",count];
if (count.intValue == 0) {
self.hidden = YES;
}else{
self.hidden = NO;
}
}
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{

View File

@@ -17,6 +17,7 @@
#import "QXGiftDriftView.h"
#import "QXMeetActivityDriftView.h"
#import "QXDrifRoomHourRankView.h"
#import "QXRedPacketDriftView.h"
@interface QXRoomSettingView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource,QXRoomSettingViewDelegate>
@property (nonatomic,strong)UIView *bgView;
@@ -178,19 +179,13 @@
///
toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage];
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend];
// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport];
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
}else{
// toolsArr = @[self.roomSubsidy,self.roomMessage,self.roomOrderMic,self.roomBgMusic,self.roomBgImage];
///
toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage];
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend];
// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport];
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
}
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
@@ -200,8 +195,7 @@
//
roomTypeArr = @[];
toolsArr = @[];
// moreArr = @[self.redBag,self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.redBag,self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport];
self.titles = @[QXText(@"更多操作")];
}
break;
@@ -223,9 +217,7 @@
toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
}
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport];
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend];
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
}
@@ -249,9 +241,7 @@
}
// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend];
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport];
// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
}
break;
@@ -691,6 +681,7 @@
[[QXGiftDriftView shareView] drifPopIsClose:model.isSelected];
[[QXMeetActivityDriftView shareView] drifPopIsClose:model.isSelected];
[[QXDrifRoomHourRankView shareView] drifPopIsClose:model.isSelected];
[[QXRedPacketDriftView shareView] drifPopIsClose:model.isSelected];
return;
}
if (model.type == QXRoomSettingTypeRoomOrderMic) {

View File

@@ -56,7 +56,6 @@
[self.agoraKit getCurrentMonotonicTimeInMs];
[self.agoraKit setAudioProfile:AgoraAudioProfileMusicHighQualityStereo];
[self.agoraKit setAudioScenario:AgoraAudioScenarioChorus];
[self setChannelProfile];
self.agoraKit.delegate = self;
[self.agoraKit setParameters:@"{\"che.audio.custom_payload_type\":73}"];
@@ -368,6 +367,9 @@
if (self.delegate && [self.delegate respondsToSelector:@selector(rtcEngineVideoFirstLoadWithUid:size:)]) {
[self.delegate rtcEngineVideoFirstLoadWithUid:uid size:size];
}
}
-(void)rtcEngine:(AgoraRtcEngineKit *)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation{
}
-(void)rtcEngine:(AgoraRtcEngineKit *)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed{
NSLog(@"uid=%ld---直播远端视频状态发生变化status=%ld",uid,state);
@@ -742,6 +744,7 @@
videoParams.dimensions = [self screenShareVideoDimension];
videoParams.frameRate = AgoraVideoFrameRateFps15;
videoParams.bitrate = AgoraVideoBitrateStandard;
// _screenParams.videoParams = videoParams;
}
return _screenParams;
}

View File

@@ -9,9 +9,27 @@
#import "MQTTClient.h"
#import "MQTTSessionManager.h"
#import <CommonCrypto/CommonHMAC.h>
//typedef NS_ENUM(NSInteger) {
// /// 巡乐会进度更新
// QXManagerMqttTypeAcProgress = 100,
// /// 巡乐会即将开始
// QXManagerMqttTypeAcWill = 101,
// /// 巡乐会已经开始
// QXManagerMqttTypeAcStart = 102,
// /// 巡乐会结束落包
// QXManagerMqttTypeAcEnd = 103,
// /// 有人锁定了礼物
// QXManagerMqttTypeAcLock = 103,
//}QXManagerMqttType;
/// 礼物话题
static NSString * _Nonnull qx_room_topic = @"qx_room_topic";
/// 巡乐会话题
static NSString * _Nonnull qx_ac_topic = @"qx_xunlehui";
/// 小时榜话题
static NSString * _Nonnull qx_hour_ranking = @"qx_hour_ranking";
/// 红包话题
static NSString * _Nonnull qx_red_redpacket = @"qx_redpacket_arrive";
NS_ASSUME_NONNULL_BEGIN
@protocol MQTTClientModelDelegate <NSObject>

View File

@@ -81,6 +81,7 @@
[self subscribeTopic:qx_room_topic];
[self subscribeTopic:qx_ac_topic];
[self subscribeTopic:qx_hour_ranking];
[self subscribeTopic:qx_red_redpacket];
[self reConnectForStateError];
break;

View File

@@ -10,26 +10,41 @@
@class QXRedPacketManager;
@protocol QXRedPacketManagerDelegate <NSObject>
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket;
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId;
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket;
/// 推送添加单个红包回调
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount;
/// 首次获取房间内红包列表进行添加后回调
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPackets:(NSArray<QXRedPacketModel *>*)redPackets remainingCount:(NSInteger)remainingCount;
/// 红包从列表移除后的回调
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId remainingCount:(NSInteger)remainingCount;
/// 红包状态发生变化时回调(由不可抢到可抢)
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount;
/// 红包状态发生变化时回调(由不可抢到可抢)
- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacketTime:(long)time redPacket:(QXRedPacketModel *)redPacket;
@end
@interface QXRedPacketManager : NSObject
@property (nonatomic, strong, readonly) NSMutableDictionary<NSString *, QXRedPacketModel *> *redPackets;
@property (nonatomic, weak) id<QXRedPacketManagerDelegate> delegate;
+ (instancetype)sharedManager;
// 添加红包
/// 批量添加红包
- (void)addRedPackets:(NSArray<QXRedPacketModel *>*)redPackets;
/// 添加红包
- (void)addRedPacket:(QXRedPacketModel *)redPacket;
// 移除红包
/// 移除红包
- (void)removeRedPacket:(NSString *)packetId;
// 获取所有红包
/// 获取所有红包
- (NSArray<QXRedPacketModel *> *)allRedPackets;
// 根据位置获取红包
- (QXRedPacketModel *)redPacketAtPosition:(NSInteger)position;
// 检查并更新红包状态
/// 根据红包id获取红包
- (QXRedPacketModel *)getRedPacket:(NSString *)packetId;
/// 检查并更新红包状态
- (void)checkAndUpdateRedPackets;
/// 移除所有红包
-(void)removeAllRedpackets;
/// 开启定时器
-(void)startCheckTimer;
/// 销毁定时器
-(void)endCheckTimer;
/// 回收内存
-(void)destoryRedpacketInfo;
@end

View File

@@ -27,40 +27,48 @@
self = [super init];
if (self) {
_redPackets = [NSMutableDictionary dictionary];
[self startCheckTimer];
}
return self;
}
-(void)addRedPackets:(NSArray<QXRedPacketModel *> *)redPackets{
if (redPackets.count == 0) {
return;
}
for (QXRedPacketModel*md in redPackets) {
self.redPackets[md.redpacket_id] = md;
}
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didAddRedPackets:remainingCount:)]) {
[self.delegate QXRedPacketManager:[QXRedPacketManager sharedManager] didAddRedPackets:redPackets remainingCount:self.redPackets.count];
}
}
- (void)addRedPacket:(QXRedPacketModel *)redPacket {
if (!redPacket.packetId) return;
if (!redPacket.redpacket_id) return;
self.redPackets[redPacket.packetId] = redPacket;
self.redPackets[redPacket.redpacket_id] = redPacket;
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didAddRedPacket:)]) {
[self.delegate respondsToSelector:@selector(QXRedPacketManager:didAddRedPacket:)];
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didAddRedPacket:remainingCount:)]) {
[self.delegate QXRedPacketManager:[QXRedPacketManager sharedManager] didAddRedPacket:redPacket remainingCount:self.redPackets.count];
}
}
- (void)removeRedPacket:(NSString *)packetId {
[self.redPackets removeObjectForKey:packetId];
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didRemoveRedPacket:)]) {
[self.delegate QXRedPacketManager:self didRemoveRedPacket:packetId];
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didRemoveRedPacket:remainingCount:)]) {
[self.delegate QXRedPacketManager:[QXRedPacketManager sharedManager] didRemoveRedPacket:packetId remainingCount:self.redPackets.count];
}
}
- (NSArray<QXRedPacketModel *> *)allRedPackets {
return [self.redPackets allValues];
return [self sortRedPacketsByOpenTime:[self.redPackets allValues]];
}
- (QXRedPacketModel *)redPacketAtPosition:(NSInteger)position {
for (QXRedPacketModel *packet in self.redPackets.allValues) {
if (packet.position == position) {
return packet;
}
}
return nil;
- (NSArray *)sortRedPacketsByOpenTime:(NSArray *)redPackets {
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"start_time" ascending:YES];
NSArray *sortedArray = [redPackets sortedArrayUsingDescriptors:@[sortDescriptor]];
return sortedArray;
}
-(QXRedPacketModel *)getRedPacket:(NSString *)packetId{
return [self.redPackets objectForKey:packetId];
}
- (void)startCheckTimer {
@@ -75,27 +83,52 @@
NSArray *packets = [self.allRedPackets copy];
for (QXRedPacketModel *packet in packets) {
//
long packetTime = [packet remainingTime];
if ((packetTime <= -packet.redpacket_time.intValue)) {
// 10
[self removeRedPacket:packet.redpacket_id];
}
if (packet.countdown.intValue == 0) {
continue;
}
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didUpdateRedPacketTime:redPacket:)]) {
[self.delegate QXRedPacketManager:[QXRedPacketManager sharedManager] didUpdateRedPacketTime:packetTime redPacket:packet];
}
BOOL wasAvailable = packet.isAvailable;
packet.isAvailable = [packet canOpenNow];
//
if (wasAvailable != packet.isAvailable) {
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didUpdateRedPacket:)]) {
[self.delegate QXRedPacketManager:self didUpdateRedPacket:packet];
if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didUpdateRedPacket:remainingCount:)]) {
[self.delegate QXRedPacketManager:[QXRedPacketManager sharedManager] didUpdateRedPacket:packet remainingCount:self.redPackets.count];
}
}
//
// if (packet.type == RedPacketTypeCountdown && [packet remainingTime] <= -10) {
// // 10
// [self removeRedPacket:packet.packetId];
// }
}
}
-(void)removeAllRedpackets{
[self.redPackets removeAllObjects];
}
-(void)endCheckTimer{
if (self.checkTimer) {
[self.checkTimer invalidate];
self.checkTimer = nil;
}
}
-(void)destoryRedpacketInfo{
[self removeAllRedpackets];
[self endCheckTimer];
self.delegate = nil;
}
- (void)dealloc {
if (self.checkTimer) {
[self.checkTimer invalidate];
self.checkTimer = nil;
}
}
- (void)dealloc {
[self.checkTimer invalidate];
self.checkTimer = nil;
}
@end

View File

@@ -9,6 +9,7 @@
#import "QXRoomChatListView.h"
#import "QXRoomModel.h"
#import "QXRoomFriendRelationModel.h"
#import "QXRedPacketModel.h"
typedef NS_ENUM(NSInteger) {
/// 清空消息
@@ -124,6 +125,11 @@ typedef NS_ENUM(NSInteger) {
QXRoomMessageTypeRoomUserOnlineStatus = 1058,
/// 清除个人魅力
QXRoomMessageTypeRoomClearUserCharm = 1059,
/// 发红包
QXRoomMessageTypeSendRedpacket = 1060,
/// 红包已被抢完
QXRoomMessageTypeRedpacketFinished = 1061,
}QXRoomMessageType;
NS_ASSUME_NONNULL_BEGIN
@protocol QXRoomMessageManagerDelegate <NSObject>
@@ -253,6 +259,11 @@ NS_ASSUME_NONNULL_BEGIN
-(void)meetActivityGiftInfoIsUpdate:(QXRoomChatListModel*)giftInfo;
/// 清除个人魅力
-(void)roomClearUserCharmWithUserId:(NSString*)userId;
/// 发红包
-(void)recievedRedPacket:(QXRedPacketModel*)model;
/// 红包
-(void)redPacketDidFinished:(NSString*)redpacket_id;
/// 房间用户在线状态发生变化
//-(void)roomUserOnlineStatusDidChanged:(BOOL)isOnline userId:(NSString*)userId;
@end

View File

@@ -616,6 +616,20 @@
[[NSNotificationCenter defaultCenter] postNotificationName:noticeRoomUserOnlineStatusDidChanged object:parm];
}
break;
case QXRoomMessageTypeSendRedpacket:{
QXRedPacketModel *model = [QXRedPacketModel yy_modelWithJSON:msg.Text[@"redpacketInfo"]];
if (self.delegate && [self.delegate respondsToSelector:@selector(recievedRedPacket:)]) {
[self.delegate recievedRedPacket:model];
}
}
break;
case QXRoomMessageTypeRedpacketFinished:{
NSString *redpacket_id = [NSString stringWithFormat:@"%@",msg.Text[@"redpacket_id"]];
if (self.delegate && [self.delegate respondsToSelector:@selector(redPacketDidFinished:)]) {
[self.delegate redPacketDidFinished:redpacket_id];
}
}
break;
default:
break;
}

View File

@@ -23,6 +23,7 @@
#import "QXDayTaskModel.h"
#import "QXRoomUserCharmModel.h"
#import "QXRoomHourRankModel.h"
#import "QXRedPacketModel.h"
NS_ASSUME_NONNULL_BEGIN
@@ -843,6 +844,7 @@ NS_ASSUME_NONNULL_BEGIN
coin:(NSString*)coin
type:(NSString*)type
userId:(NSString*)userId
typeId:(NSString*)typeId
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
@@ -1075,6 +1077,64 @@ NS_ASSUME_NONNULL_BEGIN
+(void)roomHourRankWithPage:(NSInteger)page
successBlock:(void (^)(QXRoomHourRankModel* model))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
发红包
type 红包类型1-普通红包2-口令红包
password 口令
coin_type 币种1- 金币2- 钻石
total_amount 总金额
total_count 红包个数
conditions 条件值(逗号分隔)
countdown 倒计时单位S)
room_id 房间ID
*/
+(void)createRedpacketWithType:(NSString*)type
password:(NSString*)password
coin_type:(NSString*)coin_type
total_amount:(NSString*)total_amount
total_count:(NSString*)total_count
conditions:(NSString*)conditions
countdown:(NSString*)countdown
room_id:(NSString*)room_id
remark:(NSString *)remark
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
获取房间红包列表
*/
+(void)getRedpacketListWithRoomId:(NSString*)roomId
successBlock:(void (^)(NSArray<QXRedPacketModel*>* list))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
抢红包
返回code 1 正常抢 2已经抢过了 3 手慢了
*/
+(void)drawRedpacketWithRedpacketId:(NSString*)redpacketId
successBlock:(void (^)(NSString* code))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
获取红包记录列表
*/
+(void)getRedpacketRecordWithRedpacketId:(NSString*)redpacketId
successBlock:(void (^)(QXDrawRedPacketModel* list))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
/**
收藏房间
1 收藏 0 取消收藏
*/
+(void)roomCollectWithType:(NSString*)type
room_id:(NSString*)room_id
successBlock:(void (^)(NSDictionary* dict))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
@end

View File

@@ -1627,12 +1627,13 @@
}];
}
+(void)rechargePayWithMoney:(NSString *)money coin:(NSString *)coin type:(NSString *)type userId:(NSString*)userId successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
+(void)rechargePayWithMoney:(NSString *)money coin:(NSString *)coin type:(NSString *)type userId:(NSString*)userId typeId:(NSString*)typeId successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters =@{
@"coin":coin?coin:@"",
@"money":money?money:@"",
@"type":type?type:@"",
@"user_id":userId?userId:@""
@"user_id":userId?userId:@"",
@"type_id":typeId?typeId:@""
};
[[QXRequset shareInstance] postWithUrl:QXRechargePay parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
@@ -2108,5 +2109,104 @@
}];
}
+(void)createRedpacketWithType:(NSString *)type
password:(NSString *)password
coin_type:(NSString *)coin_type
total_amount:(NSString *)total_amount
total_count:(NSString *)total_count
conditions:(NSString *)conditions
countdown:(NSString *)countdown
room_id:(NSString *)room_id
remark:(NSString *)remark
successBlock:(void (^)(NSDictionary * _Nonnull))successBlock
failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters =@{
@"type":type?type:@"",
@"password":password?password:@"",
@"coin_type":coin_type?coin_type:@"",
@"total_amount":total_amount?total_amount:@"",
@"total_count":total_count?total_count:@"",
@"conditions":conditions?conditions:@"",
@"countdown":countdown?countdown:@"",
@"room_id":room_id?room_id:@"",
@"remark":remark?remark:@""
};
[[QXRequset shareInstance] postWithUrl:QXRoomCreateRedpacket parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
+(void)getRedpacketListWithRoomId:(NSString *)roomId
successBlock:(void (^)(NSArray<QXRedPacketModel *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters =@{
@"room_id":roomId?roomId:@"",
};
[[QXRequset shareInstance] getWithUrl:QXRoomRedpacketList parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSArray*list = [NSArray yy_modelArrayWithClass:[QXRedPacketModel class] json:responseObject[@"data"]];
successBlock(list);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
/**
*/
+(void)drawRedpacketWithRedpacketId:(NSString*)redpacketId
successBlock:(void (^)(NSString* code))successBlock
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
NSDictionary *parameters =@{
@"redpacket_id":redpacketId?redpacketId:@"",
};
[[QXRequset shareInstance] postWithUrl:QXRoomDrawRedpacket parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
NSString *code = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"code"]];
successBlock(code);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
/**
*/
+(void)getRedpacketRecordWithRedpacketId:(NSString*)redpacketId
successBlock:(nonnull void (^)(QXDrawRedPacketModel * _Nonnull))successBlock
failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters =@{
@"redpacket_id":redpacketId?redpacketId:@"",
};
[[QXRequset shareInstance] postWithUrl:QXRoomRedpacketDetail parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
QXDrawRedPacketModel*model = [QXDrawRedPacketModel yy_modelWithJSON:responseObject[@"data"]];
successBlock(model);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
+(void)roomCollectWithType:(NSString *)type room_id:(NSString *)room_id successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
NSDictionary *parameters =@{
@"room_id":room_id?room_id:@"",
@"type":type?type:@""
};
[[QXRequset shareInstance] getWithUrl:QXUserFollowRoom parameters:parameters needCache:NO success:^(id responseObject) {
if (successBlock) {
successBlock(responseObject[@"data"]);
}
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
failBlock(error,msg);
}];
}
@end

View File

@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign)BOOL isPop;
@property (nonatomic,assign)BOOL isOnlyDisplayPayType;
@property (nonatomic,strong)QXRechargeListModel *selectedModel;
@property (nonatomic,strong)NSString *gift_bag_id;
-(void)showInView:(UIView *)view;
@end

View File

@@ -266,7 +266,7 @@
}
@weakify(self)
[QXMineNetwork rechargePayWithMoney:self.selectedModel.money coin:self.selectedModel.coins type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id successBlock:^(NSDictionary * _Nonnull dict) {
[QXMineNetwork rechargePayWithMoney:self.selectedModel.money coin:self.selectedModel.coins type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id typeId:self.gift_bag_id successBlock:^(NSDictionary * _Nonnull dict) {
@strongify(self)
if (self.selectedPayTypeModel.type.intValue == 2) {
NSDictionary *resultDict = dict[@"data"];

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "红包2@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "红包2@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "red_bag_list_pwd_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "red_bag_list_pwd_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "red_packet_pop_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "red_packet_pwd_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "red_packet_pwd_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "room_set_room_send_redbag@2x.png",
"filename" : "发红包@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_set_room_send_redbag@3x.png",
"filename" : "发红包@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -5,7 +5,7 @@
"scale" : "1x"
},
{
"filename" : "天降好礼@2x.png",
"filename" : "首充礼包@2x.png",
"idiom" : "universal",
"scale" : "2x"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "one_mouth_money@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "one_mouth_money@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "image 750@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "image 750@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -118,6 +118,8 @@ static NSString *const noticeAlipayResult = @"noticeAlipayResult";
static NSString *const noticeChangePassword = @"noticeChangePassword";
/// 相册删除成功
static NSString *const noticePhotosStatusChange = @"noticePhotosStatusChange";
/// 巡乐会进度更新
static NSString *const noticeXLHNotice = @"noticeXLHNotice";
/// 声网说话
static NSString *const noticeUserSpeak = @"noticeUserSpeak";

View File

@@ -147,6 +147,9 @@ static NSString * QXDynamicMutualRelationship = @"api/UserZone/mutual_follow";
/// 关注/取关
static NSString * QXUserFollow = @"api/User/follow";
/// 收藏房间
static NSString * QXUserFollowRoom = @"api/User/follow_room";
#pragma mark - 系统消息封面
/// 系统消息封面
static NSString * QXSystemHomeMessage = @"api/UserMessage/get_user_message_cover_info";
@@ -454,4 +457,12 @@ static NSString * QXWalletBindDetail = @"api/Bind/bind_detail";
/// 小时榜
static NSString * QXRoomHourRank = @"api/RoomHourRanking/room_hour_ranking";
/// 创建红包
static NSString * QXRoomCreateRedpacket = @"api/Redpacket/create";
/// 抢红包
static NSString * QXRoomDrawRedpacket = @"api/Redpacket/grab";
/// 房间内红包列表
static NSString * QXRoomRedpacketList = @"api/Redpacket/roomRedPackets";
/// 红包详情
static NSString * QXRoomRedpacketDetail = @"api/Redpacket/detail";
#endif /* Api_h */

Binary file not shown.

View File

@@ -23,7 +23,7 @@
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wxfc7bf7ca8c71840d</string>
<string>wxef1289d8a89b41d4</string>
</array>
</dict>
</array>

View File

@@ -25,6 +25,7 @@
//#import "QXFirstRechargePopView.h" //
#import "QXInvitePopView.h" //
#import "QXGiftDriftView.h" //
#import "QXRedPacketDriftView.h" //
#import <ImSDK_Plus/ImSDK_Plus.h>
#import "QXMessageServices.h"
@@ -99,6 +100,7 @@
[[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{
QXLOG(@"页面关闭");
// [weakSelf popNiceGiftView];
[weakSelf.homeVC popFirstRechargeView];
}];
};
view.gotoActionBlock = ^{
@@ -267,34 +269,32 @@
-(void)socketManager:(NSString *)socketManager receivedMessage:(NSDictionary *)message topic:(NSString *)topic{
if ([topic isEqualToString:qx_room_topic]) {
// NSDictionary*dict = message[@"msg"];
// BOOL isList = YES;
// for (NSString *key in dict.allKeys) {
// if ([key isEqualToString:@"list"]) {
// isList = NO;
// break;
// }
// }
// if (isList) {
NSArray *array = [NSArray yy_modelArrayWithClass:[QXGiftScrollModel class] json:message[@"msg"][@"list"]];
if (array.count == 0) {
return;
}
[self.homeVC giftScrollViewShowWithModelList:array];
[[QXGiftDriftView shareView] addGiftModelList:array];
// }else{
// QXGiftScrollModel *model = [QXGiftScrollModel yy_modelWithJSON:message[@"msg"][@"list"]];
// [self.homeVC giftScrollViewShowWithModel:model];
// [[QXGiftDriftView shareView] addGiftModel:model];
// }
NSArray *array = [NSArray yy_modelArrayWithClass:[QXGiftScrollModel class] json:message[@"msg"][@"list"]];
if (array.count == 0) {
return;
}
[self.homeVC giftScrollViewShowWithModelList:array];
[[QXGiftDriftView shareView] addGiftModelList:array];
}else if([topic isEqualToString:qx_ac_topic]){
// QXManagerMqttType
QXMeetActivityDriftModel *model = [QXMeetActivityDriftModel yy_modelWithJSON:message[@"msg"]];
if (model.from_type == QXMeetActivityTypeAcProgress) {
[[NSNotificationCenter defaultCenter] postNotificationName:noticeXLHNotice object:model];
return;
}
if (model.from_type == QXMeetActivityTypeAcLock) {
[[NSNotificationCenter defaultCenter] postNotificationName:noticeXLHNotice object:model];
}
[[QXMeetActivityDriftView shareView] addActivityModel:model];
}else if ([topic isEqualToString:qx_hour_ranking]){
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXRoomHourDriftModel class] json:message[@"msg"]];
[[QXDrifRoomHourRankView shareView] addActivityModelList:arr];
}else if ([topic isEqualToString:qx_red_redpacket]){
QXRedPacketDriftModel *model = [QXRedPacketDriftModel yy_modelWithJSON:message[@"msg"]];
[[QXRedPacketDriftView shareView] addRedpacketModel:model];
}
}
-(QXAppVersionView *)appUpdateView{

View File

@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface QXFirstRechargeView : UIView
@property (nonatomic,copy)void(^closeActionBlock)(void);
@property (nonatomic,copy)void(^getActionBlock)(void);
@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id);
@property (nonatomic,copy)void(^refreshBlcock)(void);
@end

View File

@@ -82,7 +82,7 @@
self.messageLabel = [[UILabel alloc] init];
self.messageLabel.font = [UIFont systemFontOfSize:12];
self.messageLabel.numberOfLines = 0;
self.messageLabel.text = QXText(@"充值6元即可获得总价值888金币的道具或装扮");
self.messageLabel.text = QXText(@"");
self.messageLabel.textColor = QXConfig.textColor;
[self.giftBgView addSubview:self.messageLabel];
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -126,6 +126,7 @@
QXFirstRechargeModel *md = list.firstObject;
if (md) {
weakSelf.model = md;
weakSelf.messageLabel.text = [NSString stringWithFormat:@"充值%@即可获得%@金币",md.name,md.title2];
[weakSelf.collectionView reloadData];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
@@ -149,8 +150,8 @@
//
-(void)getAction{
if (self.getActionBlock) {
self.getActionBlock();
if (self.rechargeActionBlock) {
self.rechargeActionBlock(self.model.money,self.model.gift_bag_id);
}
}
-(void)closeAction{

View File

@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface QXNewPeoplePopView : UIView
@property (nonatomic,copy)void(^closeActionBlock)(void);
@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money);
@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id);
@property (nonatomic,copy)void(^refreshBlcock)(void);
@property (nonatomic,strong)NSArray *giftArray;
-(void)reloadData;

View File

@@ -19,6 +19,7 @@
@property (nonatomic,strong)UIButton *firstBtn;
@property (nonatomic,strong)UIButton *secondBtn;
@property (nonatomic,strong)UIButton *thirdBtn;
@property (nonatomic,strong)UIButton *oneMouthBtn;
@property (nonatomic,strong)UIButton *selectedBtn;
@property (nonatomic,strong)UIView *giftBgView;
@@ -29,7 +30,9 @@
@property (nonatomic,strong)QXNiceGiftRechargeModel *md1;
@property (nonatomic,strong)QXNiceGiftRechargeModel *md2;
@property (nonatomic,strong)QXNiceGiftRechargeModel *md3;
@property (nonatomic,strong)QXNiceGiftRechargeModel *md4;
@property (nonatomic,strong)QXNiceGiftRechargeModel *smd;
@end
@implementation QXNewPeoplePopView
@@ -71,9 +74,11 @@
self.firstBtn.hidden = YES;
UIImage *firstNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
UIImage *firstSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
UIImage *firstDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
[self.firstBtn setBackgroundImage:firstNorImage forState:(UIControlStateNormal)];
[self.firstBtn setBackgroundImage:firstSelImage forState:(UIControlStateSelected)];
self.firstBtn.selected = YES;
[self.firstBtn setBackgroundImage:firstDisImage forState:(UIControlStateDisabled)];
// self.firstBtn.selected = YES;
// [self.firstBtn setTitle:@"9元" forState:(UIControlStateNormal)];
[self.firstBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
[self.firstBtn addRoundedCornersWithRadius:ScaleWidth(13)];
@@ -92,8 +97,10 @@
self.secondBtn.hidden = YES;
UIImage *secondNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
UIImage *secondSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
UIImage *secondDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
[self.secondBtn setBackgroundImage:secondNorImage forState:(UIControlStateNormal)];
[self.secondBtn setBackgroundImage:secondSelImage forState:(UIControlStateSelected)];
[self.secondBtn setBackgroundImage:secondDisImage forState:(UIControlStateDisabled)];
// [self.secondBtn setTitle:@"30元" forState:(UIControlStateNormal)];
[self.secondBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
[self.secondBtn addRoundedCornersWithRadius:ScaleWidth(13)];
@@ -104,7 +111,7 @@
make.left.equalTo(self.firstBtn.mas_right).offset(12);
make.top.equalTo(self.firstBtn);
make.height.mas_equalTo(ScaleWidth(26));
make.width.mas_equalTo(ScaleWidth(42));
make.width.mas_equalTo(ScaleWidth(50));
}];
@@ -112,8 +119,10 @@
self.thirdBtn.hidden = YES;
UIImage *thirdNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
UIImage *thirdSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
UIImage *thirdDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
[self.thirdBtn setBackgroundImage:thirdNorImage forState:(UIControlStateNormal)];
[self.thirdBtn setBackgroundImage:thirdSelImage forState:(UIControlStateSelected)];
[self.thirdBtn setBackgroundImage:thirdDisImage forState:(UIControlStateDisabled)];
// [self.thirdBtn setTitle:@"60元" forState:(UIControlStateNormal)];
[self.thirdBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
[self.thirdBtn addRoundedCornersWithRadius:ScaleWidth(13)];
@@ -124,9 +133,28 @@
make.left.equalTo(self.secondBtn.mas_right).offset(12);
make.top.equalTo(self.firstBtn);
make.height.mas_equalTo(ScaleWidth(26));
make.width.mas_equalTo(ScaleWidth(42));
make.width.mas_equalTo(ScaleWidth(50));
}];
self.oneMouthBtn = [[UIButton alloc] init];
self.oneMouthBtn.hidden = YES;
UIImage *one_mouth_norImage = [UIImage imageNamed:@"one_mouth_money"];
UIImage *one_mouth_selImage = [UIImage imageNamed:@"one_mouth_money_sel"];
[self.oneMouthBtn setBackgroundImage:one_mouth_norImage forState:(UIControlStateNormal)];
[self.oneMouthBtn setBackgroundImage:one_mouth_selImage forState:(UIControlStateSelected)];
[self.oneMouthBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
[self.oneMouthBtn addRoundedCornersWithRadius:ScaleWidth(13)];
self.oneMouthBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.oneMouthBtn addTarget:self action:@selector(rechargeSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.oneMouthBtn];
[self.oneMouthBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.bgImageView.mas_right).offset(-27);
make.centerY.equalTo(self.firstBtn);
make.height.mas_equalTo(ScaleWidth(24));
make.width.mas_equalTo(ScaleWidth(66));
}];
self.giftBgView = [[UIView alloc] init];
self.giftBgView.backgroundColor = [UIColor whiteColor];
[self.giftBgView addRoundedCornersWithRadius:13];
@@ -204,30 +232,55 @@
}
-(void)getFirstRechargeGiftList{
MJWeakSelf
[QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray<QXFirstRechargeModel *> * _Nonnull list) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
[QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray<QXNiceGiftRechargeModel *> * _Nonnull list) {
for (int i = 0; i<list.count; i++) {
if (i == 0) {
weakSelf.md1 = list[i];
weakSelf.firstBtn.hidden = NO;
[weakSelf.firstBtn setTitle:weakSelf.md1.name forState:(UIControlStateNormal)];
if (weakSelf.md1.status.intValue == 1) {
weakSelf.firstBtn.enabled = YES;
weakSelf.firstBtn.selected = YES;
weakSelf.selectedBtn = weakSelf.firstBtn;
}else{
weakSelf.firstBtn.enabled = NO;
}
continue;
}
if (i == 1) {
weakSelf.md2 = list[i];
weakSelf.secondBtn.hidden = NO;
[weakSelf.secondBtn setTitle:weakSelf.md2.name forState:(UIControlStateNormal)];
if (weakSelf.md2.status.intValue == 1) {
weakSelf.secondBtn.enabled = YES;
if (!weakSelf.selectedBtn.selected) {
weakSelf.secondBtn.selected = YES;
weakSelf.selectedBtn = weakSelf.secondBtn;
}
}else{
weakSelf.secondBtn.enabled = NO;
}
continue;
}
if (i == 2) {
weakSelf.md3 = list[i];
weakSelf.thirdBtn.hidden = NO;
[weakSelf.thirdBtn setTitle:weakSelf.md3.name forState:(UIControlStateNormal)];
if (weakSelf.md3.status.intValue == 1) {
weakSelf.thirdBtn.enabled = YES;
if (!weakSelf.selectedBtn.selected) {
weakSelf.thirdBtn.selected = YES;
weakSelf.selectedBtn = weakSelf.thirdBtn;
}
}else{
weakSelf.thirdBtn.enabled = NO;
}
continue;
}
if (i == 3) {
weakSelf.md4 = list[i];
[weakSelf.oneMouthBtn setTitle:weakSelf.md4.name forState:(UIControlStateNormal)];
weakSelf.oneMouthBtn.hidden = NO;
continue;
}
}
@@ -285,6 +338,9 @@
}else if (sender == self.thirdBtn){
self.giftArray = self.md3.gift_list;
md = self.md3;
}else if (sender == self.oneMouthBtn){
self.giftArray = self.md4.gift_list;
md = self.md4;
}
self.smd = md;
if (md == nil) {
@@ -308,7 +364,7 @@
}
-(void)rechargeAction{
if (self.rechargeActionBlock) {
self.rechargeActionBlock(self.smd.money);
self.rechargeActionBlock(self.smd.money,self.smd.gift_bag_id);
}
}
-(void)closeAction{

View File

@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface QXNiceGiftPopView : UIView
@property (nonatomic,copy)void(^closeActionBlock)(void);
@property (nonatomic,copy)void(^getActionBlock)(void);
@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id);
@property (nonatomic,copy)void(^refreshBlcock)(void);
@end

View File

@@ -54,7 +54,9 @@
[self.timeDownbgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.bgImageView).offset(ScaleWidth(117));
make.left.equalTo(self.bgImageView).offset(9);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(179), ScaleWidth(20)));
make.right.equalTo(self.bgImageView).offset(-9);
make.width.mas_equalTo(ScaleWidth(20));
}];
self.timeDownLabel = [[UILabel alloc] init];
@@ -130,7 +132,7 @@
self.messageLabel = [[UILabel alloc] init];
self.messageLabel.font = [UIFont systemFontOfSize:12];
self.messageLabel.numberOfLines = 0;
self.messageLabel.text = QXText(@"充值6元即可获得总价值888金币的道具或装扮");
self.messageLabel.text = @"";
self.messageLabel.textColor = QXConfig.textColor;
[self.giftBgView addSubview:self.messageLabel];
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -172,7 +174,7 @@
MJWeakSelf
[QXHomePageNetwork getSkyDropGiftListSuccessBlock:^(QXNiceGiftRechargeModel * _Nonnull model) {
weakSelf.model = model;
weakSelf.timeDownLabel.text = model.effective_time;
weakSelf.timeDownLabel.text = [NSString stringWithFormat:@"结束时间:%@",model.effective_time];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:model.counter];
[attr yy_setColor:QXConfig.themeColor range:[model.counter rangeOfString:model.money]];
[attr yy_setColor:QXConfig.themeColor range:[model.counter rangeOfString:model.diamond]];
@@ -191,15 +193,15 @@
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
cell.cellType = QXGiftCellTypeNiceGift;
cell.roomGiftModel = self.model.gift_list[indexPath.row];
cell.niceGiftModel = self.model.gift_list[indexPath.row];
return cell;
}
//
-(void)getAction{
if (self.getActionBlock) {
self.getActionBlock();
if (self.rechargeActionBlock) {
self.rechargeActionBlock(self.model.money,self.model.gift_bag_id);
}
}
-(void)closeAction{

View File

@@ -6,14 +6,22 @@
//
#import <UIKit/UIKit.h>
#import "QXGiftActivityModel.h"
typedef NS_ENUM(NSInteger) {
/// 即将开始
QXMeetActivityDriftTypeWillStart = 1,
/// 已经开始
QXMeetActivityDriftTypeStart = 2,
/// 落入背包
QXMeetActivityDriftTypeFinished = 3,
}QXMeetActivityDriftType;
/// 巡乐会进度更新
QXMeetActivityTypeAcProgress = 100,
/// 巡乐会即将开始
QXMeetActivityTypeAcWill = 101,
/// 巡乐会已经开始
QXMeetActivityTypeAcStart = 102,
/// 有人锁定了礼物
QXMeetActivityTypeAcLock = 103,
/// 巡乐会结束落包
QXMeetActivityTypeAcEnd = 104,
}QXMeetActivityType;
NS_ASSUME_NONNULL_BEGIN
@class QXMeetActivityDriftModel;
@interface QXMeetActivityDriftView : UIView
@@ -29,6 +37,14 @@ NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityDriftModel : NSObject
@property (nonatomic,strong)NSString *room_id;
@property (nonatomic,strong)NSString *text;
@property (nonatomic,strong)NSString *gift_num;
@property (nonatomic,strong)NSString *end_time;
@property (nonatomic,strong)QXXLHModel *xlh_data;
@property (nonatomic,strong)QXUserModel *room_user;
@property (nonatomic,strong)QXUserModel *FromUserInfo;
@property (nonatomic,assign)NSInteger from_type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -101,15 +101,20 @@
_model = model;
self.titleLabel.text = model.text;
switch (model.from_type) {
case QXMeetActivityDriftTypeWillStart:{
case QXMeetActivityTypeAcWill:{
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_will_pop_bg"];
}
break;
case QXMeetActivityDriftTypeStart:{
case QXMeetActivityTypeAcStart:{
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_start_pop_bg"];
}
break;
case QXMeetActivityDriftTypeFinished:{
case QXMeetActivityTypeAcEnd:{
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_finished_pop_bg"];
}
break;
case QXMeetActivityTypeAcLock:{
// self.bgImageView.image = [UIImage imageNamed:@"ac_meet_update_pop_bg"];
self.bgImageView.image = [UIImage imageNamed:@"ac_meet_finished_pop_bg"];
}
break;
@@ -144,7 +149,12 @@
@implementation QXMeetActivityDriftModel
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
return @{
@"xlh_data" : @"QXXLHModel",
@"room_user":@"QXUserModel",
@"FromUserInfo":@"QXUserModel",
};
}
@end

View File

@@ -0,0 +1,29 @@
//
// QXRedPacketDriftView.h
// QXLive
//
// Created by 启星 on 2025/10/15.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class QXRedPacketDriftModel;
@interface QXRedPacketDriftView : UIView
@property (nonatomic,strong)UIImageView *bgImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)QXRedPacketDriftModel *model;
@property (nonatomic,strong)NSMutableArray *dataArray;
-(void)addRedpacketModel:(QXRedPacketDriftModel*)model;
-(void)drifPopIsClose:(BOOL)isClose;
+(instancetype)shareView;
@end
@interface QXRedPacketDriftModel : NSObject
@property (nonatomic,strong)NSString *room_id;
@property (nonatomic,strong)NSString *nickname;
@property (nonatomic,strong)NSString *room_name;
@property (nonatomic,strong)NSString *text;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,148 @@
//
// QXRedPacketDriftView.m
// QXLive
//
// Created by on 2025/8/29.
//
#import "QXRedPacketDriftView.h"
#import <AVFoundation/AVFoundation.h>
@interface QXRedPacketDriftView()
@property (nonatomic,assign)BOOL isPlaying;
@property (nonatomic,assign)BOOL isClose;
@property (nonatomic,strong)AVPlayer* player;
@end
@implementation QXRedPacketDriftView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(SCREEN_WIDTH, ScaleWidth(290), ScaleWidth(334), ScaleWidth(102));
BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifPop];
self.isClose = isClose;
[self initSubviews];
}
return self;
}
+(instancetype)shareView{
static QXRedPacketDriftView *manager = nil;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
manager = [[QXRedPacketDriftView alloc] init];
});
return manager;
}
-(void)initSubviews{
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"red_packet_pop_bg"]];
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
[self addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(ScaleWidth(334));
make.height.mas_equalTo(ScaleWidth(102));
make.centerX.equalTo(self);
make.top.equalTo(self);
}];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont systemFontOfSize:12];
self.titleLabel.textColor = RGB16(0xFFFFFF);
[self addSubview:self.titleLabel];;
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bgImageView).offset(ScaleWidth(58));
make.bottom.equalTo(self.bgImageView).offset(ScaleWidth(-37));
make.height.mas_equalTo(14);
}];
self.userInteractionEnabled = YES;
MJWeakSelf
[self addTapBlock:^(id _Nonnull obj) {
if ([weakSelf.model.room_id isExist]) {
[[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.model.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController];
}
}];
}
-(void)addRedpacketModel:(QXRedPacketModel *)model{
if (self.isClose) {
return;
}
[self.dataArray addObject:model];
[self giftAction];
}
-(void)giftAction{
if (self.isPlaying) {
return;
}
MJWeakSelf
[QXRedPacketDriftView shareView].isPlaying = YES;
[QXRedPacketDriftView shareView].model = [QXRedPacketDriftView shareView].dataArray.firstObject;
[self.player seekToTime:CMTimeMake(0, 1)];
[self.player play];
[KEYWINDOW addSubview:[QXRedPacketDriftView shareView]];
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[QXRedPacketDriftView shareView].x = (SCREEN_WIDTH-ScaleWidth(334))/2;
} completion:^(BOOL finished) {
[weakSelf performSelector:@selector(dissmissAnimate) afterDelay:5];
}];
}
-(void)dissmissAnimate{
[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
[QXRedPacketDriftView shareView].x = -SCREEN_WIDTH;
} completion:^(BOOL finished) {
[QXRedPacketDriftView shareView].x = SCREEN_WIDTH;
[[QXRedPacketDriftView shareView] removeFromSuperview];
[[QXRedPacketDriftView shareView].dataArray removeFirstObject];
[QXRedPacketDriftView shareView].isPlaying = NO;
if ([QXRedPacketDriftView shareView].dataArray.count>0) {
[[QXRedPacketDriftView shareView] giftAction];
}
}];
}
-(void)setModel:(QXRedPacketDriftModel *)model{
_model = model;
NSMutableAttributedString*attr = [[NSMutableAttributedString alloc] initWithString:model.text];
[attr yy_setColor:RGB16(0x6C49E4) range:[model.text rangeOfString:model.nickname]];
[attr yy_setColor:RGB16(0x6C49E4) range:[model.text rangeOfString:model.room_name]];
self.titleLabel.attributedText = attr;
}
-(void)drifPopIsClose:(BOOL)isClose{
_isClose = isClose;
self.hidden = self.isClose;
[[NSUserDefaults standardUserDefaults] setBool:isClose forKey:kIsCloseDrifPop];
[[NSUserDefaults standardUserDefaults] synchronize];
if (isClose) {
[QXRedPacketDriftView shareView].x = SCREEN_WIDTH;
[[QXRedPacketDriftView shareView] removeFromSuperview];
[[QXRedPacketDriftView shareView].dataArray removeAllObjects];
[QXRedPacketDriftView shareView].isPlaying = NO;
}
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(AVPlayer *)player{
if (!_player) {
NSString *path = [[NSBundle mainBundle] pathForResource:@"red_packet_come" ofType:@"mp3"];
_player = [[AVPlayer alloc] initWithURL:[NSURL fileURLWithPath:path]];
}
return _player;
}
@end
@implementation QXRedPacketDriftModel
@end

View File

@@ -368,6 +368,7 @@
hud.bezelView.color = [UIColor blackColor];
hud.label.textColor = [UIColor whiteColor];
hud.label.text = text;
hud.label.numberOfLines = 0;
[hud hideAnimated:YES afterDelay:1];
}
+(void)showMessage:(NSString *)text view:(UIView *)view{
@@ -378,6 +379,7 @@
hud.bezelView.color = [UIColor blackColor];
hud.label.textColor = [UIColor whiteColor];
hud.label.text = text;
hud.label.numberOfLines = 0;
[hud hideAnimated:YES afterDelay:1];
}
+(void)showLoadingInView:(UIView*)view{

View File

@@ -19,7 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface QXMeetActivityResultCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *giftBgImageView;
@property (nonatomic,strong)UIImageView *giftImageView;
@property (nonatomic,strong)UIImageView *giftInfoImageView;
@property (nonatomic,strong)UILabel *giftNameLabel;
@property (nonatomic,strong)UIButton *giftCoin;
@property (nonatomic,strong)QXDrawGiftModel *model;
@end

View File

@@ -37,6 +37,8 @@
make.centerY.equalTo(self);
}];
// @2x
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_meet_draw_result_bg"]];
[self.bgView addSubview:self.bgImageView];
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -93,10 +95,10 @@
-(UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 20;
layout.minimumLineSpacing = 15;
layout.minimumInteritemSpacing = 20;
layout.sectionInset = UIEdgeInsetsMake(0, 12, 0, 12);
layout.itemSize = CGSizeMake((331-12*2-20*2)/3,100);
layout.itemSize = CGSizeMake((331-12*2-20*2)/3,115);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.delegate = self;
_collectionView.dataSource = self;
@@ -149,9 +151,10 @@
_model = model;
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]];
self.giftNameLabel.text = [NSString stringWithFormat:@"%@x%@",model.gift_name,model.count];
[self.giftCoin setTitle:model.gift_price forState:(UIControlStateNormal)];
}
-(void)initSubviews{
self.giftBgImageView = [[UIImageView alloc] init];
self.giftBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_gif_box_bg"]];
[self.contentView addSubview:self.giftBgImageView];
[self.giftBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(self.contentView);
@@ -161,7 +164,16 @@
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.contentView addSubview:self.giftImageView];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.giftBgImageView);
make.width.height.mas_equalTo(50);
make.centerX.centerY.equalTo(self.giftBgImageView);
}];
self.giftInfoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ac_gift_info_bg"]];
[self.contentView addSubview:self.giftInfoImageView];
[self.giftInfoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.height.mas_equalTo(30);
make.bottom.equalTo(self.contentView);
}];
self.giftNameLabel = [[UILabel alloc] init];
@@ -171,9 +183,20 @@
self.giftNameLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
[self.contentView addSubview:self.giftNameLabel];
[self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentView);
make.top.equalTo(self.giftBgImageView.mas_bottom);
make.left.right.equalTo(self.contentView);
}];
self.giftCoin = [[UIButton alloc] init];
[self.giftCoin setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
self.giftCoin.titleLabel.font = [UIFont systemFontOfSize:10];
[self.giftCoin setImage:[UIImage imageNamed:@"sky_item_coin"] forState:(UIControlStateNormal)];
[self.contentView addSubview:self.giftCoin];
[self.giftCoin mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.giftNameLabel.mas_bottom);
make.centerX.equalTo(self.contentView);
}];
}
@end

View File

@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h>
#import "QXTimer.h"
#import "GKCycleScrollView.h"
#import "QXMeetActivityDriftView.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger) {
/// 抽一次
@@ -35,7 +36,7 @@ typedef NS_ENUM(NSInteger) {
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)QXGiftModel *giftModel;
-(void)updateUserAndGiftInfoWithModel:(QXRoomChatListModel*)model;
-(void)updateUserAndGiftInfoWithModel:(QXMeetActivityDriftModel*)model;
@end
@interface QXMeetTimeDownView :UIView

View File

@@ -452,7 +452,7 @@
}
-(void)updateUserAndGiftInfoWithModel:(QXRoomChatListModel *)model{
-(void)updateUserAndGiftInfoWithModel:(QXMeetActivityDriftModel *)model{
if (self.model.xlh_user == nil) {
QXUserModel *xlh_user = [[QXUserModel alloc] init];
self.model.xlh_user = xlh_user;
@@ -461,6 +461,7 @@
self.model.xlh_user.avatar = model.FromUserInfo.avatar;
self.model.locking_gift.gift_num = model.gift_num;
self.model.xlh_end_time = model.end_time;
self.model.homeowner_user = model.room_user;
[self configData];
}
-(void)configData{

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB