提交
@@ -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 = "";
|
||||
|
||||
@@ -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">
|
||||
</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
|
||||
@@ -254,6 +238,36 @@
|
||||
endingLineNumber = "298"
|
||||
landmarkName = "-popFirstRechargeView"
|
||||
landmarkType = "7">
|
||||
<Locations>
|
||||
<Location
|
||||
uuid = "5BF5F01C-DE88-4830-9FC7-B13A8F8D8F06 - 71eef07c41d64efd"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "__44-[QXHomeViewController popFirstRechargeView]_block_invoke_3"
|
||||
moduleName = "QXLiveDev.debug.dylib"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/qixing/Desktop/%E9%A1%B9%E7%9B%AE/%E7%A7%98%E5%9C%B0/midi_ios/QXLive/HomePage(%E5%A3%B0%E6%92%AD)/Controlller/QXHomeViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "298"
|
||||
endingLineNumber = "298">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "5BF5F01C-DE88-4830-9FC7-B13A8F8D8F06 - 71eef07cc1d64edf"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "__44-[QXHomeViewController popFirstRechargeView]_block_invoke_4"
|
||||
moduleName = "QXLiveDev.debug.dylib"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/qixing/Desktop/%E9%A1%B9%E7%9B%AE/%E7%A7%98%E5%9C%B0/midi_ios/QXLive/HomePage(%E5%A3%B0%E6%92%AD)/Controlller/QXHomeViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "299"
|
||||
endingLineNumber = "299">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
@@ -270,22 +284,36 @@
|
||||
endingLineNumber = "265"
|
||||
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(声播)/View/房间/QXRoomBottomView.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "359"
|
||||
endingLineNumber = "359"
|
||||
landmarkName = "-didClickSendWithText:model:"
|
||||
landmarkType = "7">
|
||||
<Locations>
|
||||
<Location
|
||||
uuid = "1FB8A90B-0933-4146-A9F1-F32431D2942C - 8acade40333993db"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "__39-[QXHomeViewController popNiceGiftView]_block_invoke_3"
|
||||
moduleName = "QXLiveDev.debug.dylib"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/qixing/Desktop/%E9%A1%B9%E7%9B%AE/%E7%A7%98%E5%9C%B0/midi_ios/QXLive/HomePage(%E5%A3%B0%E6%92%AD)/Controlller/QXHomeViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "265"
|
||||
endingLineNumber = "265">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "1FB8A90B-0933-4146-A9F1-F32431D2942C - 8acade403f3993fd"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "__39-[QXHomeViewController popNiceGiftView]_block_invoke_4"
|
||||
moduleName = "QXLiveDev.debug.dylib"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/qixing/Desktop/%E9%A1%B9%E7%9B%AE/%E7%A7%98%E5%9C%B0/midi_ios/QXLive/HomePage(%E5%A3%B0%E6%92%AD)/Controlller/QXHomeViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "266"
|
||||
endingLineNumber = "266">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
@@ -320,5 +348,85 @@
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "DA284C6C-4417-4FFD-871F-4A59CA6815DC"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "1980"
|
||||
endingLineNumber = "1980"
|
||||
landmarkName = "-redbagListView"
|
||||
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(声播)/View/房间/QXRoomTitleView.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "349"
|
||||
endingLineNumber = "349"
|
||||
landmarkName = "-setRoomCollect:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "2A513923-59DB-438C-81B3-BD7923707E58"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "422"
|
||||
endingLineNumber = "422"
|
||||
landmarkName = "-getDrawTypeWithRedpacktModel:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "34A425ED-76FC-4472-A395-4DCB55F65DC5"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "QXLive/HomePage(声播)/View/房间/红包/QXRedBagDrawView.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "302"
|
||||
endingLineNumber = "302"
|
||||
landmarkName = "-setType:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "30ACBD08-103B-42D6-8392-7F9E56851DC4"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+Activity.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "19"
|
||||
endingLineNumber = "19"
|
||||
landmarkName = "-updateProgress:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,@"金币"];
|
||||
}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];
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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<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{
|
||||
|
||||
}
|
||||
/// 更新红包回调
|
||||
- (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<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) {
|
||||
/// 需要满足收藏再倒计时
|
||||
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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -8,22 +8,77 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
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<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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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;
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -10,9 +10,16 @@
|
||||
|
||||
@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
|
||||
@@ -20,16 +27,24 @@
|
||||
@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
|
||||
|
||||
@@ -27,26 +27,35 @@
|
||||
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.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
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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<QXRedPacketModel*>* 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
|
||||
|
||||
|
||||
|
||||
@@ -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<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
|
||||
|
||||
22
QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_is_get_icon.imageset/Contents.json
vendored
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 47 KiB |
22
QXLive/Other/Assets.xcassets/home/room/a_redbag/red_bag_list_pwd_icon.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
21
QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
||||
BIN
QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pop_bg.imageset/red_packet_pop_bg@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 220 KiB |
22
QXLive/Other/Assets.xcassets/home/room/a_redbag/red_packet_pwd_icon.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
BIN
QXLive/Other/sound/red_packet_come.mp3
Normal 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"
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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)];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
29
QXLive/Tabbar/飘屏/QXRedPacketDriftView.h
Normal 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
|
||||
148
QXLive/Tabbar/飘屏/QXRedPacketDriftView.m
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||