diff --git a/QXLive.xcodeproj/project.pbxproj b/QXLive.xcodeproj/project.pbxproj
index 689b33e..6a26800 100644
--- a/QXLive.xcodeproj/project.pbxproj
+++ b/QXLive.xcodeproj/project.pbxproj
@@ -787,7 +787,7 @@
"$(inherited)",
"$(SDKROOT)/usr/lib/swift",
);
- MARKETING_VERSION = 1.0.7;
+ MARKETING_VERSION = 1.0.8;
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.7;
+ MARKETING_VERSION = 1.0.8;
PRODUCT_BUNDLE_IDENTIFIER = com.xscm.midi;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
diff --git a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 6665e27..6879182 100644
--- a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -218,28 +218,12 @@
filePath = "QXLive/Base/QXGlobal.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "237"
- endingLineNumber = "237"
+ startingLineNumber = "238"
+ endingLineNumber = "238"
landmarkName = "-joinRoomWithRoomId:isRejoin:navagationController:"
landmarkType = "7">
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/QXLive/Base/QXGlobal.m b/QXLive/Base/QXGlobal.m
index b8bbbcc..bf95caf 100644
--- a/QXLive/Base/QXGlobal.m
+++ b/QXLive/Base/QXGlobal.m
@@ -20,6 +20,7 @@
#import "QXTimer.h"
#import
#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];
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.h b/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.h
index 364e2e3..eac9ddd 100644
--- a/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.h
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.h
@@ -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
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.m b/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.m
index 4267ab1..6af4e5b 100644
--- a/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.m
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.m
@@ -6,6 +6,7 @@
//
#import "QXRedBagRecordViewController.h"
+#import "QXMineNetwork.h"
@class QXRedBagRecordCell;
@interface QXRedBagRecordViewController ()
@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,@"金币"];
+ }else{
+ weakSelf.bottomLabel.text = @"已存入钻石";
+ coinStr = [NSString stringWithFormat:@"%@%@",model.my_record.amount,@"钻石"];
+ }
+ NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:coinStr];
+ [attr yy_setFont:[UIFont boldSystemFontOfSize:46] range:[coinStr rangeOfString:[NSString stringWithFormat:@"%@",model.my_record.amount]]];
+ 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];
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.h b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.h
new file mode 100644
index 0000000..e2b760a
--- /dev/null
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.h
@@ -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
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.m b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.m
new file mode 100644
index 0000000..d63e17d
--- /dev/null
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.m
@@ -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
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Friend.m b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Friend.m
index 8f8f118..6ef8f7f 100644
--- a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Friend.m
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Friend.m
@@ -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
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m
index 6380b2c..015eb31 100644
--- a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m
@@ -9,27 +9,95 @@
#import "QXMineNetwork.h"
@implementation QXRoomViewController (RedPacket)
-(void)recievedRedPacket:(QXRedPacketModel *)model{
+ self.redBagTagView.hidden = NO;
[[QXRedPacketManager sharedManager] addRedPacket:model];
}
-(void)initRedpacketManager{
[QXRedPacketManager sharedManager].delegate = self;
+ [[QXRedPacketManager sharedManager] startCheckTimer];
+ // 获取红包列表
+ [self getRedBagList];
}
-(void)getRedBagList{
-// [QXMineNetwork ];
+ MJWeakSelf
+ [QXMineNetwork getRedpacketListWithRoomId:self.roomId successBlock:^(NSArray * _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{
-
-}
-/// 更新红包回调
-- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId {
-
+-(void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket remainingCount:(NSInteger)remainingCount{
+ self.redBagTagView.count = [NSString stringWithFormat:@"%ld",remainingCount];
}
/// 移除红包回调
-- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket {
-
+- (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 *)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) {
+ /// 需要满足收藏再倒计时
+ self.redbagDrawView.needTime = time;
+ }
+ }else{
+ 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) {
+ /// 需要满足收藏再倒计时
+ self.redbagDrawView.needTime = time;
+ }
+ }else{
+ self.redbagDrawView.needTime = time;
+ }
+ }
+ }
+ }
+
+ /// 红包列表的倒计时
+ if (self.redbagListView.dataArray.count > 0) {
+ NSInteger index = [self.redbagListView.dataArray indexOfObject:redPacket];
+ [self.redbagListView updateRedpacketTimeWithIndex:index time:time];
+
+ }
+}
+
+
+
@end
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.h b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.h
index e973343..0417ecf 100644
--- a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.h
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.h
@@ -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
@@ -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;
diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m
index dfa0986..681ce9b 100644
--- a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m
+++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m
@@ -31,10 +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,
@@ -82,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
@@ -137,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"];
@@ -1376,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];
}
}
@@ -1496,6 +1495,7 @@ QXRoomUserInfoViewDelegate
break;
case QXRoomSettingTypeSendRedBag:{
QXRedBagSendView *redbagView = [[QXRedBagSendView alloc] init];
+ redbagView.room_id = self.roomId;
[redbagView showInView:self.view];
}
break;
@@ -1929,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];
+ }
}
};
}
@@ -1946,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;
}
@@ -1957,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];
+ }
};
}
diff --git a/QXLive/HomePage(声播)/Model/QXRedPacketModel.h b/QXLive/HomePage(声播)/Model/QXRedPacketModel.h
index 0c0f4ec..dc520f9 100644
--- a/QXLive/HomePage(声播)/Model/QXRedPacketModel.h
+++ b/QXLive/HomePage(声播)/Model/QXRedPacketModel.h
@@ -8,22 +8,77 @@
#import
NS_ASSUME_NONNULL_BEGIN
-
+@class QXDrawRedpacketRecordModel,QXRedpacketStatisticsModel;
@interface QXRedPacketModel : NSObject
-@property (nonatomic, strong) NSString *redpacket_id; // 红包唯一ID
+/// 红包唯一ID
+@property (nonatomic, strong) NSString *redpacket_id;
+/// 口令
+@property (nonatomic, strong) NSString *password;
+/// 倒计时 截止时间 为0时是立刻
+@property (nonatomic, strong) NSString *countdown;
+/// 红包总金额
@property (nonatomic, strong) NSString* total_amount;
-@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* 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* 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
diff --git a/QXLive/HomePage(声播)/Model/QXRedPacketModel.m b/QXLive/HomePage(声播)/Model/QXRedPacketModel.m
index 4d6680a..0381e7d 100644
--- a/QXLive/HomePage(声播)/Model/QXRedPacketModel.m
+++ b/QXLive/HomePage(声播)/Model/QXRedPacketModel.m
@@ -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 *)modelContainerPropertyGenericClass{
+ return @{
+ @"redpacket_info": @"QXRedPacketModel",
+ @"my_record": @"QXDrawRedpacketRecordModel",
+ @"records": @"QXDrawRedpacketRecordModel",
+ };
+}
+@end
+
+@implementation QXDrawRedpacketRecordModel
+
+@end
+
+
diff --git a/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.h b/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.h
index b31fb28..7d46d0a 100644
--- a/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.h
+++ b/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.h
@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign)BOOL isCompere;
@property (nonatomic,weak)iddelegate;
-
+-(void)setRoomCollect:(BOOL)isCollect;
-(void)onlineNumberIsAdd:(BOOL)isAdd;
-(void)setOnlineNumber:(NSString*)onlineNumber;
@end
diff --git a/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.m b/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.m
index eacabd4..226bbaf 100644
--- a/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.m
+++ b/QXLive/HomePage(声播)/View/房间/QXRoomTitleView.m
@@ -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) {
}];
diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.h b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.h
index 850f63f..3b9cd62 100644
--- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.h
+++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.h
@@ -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
diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.m b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.m
index 694f991..01ff61f 100644
--- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.m
+++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.m
@@ -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,8 @@
@property (nonatomic,strong)UILabel *pwdTitleLable;
/// 抢红包必须在本房间内
@property (nonatomic,strong)UILabel *bottomLabel;
+@property (nonatomic,assign)QXRedBagDrawType drawType;
+
@end
@implementation QXRedBagDrawView
- (instancetype)init
@@ -42,6 +47,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 +55,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 +134,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 +174,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 +209,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 +241,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 +320,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,41 +358,59 @@
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
+ [QXMineNetwork drawRedpacketWithRedpacketId:self.redpacketModel.redpacket_id successBlock:^(NSString * _Nonnull code) {
+ if (code.intValue == 1) {
+ weakSelf.redpacketModel.is_qiang = @"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) {
+ 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];
@@ -336,7 +418,38 @@
[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 +461,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 +488,7 @@
self.timeLabel.text = @"收藏房间抢红包";
}
break;
- case QXRedBagDrawTypeTimeDown:
- case QXRedBagDrawTypePwdTimeDown:{
+ case QXRedBagDrawTypeTimeDown:{
self.timeLabel.text = @"00:00后开启红包";
}
break;
@@ -383,11 +496,6 @@
self.timeLabel.text = @"发送评论抢红包";
}
break;
-
- case QXRedBagDrawTypePwdCollect:{
- self.timeLabel.text = @"收藏房间抢红包";
- }
- break;
case QXRedBagDrawTypePwdAllTask:{
self.timeLabel.text = @"完成任务抢红包";
}
@@ -398,7 +506,7 @@
}
-(void)btnClick{
- if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypePwdCollect) {
+ if (self.type == QXRedBagDrawTypePwdSend || self.type == QXRedBagDrawTypeCollect) {
if (self.btnBlcok) {
self.btnBlcok(self.type);
}
diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.h b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.h
index b999546..9e0177c 100644
--- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.h
+++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.h
@@ -10,14 +10,20 @@
NS_ASSUME_NONNULL_BEGIN
@interface QXRedBagListView : UIView
-@property (nonatomic,strong)NSMutableArray *dataArray;
+@property (nonatomic,strong)NSArray *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
diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.m b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.m
index 355231e..5d7cf89 100644
--- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.m
+++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagListView.m
@@ -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 *)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);
}];
}
diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m
index ded8d81..bee09f7 100644
--- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m
+++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m
@@ -39,6 +39,8 @@
@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;
@@ -93,7 +95,7 @@
/// 无限制条件
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];
@@ -172,8 +174,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];
@@ -484,6 +498,7 @@
pwdTextField.textColor = RGB16(0x666666);
pwdTextField.textAlignment = NSTextAlignmentRight;
pwdTextField.returnKeyType = UIReturnKeyDone;
+ pwdTextField.keyboardType = UIKeyboardTypeNumberPad;
pwdTextField.placeholder = @"请输入红包金额";
self.moneyTextField = pwdTextField;
[topBgView addSubview:pwdTextField];
@@ -538,6 +553,7 @@
countTextField.textAlignment = NSTextAlignmentRight;
countTextField.returnKeyType = UIReturnKeyDone;
countTextField.placeholder = @"请输入红包数量";
+ countTextField.keyboardType = UIKeyboardTypeNumberPad;
self.countTextField = countTextField;
[countBgView addSubview:countTextField];
[countTextField mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -728,7 +744,6 @@
showToast(@"红包数量不能大于红包金额");
return;
}
- self.conditions = @"1";
[QXMineNetwork createRedpacketWithType:self.redBagType
password:self.pwdTextField.text
coin_type:self.redBagContentType
@@ -737,10 +752,12 @@
conditions:self.conditions
countdown:self.redBagTime
room_id:self.room_id
+ remark:self.remarkTextField.text
successBlock:^(NSDictionary * _Nonnull dict) {
-
+ showToast(@"发送成功");
+ [self hide];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
-
+ showToast(msg);
}];
}
@@ -823,6 +840,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) {
@@ -831,6 +849,7 @@
}];
self.diamondRedBagBtn.selected = YES;
self.redBagContentType = @"2";
+ self.moneyLabel.text = [NSString stringWithFormat:@"%@钻石可用",self.earnings];
}
}
-(void)drawAuthAction:(UIButton*)sender{
@@ -838,14 +857,12 @@
self.noDrawAuthBtn.selected = YES;
self.collectDrawAuthBtn.selected = NO;
self.upSeatDrawAuthBtn.selected = NO;
- self.conditions = @"0";
}else if (sender == self.collectDrawAuthBtn) {
self.collectDrawAuthBtn.selected = !self.collectDrawAuthBtn.selected;
if (self.upSeatDrawAuthBtn.selected || self.collectDrawAuthBtn.selected) {
self.noDrawAuthBtn.selected = NO;
}else{
self.noDrawAuthBtn.selected = YES;
- self.conditions = @"0";
}
}else if (sender == self.upSeatDrawAuthBtn) {
self.noDrawAuthBtn.selected = NO;
@@ -854,6 +871,17 @@
self.noDrawAuthBtn.selected = NO;
}else{
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";
}
}
diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagTagView.m b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagTagView.m
index 77ba093..b433769 100644
--- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagTagView.m
+++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagTagView.m
@@ -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{
diff --git a/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m b/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m
index 7be5a94..4a33d30 100644
--- a/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m
+++ b/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m
@@ -17,6 +17,7 @@
#import "QXGiftDriftView.h"
#import "QXMeetActivityDriftView.h"
#import "QXDrifRoomHourRankView.h"
+#import "QXRedPacketDriftView.h"
@interface QXRoomSettingView()
@property (nonatomic,strong)UIView *bgView;
@@ -680,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) {
diff --git a/QXLive/Manager/QXManagerMqtt.h b/QXLive/Manager/QXManagerMqtt.h
index 577782f..9a42e9f 100755
--- a/QXLive/Manager/QXManagerMqtt.h
+++ b/QXLive/Manager/QXManagerMqtt.h
@@ -9,9 +9,27 @@
#import "MQTTClient.h"
#import "MQTTSessionManager.h"
#import
+//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
diff --git a/QXLive/Manager/QXManagerMqtt.m b/QXLive/Manager/QXManagerMqtt.m
index 728f2cb..817a18a 100755
--- a/QXLive/Manager/QXManagerMqtt.m
+++ b/QXLive/Manager/QXManagerMqtt.m
@@ -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;
diff --git a/QXLive/Manager/QXRedPacketManager.h b/QXLive/Manager/QXRedPacketManager.h
index f17186d..491c39a 100644
--- a/QXLive/Manager/QXRedPacketManager.h
+++ b/QXLive/Manager/QXRedPacketManager.h
@@ -10,9 +10,16 @@
@class QXRedPacketManager;
@protocol QXRedPacketManagerDelegate
-- (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*)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
@@ -20,16 +27,24 @@
@property (nonatomic, weak) id delegate;
+ (instancetype)sharedManager;
-
+/// 批量添加红包
+- (void)addRedPackets:(NSArray*)redPackets;
/// 添加红包
- (void)addRedPacket:(QXRedPacketModel *)redPacket;
/// 移除红包
- (void)removeRedPacket:(NSString *)packetId;
/// 获取所有红包
- (NSArray *)allRedPackets;
-/// 根据位置获取红包
-- (QXRedPacketModel *)redPacketAtPosition:(NSInteger)position;
+/// 根据红包id获取红包
+- (QXRedPacketModel *)getRedPacket:(NSString *)packetId;
/// 检查并更新红包状态
- (void)checkAndUpdateRedPackets;
-
+/// 移除所有红包
+-(void)removeAllRedpackets;
+/// 开启定时器
+-(void)startCheckTimer;
+/// 销毁定时器
+-(void)endCheckTimer;
+/// 回收内存
+-(void)destoryRedpacketInfo;
@end
diff --git a/QXLive/Manager/QXRedPacketManager.m b/QXLive/Manager/QXRedPacketManager.m
index 02871cf..f75fbbe 100644
--- a/QXLive/Manager/QXRedPacketManager.m
+++ b/QXLive/Manager/QXRedPacketManager.m
@@ -27,26 +27,35 @@
self = [super init];
if (self) {
_redPackets = [NSMutableDictionary dictionary];
- [self startCheckTimer];
}
return self;
}
-
+-(void)addRedPackets:(NSArray *)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.redpacket_id) return;
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];
}
}
@@ -54,13 +63,8 @@
return [self.redPackets allValues];
}
-- (QXRedPacketModel *)redPacketAtPosition:(NSInteger)position {
- for (QXRedPacketModel *packet in self.redPackets.allValues) {
- if (packet.position == position) {
- return packet;
- }
- }
- return nil;
+-(QXRedPacketModel *)getRedPacket:(NSString *)packetId{
+ return [self.redPackets objectForKey:packetId];
}
- (void)startCheckTimer {
@@ -75,27 +79,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
diff --git a/QXLive/Manager/QXRoomMessageManager.m b/QXLive/Manager/QXRoomMessageManager.m
index 3bcd83a..e21f349 100644
--- a/QXLive/Manager/QXRoomMessageManager.m
+++ b/QXLive/Manager/QXRoomMessageManager.m
@@ -617,7 +617,7 @@
}
break;
case QXRoomMessageTypeSendRedpacket:{
- QXRedPacketModel *model = [QXRedPacketModel yy_modelWithJSON:msg.Text];
+ QXRedPacketModel *model = [QXRedPacketModel yy_modelWithJSON:msg.Text[@"redpacketInfo"]];
if (self.delegate && [self.delegate respondsToSelector:@selector(recievedRedPacket:)]) {
[self.delegate recievedRedPacket:model];
}
diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.h b/QXLive/Mine(音域)/Services/QXMineNetwork.h
index 345b8eb..4a6739b 100644
--- a/QXLive/Mine(音域)/Services/QXMineNetwork.h
+++ b/QXLive/Mine(音域)/Services/QXMineNetwork.h
@@ -23,6 +23,7 @@
#import "QXDayTaskModel.h"
#import "QXRoomUserCharmModel.h"
#import "QXRoomHourRankModel.h"
+#import "QXRedPacketModel.h"
NS_ASSUME_NONNULL_BEGIN
@@ -1097,12 +1098,43 @@ NS_ASSUME_NONNULL_BEGIN
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* list))successBlock
+ failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
-+(void)drawRedpacketWithRedpacketId:(NSString*)redpacketId;
+/**
+ 抢红包
+ 返回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
diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.m b/QXLive/Mine(音域)/Services/QXMineNetwork.m
index b4cd7a0..76c9f2e 100644
--- a/QXLive/Mine(音域)/Services/QXMineNetwork.m
+++ b/QXLive/Mine(音域)/Services/QXMineNetwork.m
@@ -2117,6 +2117,7 @@
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 =@{
@@ -2128,6 +2129,7 @@
@"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) {
@@ -2137,4 +2139,74 @@
failBlock(error,msg);
}];
}
+
++(void)getRedpacketListWithRoomId:(NSString *)roomId
+ successBlock:(void (^)(NSArray * _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
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/Contents.json b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/Contents.json
new file mode 100644
index 0000000..8ac2a68
--- /dev/null
+++ b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "red_bag_list_is_get_icon@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "red_bag_list_is_get_icon@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/red_bag_list_is_get_icon@2x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/red_bag_list_is_get_icon@2x.png
new file mode 100644
index 0000000..130240d
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/red_bag_list_is_get_icon@2x.png differ
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/red_bag_list_is_get_icon@3x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/red_bag_list_is_get_icon@3x.png
new file mode 100644
index 0000000..4fbd25c
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/red_bag_list_is_get_icon@3x.png differ
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/Contents.json b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/Contents.json
new file mode 100644
index 0000000..e32567d
--- /dev/null
+++ b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/Contents.json
@@ -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
+ }
+}
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/red_bag_list_pwd_icon@2x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/red_bag_list_pwd_icon@2x.png
new file mode 100644
index 0000000..28d204b
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/red_bag_list_pwd_icon@2x.png differ
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/red_bag_list_pwd_icon@3x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/red_bag_list_pwd_icon@3x.png
new file mode 100644
index 0000000..ca82988
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/red_bag_list_pwd_icon@3x.png differ
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/Contents.json b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/Contents.json
new file mode 100644
index 0000000..cbbe777
--- /dev/null
+++ b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/Contents.json
@@ -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
+ }
+}
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/red_packet_pop_bg@2x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/red_packet_pop_bg@2x.png
new file mode 100644
index 0000000..9a4677a
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/red_packet_pop_bg@2x.png differ
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/Contents.json b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/Contents.json
new file mode 100644
index 0000000..7fda007
--- /dev/null
+++ b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/Contents.json
@@ -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
+ }
+}
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/red_packet_pwd_icon@2x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/red_packet_pwd_icon@2x.png
new file mode 100644
index 0000000..4ebf5c1
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/red_packet_pwd_icon@2x.png differ
diff --git a/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/red_packet_pwd_icon@3x.png b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/red_packet_pwd_icon@3x.png
new file mode 100644
index 0000000..8623b35
Binary files /dev/null and b/QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/red_packet_pwd_icon@3x.png differ
diff --git a/QXLive/Other/NoitceAndKey.h b/QXLive/Other/NoitceAndKey.h
index e6a31c6..878ec8e 100644
--- a/QXLive/Other/NoitceAndKey.h
+++ b/QXLive/Other/NoitceAndKey.h
@@ -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";
diff --git a/QXLive/Other/QXApi.h b/QXLive/Other/QXApi.h
index 64e9f1d..8984af0 100644
--- a/QXLive/Other/QXApi.h
+++ b/QXLive/Other/QXApi.h
@@ -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";
diff --git a/QXLive/Other/sound/red_packet_come.mp3 b/QXLive/Other/sound/red_packet_come.mp3
new file mode 100644
index 0000000..88db62d
Binary files /dev/null and b/QXLive/Other/sound/red_packet_come.mp3 differ
diff --git a/QXLive/Tabbar/QXTabbarController.m b/QXLive/Tabbar/QXTabbarController.m
index 220c3ac..cdebbc1 100644
--- a/QXLive/Tabbar/QXTabbarController.m
+++ b/QXLive/Tabbar/QXTabbarController.m
@@ -25,6 +25,7 @@
//#import "QXFirstRechargePopView.h" // 首充
#import "QXInvitePopView.h" // 邀请
#import "QXGiftDriftView.h" // 礼物飘屏
+#import "QXRedPacketDriftView.h" // 红包飘屏
#import
#import "QXMessageServices.h"
@@ -267,34 +268,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{
diff --git a/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m b/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m
index dc727cf..1c9cfa4 100644
--- a/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m
+++ b/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m
@@ -122,7 +122,7 @@
UIImage *thirdDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)];
[self.thirdBtn setBackgroundImage:thirdNorImage forState:(UIControlStateNormal)];
[self.thirdBtn setBackgroundImage:thirdSelImage forState:(UIControlStateSelected)];
- [self.thirdBtn setBackgroundImage:thirdDisImage 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)];
diff --git a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h
index ee71df8..2aefc7d 100644
--- a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h
+++ b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h
@@ -6,14 +6,22 @@
//
#import
+#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
diff --git a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m
index 695764a..272bcd5 100644
--- a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m
+++ b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m
@@ -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 *)modelContainerPropertyGenericClass{
+ return @{
+ @"xlh_data" : @"QXXLHModel",
+ @"room_user":@"QXUserModel",
+ @"FromUserInfo":@"QXUserModel",
+ };
+}
@end
diff --git a/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h
new file mode 100644
index 0000000..4bb11f4
--- /dev/null
+++ b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h
@@ -0,0 +1,29 @@
+//
+// QXRedPacketDriftView.h
+// QXLive
+//
+// Created by 启星 on 2025/10/15.
+//
+
+#import
+
+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
diff --git a/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m
new file mode 100644
index 0000000..777d020
--- /dev/null
+++ b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m
@@ -0,0 +1,148 @@
+//
+// QXRedPacketDriftView.m
+// QXLive
+//
+// Created by 启星 on 2025/8/29.
+//
+
+#import "QXRedPacketDriftView.h"
+#import
+@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
diff --git a/QXLive/活动/巡乐会/QXMeetActivityView.h b/QXLive/活动/巡乐会/QXMeetActivityView.h
index 50c3ec7..3b0d0f1 100644
--- a/QXLive/活动/巡乐会/QXMeetActivityView.h
+++ b/QXLive/活动/巡乐会/QXMeetActivityView.h
@@ -8,6 +8,7 @@
#import
#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
diff --git a/QXLive/活动/巡乐会/QXMeetActivityView.m b/QXLive/活动/巡乐会/QXMeetActivityView.m
index d6c5708..96c0d42 100644
--- a/QXLive/活动/巡乐会/QXMeetActivityView.m
+++ b/QXLive/活动/巡乐会/QXMeetActivityView.m
@@ -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;