diff --git a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 93d27fb..6665e27 100644 --- a/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/QXLive.xcworkspace/xcuserdata/qixing.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -243,32 +243,80 @@ + + + + + + + + + + + + diff --git a/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.h b/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.h index 065c2da..bc83e9c 100644 --- a/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.h +++ b/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.h @@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN -(void)didClickSendWithText:(NSString*)text model:(QXDynamicCommentListModel*)model; +-(void)didResignFirstResponder; + @end @interface QXDynamicCommentInputView : UIView diff --git a/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.m b/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.m index 9e795da..940b309 100644 --- a/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.m +++ b/QXLive/Dynamic(语圈)/View/详情/QXDynamicCommentInputView.m @@ -98,6 +98,11 @@ [textField resignFirstResponder]; return YES; } +-(void)textFieldDidEndEditing:(UITextField *)textField{ + if (self.delegate && [self.delegate respondsToSelector:@selector(didResignFirstResponder)]) { + [self.delegate didResignFirstResponder]; + } +} -(void)setModel:(QXDynamicCommentListModel *)model{ _model = model; } diff --git a/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m b/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m index 57d7bd3..d667aba 100644 --- a/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m +++ b/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m @@ -133,7 +133,7 @@ // make.width.height.mas_equalTo(ScaleWidth(57)); // }]; [self getBanner]; -// [self getRechargePermission]; + [self getRechargePermission]; self.appStoreView.hidden = YES; [self.view addSubview:self.appStoreView]; @@ -233,7 +233,7 @@ }]; }; - self.nPeopleRechargeView.rechargeActionBlock = ^(NSString * _Nonnull money) { + self.nPeopleRechargeView.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) { [[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{ QXLOG(@"页面关闭"); QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; @@ -241,6 +241,7 @@ model.money = money; recharge.selectedModel = model; recharge.isPop = YES; + recharge.gift_bag_id = gift_bag_id; recharge.isOnlyDisplayPayType = YES; [recharge showInView:KEYWINDOW]; }]; @@ -260,9 +261,17 @@ }]; }; - view.getActionBlock = ^{ + view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) { [[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{ QXLOG(@"页面关闭"); + QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; + QXRechargeListModel *model = [[QXRechargeListModel alloc] init]; + model.money = money; + recharge.selectedModel = model; + recharge.isPop = YES; + recharge.gift_bag_id = gift_bag_id; + recharge.isOnlyDisplayPayType = YES; + [recharge showInView:KEYWINDOW]; }]; }; @@ -285,9 +294,17 @@ }]; }; - view.getActionBlock = ^{ + view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) { [[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{ QXLOG(@"页面关闭"); + QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; + QXRechargeListModel *model = [[QXRechargeListModel alloc] init]; + model.money = money; + recharge.selectedModel = model; + recharge.isPop = YES; + recharge.gift_bag_id = gift_bag_id; + recharge.isOnlyDisplayPayType = YES; + [recharge showInView:KEYWINDOW]; }]; }; diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.h b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.h new file mode 100644 index 0000000..e114f24 --- /dev/null +++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.h @@ -0,0 +1,16 @@ +// +// QXRoomViewController+RedPacket.h +// QXLive +// +// Created by 启星 on 2025/10/13. +// + +#import "QXRoomViewController.h" +#import "QXRedPacketManager.h" +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomViewController (RedPacket) +-(void)initRedpacketManager; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m new file mode 100644 index 0000000..6380b2c --- /dev/null +++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController+RedPacket.m @@ -0,0 +1,35 @@ +// +// QXRoomViewController+RedPacket.m +// QXLive +// +// Created by 启星 on 2025/10/13. +// + +#import "QXRoomViewController+RedPacket.h" +#import "QXMineNetwork.h" +@implementation QXRoomViewController (RedPacket) +-(void)recievedRedPacket:(QXRedPacketModel *)model{ + [[QXRedPacketManager sharedManager] addRedPacket:model]; +} +-(void)initRedpacketManager{ + [QXRedPacketManager sharedManager].delegate = self; +} + +-(void)getRedBagList{ +// [QXMineNetwork ]; +} +#pragma mark - QXRedPacketManagerDelegate +/// 添加红包成功 +-(void)QXRedPacketManager:(QXRedPacketManager *)manager didAddRedPacket:(QXRedPacketModel *)redPacket{ + +} +/// 更新红包回调 +- (void)QXRedPacketManager:(QXRedPacketManager *)manager didRemoveRedPacket:(NSString *)packetId { + +} +/// 移除红包回调 +- (void)QXRedPacketManager:(QXRedPacketManager *)manager didUpdateRedPacket:(QXRedPacketModel *)redPacket { + +} + +@end diff --git a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m index b84c7b0..dfa0986 100644 --- a/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m +++ b/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m @@ -34,6 +34,7 @@ #import "QXRedBagTagView.h" #import "QXRedBagDrawView.h" #import "QXRedBagListView.h" +#import "QXRoomViewController+RedPacket.h" @interface QXRoomViewController ()< QXRoomBottomViewDelegate, @@ -92,7 +93,7 @@ QXRoomUserInfoViewDelegate - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - + [self initRedpacketManager]; } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; @@ -211,7 +212,7 @@ QXRoomUserInfoViewDelegate } [self.view addSubview:self.hourRankIconView]; -// [self.view addSubview:self.redBagTagView]; + [self.view addSubview:self.redBagTagView]; [self setupEffectView]; // [self.view addSubview:self.headlineView]; diff --git a/QXLive/HomePage(声播)/Model/QXNiceGiftRechargeModel.h b/QXLive/HomePage(声播)/Model/QXNiceGiftRechargeModel.h index f590779..15cc1a8 100644 --- a/QXLive/HomePage(声播)/Model/QXNiceGiftRechargeModel.h +++ b/QXLive/HomePage(声播)/Model/QXNiceGiftRechargeModel.h @@ -15,6 +15,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *name; /// 礼包名称 @property (nonatomic,strong)NSString *bag_name; +/// 礼包名称 +@property (nonatomic,strong)NSString *gift_bag_id; + +/// 1 可以充值 0 不可充值 +@property (nonatomic,strong)NSString *status; @property (nonatomic,strong)NSString *title1; @@ -47,5 +52,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *time; /// 礼物列表 @property (nonatomic,strong)NSArray *gift_list; +/// 礼包id +@property (nonatomic,strong)NSString *gift_bag_id; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/HomePage(声播)/Model/QXRedPacketModel.h b/QXLive/HomePage(声播)/Model/QXRedPacketModel.h index 33b3044..0c0f4ec 100644 --- a/QXLive/HomePage(声播)/Model/QXRedPacketModel.h +++ b/QXLive/HomePage(声播)/Model/QXRedPacketModel.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface QXRedPacketModel : NSObject -@property (nonatomic, copy) NSString *packetId; // 红包唯一ID +@property (nonatomic, strong) NSString *redpacket_id; // 红包唯一ID +@property (nonatomic, strong) NSString* total_amount; @property (nonatomic, assign) NSInteger type; // 红包类型 @property (nonatomic, assign) long long end_time; // 倒计时时间(秒) @property (nonatomic, assign) CGFloat amount; // 红包金额 @@ -24,4 +25,5 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)canOpenNow; @end + NS_ASSUME_NONNULL_END diff --git a/QXLive/HomePage(声播)/View/房间/QXRoomBottomView.m b/QXLive/HomePage(声播)/View/房间/QXRoomBottomView.m index 7559b6a..537572c 100644 --- a/QXLive/HomePage(声播)/View/房间/QXRoomBottomView.m +++ b/QXLive/HomePage(声播)/View/房间/QXRoomBottomView.m @@ -364,14 +364,15 @@ [[QXGlobal shareGlobal] finishTask]; [[QXRoomMessageManager shared] sendChatMessage:text messageType:(QXRoomMessageTypeText) needInsertMessage:YES]; self.commentView.textField.text = @""; - [self.vc.view endEditing:YES]; + if (self.redpacketModel == nil) { + [self.vc.view endEditing:YES]; return; } if (self.delegate && [self.delegate respondsToSelector:@selector(didSendMessage:redpacketModel:)]) { [self.delegate didSendMessage:text redpacketModel:self.redpacketModel]; } - self.redpacketModel = nil; + [self.vc.view endEditing:YES]; } - (void)keyboardWillHide:(NSNotification *)notification { @@ -395,7 +396,9 @@ self.commentView.y = keyboardFrame.origin.y-TabbarContentHeight; }]; } - +-(void)didResignFirstResponder{ + self.redpacketModel = nil; +} -(QXDynamicCommentInputView *)commentView{ if (!_commentView) { _commentView = [[QXDynamicCommentInputView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, TabbarContentHeight)]; diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.h b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.h index 42d83de..e5b0cf3 100644 --- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.h +++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.h @@ -10,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN @interface QXRedBagSendView : UIView +@property (nonatomic,strong)NSString *room_id; -(void)showInView:(UIView*)view; -(void)hide; @end diff --git a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m index c56ff15..ded8d81 100644 --- a/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m +++ b/QXLive/HomePage(声播)/View/房间/红包/QXRedBagSendView.m @@ -7,6 +7,7 @@ #import "QXRedBagSendView.h" #import +#import "QXMineNetwork.h" @interface QXRedBagSendView() @property (nonatomic,strong)UIView *bgView; @property (nonatomic,strong)UIImageView *bgImageView; @@ -36,7 +37,8 @@ @property (nonatomic,strong)NSString *redBagContentType; /// 红包倒计时 @property (nonatomic,strong)NSString *redBagTime; - +/// 条件 0 无 1 收藏房间 2 仅麦上用户 多条件时用,隔开 +@property (nonatomic,strong)NSString *conditions; @property (nonatomic,strong)UIView* nextContentView; @@ -82,9 +84,14 @@ } -(void)initSubviews{ + /// 默认普通红包 self.redBagType = @"1"; + /// 默认金币红包 self.redBagContentType = @"1"; + /// 默认立刻 self.redBagTime = @"0"; + /// 无限制条件 + self.conditions = @"0"; self.timeArray = @[@0,@1,@2,@5,@10]; self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-345)/2, (SCREEN_HEIGHT-454)/2, 345, 454)]; @@ -680,6 +687,12 @@ #pragma mark - action -(void)nextAction{ + if (self.redBagType.intValue == 2) { + if (![self.pwdTextField.text isExist]) { + showToast(@"请输入口令"); + return; + } + } self.currentPage = 1; if (self.redBagContentType.intValue == 1) { self.moneyUnitLabel.text = @"金币"; @@ -703,7 +716,32 @@ }]; } -(void)commitAction{ - + if (![self.moneyTextField.text isExist]) { + showToast(@"请输入红包金额"); + return; + } + if (![self.countTextField.text isExist]) { + showToast(@"请输入红包数量"); + return; + } + if (self.countTextField.text.longLongValue > self.moneyTextField.text.longLongValue) { + showToast(@"红包数量不能大于红包金额"); + return; + } + self.conditions = @"1"; + [QXMineNetwork createRedpacketWithType:self.redBagType + password:self.pwdTextField.text + coin_type:self.redBagContentType + total_amount:self.moneyTextField.text + total_count:self.countTextField.text + conditions:self.conditions + countdown:self.redBagTime + room_id:self.room_id + successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; } -(void)helpAction{ @@ -761,6 +799,7 @@ make.top.equalTo(self.firstTopView.mas_bottom).offset(12); }]; self.redBagType = @"1"; + self.pwdTextField.text = @""; }else{ self.pwdRedBagBtn.selected = YES; self.normalRedBagBtn.selected = NO; @@ -799,12 +838,14 @@ 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; @@ -813,6 +854,7 @@ self.noDrawAuthBtn.selected = NO; }else{ self.noDrawAuthBtn.selected = YES; + self.conditions = @"0"; } } } diff --git a/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m b/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m index 696f73a..7be5a94 100644 --- a/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m +++ b/QXLive/HomePage(声播)/View/房间/设置/QXRoomSettingView.m @@ -178,19 +178,13 @@ /// 暂时不需要房间补贴 toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage]; roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend]; -// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; - moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; -// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend]; -// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport]; + moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; }else{ // toolsArr = @[self.roomSubsidy,self.roomMessage,self.roomOrderMic,self.roomBgMusic,self.roomBgImage]; /// 暂时不需要房间补贴 toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage]; roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend]; -// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; - moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; -// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend]; -// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport]; + moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; } self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")]; @@ -200,8 +194,7 @@ // 观众 更多操作 不区分麦上麦下 roomTypeArr = @[]; toolsArr = @[]; -// moreArr = @[self.redBag,self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport]; - moreArr = @[self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport]; + moreArr = @[self.redBag,self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport]; self.titles = @[QXText(@"更多操作")]; } break; @@ -223,9 +216,7 @@ toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage]; } roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend]; -// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; - moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; -// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport]; + moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; // roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend]; self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")]; } @@ -249,9 +240,7 @@ } // roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend]; roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend]; -// moreArr = @[self.roomLeave,self.roomShare,self.roomVoiceSet,self.roomSetting,self.roomWelcome,self.roomEffects,self.roomReport]; -// moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; - moreArr = @[self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; + moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")]; } break; diff --git a/QXLive/Manager/QXAgoraEngine.m b/QXLive/Manager/QXAgoraEngine.m index b51ae04..15c9e66 100755 --- a/QXLive/Manager/QXAgoraEngine.m +++ b/QXLive/Manager/QXAgoraEngine.m @@ -56,7 +56,6 @@ [self.agoraKit getCurrentMonotonicTimeInMs]; [self.agoraKit setAudioProfile:AgoraAudioProfileMusicHighQualityStereo]; [self.agoraKit setAudioScenario:AgoraAudioScenarioChorus]; - [self setChannelProfile]; self.agoraKit.delegate = self; [self.agoraKit setParameters:@"{\"che.audio.custom_payload_type\":73}"]; @@ -368,6 +367,9 @@ if (self.delegate && [self.delegate respondsToSelector:@selector(rtcEngineVideoFirstLoadWithUid:size:)]) { [self.delegate rtcEngineVideoFirstLoadWithUid:uid size:size]; } +} +-(void)rtcEngine:(AgoraRtcEngineKit *)engine videoSizeChangedOfSourceType:(AgoraVideoSourceType)sourceType uid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation{ + } -(void)rtcEngine:(AgoraRtcEngineKit *)engine remoteVideoStateChangedOfUid:(NSUInteger)uid state:(AgoraVideoRemoteState)state reason:(AgoraVideoRemoteReason)reason elapsed:(NSInteger)elapsed{ NSLog(@"uid=%ld---直播远端视频状态发生变化status=%ld",uid,state); @@ -742,6 +744,7 @@ videoParams.dimensions = [self screenShareVideoDimension]; videoParams.frameRate = AgoraVideoFrameRateFps15; videoParams.bitrate = AgoraVideoBitrateStandard; +// _screenParams.videoParams = videoParams; } return _screenParams; } diff --git a/QXLive/Manager/QXRedPacketManager.h b/QXLive/Manager/QXRedPacketManager.h index e13e1d0..f17186d 100644 --- a/QXLive/Manager/QXRedPacketManager.h +++ b/QXLive/Manager/QXRedPacketManager.h @@ -16,20 +16,20 @@ @end @interface QXRedPacketManager : NSObject - +@property (nonatomic, strong, readonly) NSMutableDictionary *redPackets; @property (nonatomic, weak) id delegate; + (instancetype)sharedManager; -// 添加红包 +/// 添加红包 - (void)addRedPacket:(QXRedPacketModel *)redPacket; -// 移除红包 +/// 移除红包 - (void)removeRedPacket:(NSString *)packetId; -// 获取所有红包 +/// 获取所有红包 - (NSArray *)allRedPackets; -// 根据位置获取红包 +/// 根据位置获取红包 - (QXRedPacketModel *)redPacketAtPosition:(NSInteger)position; -// 检查并更新红包状态 +/// 检查并更新红包状态 - (void)checkAndUpdateRedPackets; @end diff --git a/QXLive/Manager/QXRedPacketManager.m b/QXLive/Manager/QXRedPacketManager.m index 9abcb24..02871cf 100644 --- a/QXLive/Manager/QXRedPacketManager.m +++ b/QXLive/Manager/QXRedPacketManager.m @@ -33,9 +33,9 @@ } - (void)addRedPacket:(QXRedPacketModel *)redPacket { - if (!redPacket.packetId) return; + if (!redPacket.redpacket_id) return; - self.redPackets[redPacket.packetId] = redPacket; + self.redPackets[redPacket.redpacket_id] = redPacket; if ([self.delegate respondsToSelector:@selector(QXRedPacketManager:didAddRedPacket:)]) { [self.delegate respondsToSelector:@selector(QXRedPacketManager:didAddRedPacket:)]; diff --git a/QXLive/Manager/QXRoomMessageManager.h b/QXLive/Manager/QXRoomMessageManager.h index 27481a7..6d52876 100644 --- a/QXLive/Manager/QXRoomMessageManager.h +++ b/QXLive/Manager/QXRoomMessageManager.h @@ -9,6 +9,7 @@ #import "QXRoomChatListView.h" #import "QXRoomModel.h" #import "QXRoomFriendRelationModel.h" +#import "QXRedPacketModel.h" typedef NS_ENUM(NSInteger) { /// 清空消息 @@ -124,6 +125,9 @@ typedef NS_ENUM(NSInteger) { QXRoomMessageTypeRoomUserOnlineStatus = 1058, /// 清除个人魅力 QXRoomMessageTypeRoomClearUserCharm = 1059, + + /// 发红包 + QXRoomMessageTypeSendRedpacket = 1060, }QXRoomMessageType; NS_ASSUME_NONNULL_BEGIN @protocol QXRoomMessageManagerDelegate @@ -253,6 +257,9 @@ NS_ASSUME_NONNULL_BEGIN -(void)meetActivityGiftInfoIsUpdate:(QXRoomChatListModel*)giftInfo; /// 清除个人魅力 -(void)roomClearUserCharmWithUserId:(NSString*)userId; +/// 发红包 +-(void)recievedRedPacket:(QXRedPacketModel*)model; + /// 房间用户在线状态发生变化 //-(void)roomUserOnlineStatusDidChanged:(BOOL)isOnline userId:(NSString*)userId; @end diff --git a/QXLive/Manager/QXRoomMessageManager.m b/QXLive/Manager/QXRoomMessageManager.m index 9b5bb14..3bcd83a 100644 --- a/QXLive/Manager/QXRoomMessageManager.m +++ b/QXLive/Manager/QXRoomMessageManager.m @@ -616,6 +616,13 @@ [[NSNotificationCenter defaultCenter] postNotificationName:noticeRoomUserOnlineStatusDidChanged object:parm]; } break; + case QXRoomMessageTypeSendRedpacket:{ + QXRedPacketModel *model = [QXRedPacketModel yy_modelWithJSON:msg.Text]; + if (self.delegate && [self.delegate respondsToSelector:@selector(recievedRedPacket:)]) { + [self.delegate recievedRedPacket:model]; + } + } + break; default: break; } diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.h b/QXLive/Mine(音域)/Services/QXMineNetwork.h index 1d1c019..345b8eb 100644 --- a/QXLive/Mine(音域)/Services/QXMineNetwork.h +++ b/QXLive/Mine(音域)/Services/QXMineNetwork.h @@ -843,6 +843,7 @@ NS_ASSUME_NONNULL_BEGIN coin:(NSString*)coin type:(NSString*)type userId:(NSString*)userId + typeId:(NSString*)typeId successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @@ -1075,6 +1076,33 @@ NS_ASSUME_NONNULL_BEGIN +(void)roomHourRankWithPage:(NSInteger)page successBlock:(void (^)(QXRoomHourRankModel* model))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 发红包 + type 红包类型:1-普通红包,2-口令红包 + password 口令 + coin_type 币种:1- 金币,2- 钻石 + total_amount 总金额 + total_count 红包个数 + conditions 条件值(逗号分隔) + countdown 倒计时(单位S) + room_id 房间ID + */ ++(void)createRedpacketWithType:(NSString*)type + password:(NSString*)password + coin_type:(NSString*)coin_type + total_amount:(NSString*)total_amount + total_count:(NSString*)total_count + conditions:(NSString*)conditions + countdown:(NSString*)countdown + room_id:(NSString*)room_id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + ++(void)drawRedpacketWithRedpacketId:(NSString*)redpacketId; + @end diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.m b/QXLive/Mine(音域)/Services/QXMineNetwork.m index d9d007c..b4cd7a0 100644 --- a/QXLive/Mine(音域)/Services/QXMineNetwork.m +++ b/QXLive/Mine(音域)/Services/QXMineNetwork.m @@ -1627,12 +1627,13 @@ }]; } -+(void)rechargePayWithMoney:(NSString *)money coin:(NSString *)coin type:(NSString *)type userId:(NSString*)userId successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ ++(void)rechargePayWithMoney:(NSString *)money coin:(NSString *)coin type:(NSString *)type userId:(NSString*)userId typeId:(NSString*)typeId successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ @"coin":coin?coin:@"", @"money":money?money:@"", @"type":type?type:@"", - @"user_id":userId?userId:@"" + @"user_id":userId?userId:@"", + @"type_id":typeId?typeId:@"" }; [[QXRequset shareInstance] postWithUrl:QXRechargePay parameters:parameters needCache:NO success:^(id responseObject) { if (successBlock) { @@ -2108,5 +2109,32 @@ }]; } - ++(void)createRedpacketWithType:(NSString *)type + password:(NSString *)password + coin_type:(NSString *)coin_type + total_amount:(NSString *)total_amount + total_count:(NSString *)total_count + conditions:(NSString *)conditions + countdown:(NSString *)countdown + room_id:(NSString *)room_id + successBlock:(void (^)(NSDictionary * _Nonnull))successBlock + failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"type":type?type:@"", + @"password":password?password:@"", + @"coin_type":coin_type?coin_type:@"", + @"total_amount":total_amount?total_amount:@"", + @"total_count":total_count?total_count:@"", + @"conditions":conditions?conditions:@"", + @"countdown":countdown?countdown:@"", + @"room_id":room_id?room_id:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXRoomCreateRedpacket parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} @end diff --git a/QXLive/Mine(音域)/View/充值/QXRechargeView.h b/QXLive/Mine(音域)/View/充值/QXRechargeView.h index b64453d..85d0607 100644 --- a/QXLive/Mine(音域)/View/充值/QXRechargeView.h +++ b/QXLive/Mine(音域)/View/充值/QXRechargeView.h @@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,assign)BOOL isPop; @property (nonatomic,assign)BOOL isOnlyDisplayPayType; @property (nonatomic,strong)QXRechargeListModel *selectedModel; +@property (nonatomic,strong)NSString *gift_bag_id; -(void)showInView:(UIView *)view; @end diff --git a/QXLive/Mine(音域)/View/充值/QXRechargeView.m b/QXLive/Mine(音域)/View/充值/QXRechargeView.m index 640067c..d72b7e8 100644 --- a/QXLive/Mine(音域)/View/充值/QXRechargeView.m +++ b/QXLive/Mine(音域)/View/充值/QXRechargeView.m @@ -266,7 +266,7 @@ } @weakify(self) - [QXMineNetwork rechargePayWithMoney:self.selectedModel.money coin:self.selectedModel.coins type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id successBlock:^(NSDictionary * _Nonnull dict) { + [QXMineNetwork rechargePayWithMoney:self.selectedModel.money coin:self.selectedModel.coins type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id typeId:self.gift_bag_id successBlock:^(NSDictionary * _Nonnull dict) { @strongify(self) if (self.selectedPayTypeModel.type.intValue == 2) { NSDictionary *resultDict = dict[@"data"]; diff --git a/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/Contents.json b/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/Contents.json index d68ba33..b997c44 100644 --- a/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/Contents.json +++ b/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/Contents.json @@ -5,7 +5,7 @@ "scale" : "1x" }, { - "filename" : "天降好礼@2x.png", + "filename" : "首充礼包@2x.png", "idiom" : "universal", "scale" : "2x" }, diff --git a/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/天降好礼@2x.png b/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/天降好礼@2x.png deleted file mode 100644 index 394755b..0000000 Binary files a/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/天降好礼@2x.png and /dev/null differ diff --git a/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/首充礼包@2x.png b/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/首充礼包@2x.png new file mode 100644 index 0000000..ff2de8f Binary files /dev/null and b/QXLive/Other/Assets.xcassets/弹窗/a_first_recharge_bg.imageset/首充礼包@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@2x.png b/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@2x.png index de232d1..53c857d 100644 Binary files a/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@2x.png and b/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@3x.png b/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@3x.png index 09d2d43..3e36eb9 100644 Binary files a/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@3x.png and b/QXLive/Other/Assets.xcassets/弹窗/gift_time_bg.imageset/Rectangle 645@3x.png differ diff --git a/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/Contents.json b/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/Contents.json new file mode 100644 index 0000000..d12aea1 --- /dev/null +++ b/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "one_mouth_money@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "one_mouth_money@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/one_mouth_money@2x.png b/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/one_mouth_money@2x.png new file mode 100644 index 0000000..93c0f79 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/one_mouth_money@2x.png differ diff --git a/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/one_mouth_money@3x.png b/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/one_mouth_money@3x.png new file mode 100644 index 0000000..458b8a0 Binary files /dev/null and b/QXLive/Other/Assets.xcassets/弹窗/one_mouth_money.imageset/one_mouth_money@3x.png differ diff --git a/QXLive/Other/QXApi.h b/QXLive/Other/QXApi.h index e80b3fc..64e9f1d 100644 --- a/QXLive/Other/QXApi.h +++ b/QXLive/Other/QXApi.h @@ -454,4 +454,12 @@ static NSString * QXWalletBindDetail = @"api/Bind/bind_detail"; /// 小时榜 static NSString * QXRoomHourRank = @"api/RoomHourRanking/room_hour_ranking"; +/// 创建红包 +static NSString * QXRoomCreateRedpacket = @"api/Redpacket/create"; +/// 抢红包 +static NSString * QXRoomDrawRedpacket = @"api/Redpacket/grab"; +/// 房间内红包列表 +static NSString * QXRoomRedpacketList = @"api/Redpacket/roomRedPackets"; +/// 红包详情 +static NSString * QXRoomRedpacketDetail = @"api/Redpacket/detail"; #endif /* Api_h */ diff --git a/QXLive/Tabbar/弹窗/QXFirstRechargeView.h b/QXLive/Tabbar/弹窗/QXFirstRechargeView.h index b9ef2c0..eba5976 100644 --- a/QXLive/Tabbar/弹窗/QXFirstRechargeView.h +++ b/QXLive/Tabbar/弹窗/QXFirstRechargeView.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @interface QXFirstRechargeView : UIView @property (nonatomic,copy)void(^closeActionBlock)(void); -@property (nonatomic,copy)void(^getActionBlock)(void); +@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id); @property (nonatomic,copy)void(^refreshBlcock)(void); @end diff --git a/QXLive/Tabbar/弹窗/QXFirstRechargeView.m b/QXLive/Tabbar/弹窗/QXFirstRechargeView.m index 76052f6..5dea847 100644 --- a/QXLive/Tabbar/弹窗/QXFirstRechargeView.m +++ b/QXLive/Tabbar/弹窗/QXFirstRechargeView.m @@ -149,8 +149,8 @@ // 立即领取 -(void)getAction{ - if (self.getActionBlock) { - self.getActionBlock(); + if (self.rechargeActionBlock) { + self.rechargeActionBlock(self.model.money,self.model.gift_bag_id); } } -(void)closeAction{ diff --git a/QXLive/Tabbar/弹窗/QXNewPeoplePopView.h b/QXLive/Tabbar/弹窗/QXNewPeoplePopView.h index e3943ae..0e7873f 100644 --- a/QXLive/Tabbar/弹窗/QXNewPeoplePopView.h +++ b/QXLive/Tabbar/弹窗/QXNewPeoplePopView.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @interface QXNewPeoplePopView : UIView @property (nonatomic,copy)void(^closeActionBlock)(void); -@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money); +@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money,NSString*gift_bag_id); @property (nonatomic,copy)void(^refreshBlcock)(void); @property (nonatomic,strong)NSArray *giftArray; -(void)reloadData; diff --git a/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m b/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m index f0efcfb..dc727cf 100644 --- a/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m +++ b/QXLive/Tabbar/弹窗/QXNewPeoplePopView.m @@ -19,6 +19,7 @@ @property (nonatomic,strong)UIButton *firstBtn; @property (nonatomic,strong)UIButton *secondBtn; @property (nonatomic,strong)UIButton *thirdBtn; +@property (nonatomic,strong)UIButton *oneMouthBtn; @property (nonatomic,strong)UIButton *selectedBtn; @property (nonatomic,strong)UIView *giftBgView; @@ -29,7 +30,9 @@ @property (nonatomic,strong)QXNiceGiftRechargeModel *md1; @property (nonatomic,strong)QXNiceGiftRechargeModel *md2; @property (nonatomic,strong)QXNiceGiftRechargeModel *md3; +@property (nonatomic,strong)QXNiceGiftRechargeModel *md4; @property (nonatomic,strong)QXNiceGiftRechargeModel *smd; + @end @implementation QXNewPeoplePopView @@ -71,9 +74,11 @@ self.firstBtn.hidden = YES; UIImage *firstNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)]; UIImage *firstSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)]; + UIImage *firstDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)]; [self.firstBtn setBackgroundImage:firstNorImage forState:(UIControlStateNormal)]; [self.firstBtn setBackgroundImage:firstSelImage forState:(UIControlStateSelected)]; - self.firstBtn.selected = YES; + [self.firstBtn setBackgroundImage:firstDisImage forState:(UIControlStateDisabled)]; +// self.firstBtn.selected = YES; // [self.firstBtn setTitle:@"9元" forState:(UIControlStateNormal)]; [self.firstBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)]; [self.firstBtn addRoundedCornersWithRadius:ScaleWidth(13)]; @@ -92,8 +97,10 @@ self.secondBtn.hidden = YES; UIImage *secondNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)]; UIImage *secondSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)]; + UIImage *secondDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)]; [self.secondBtn setBackgroundImage:secondNorImage forState:(UIControlStateNormal)]; [self.secondBtn setBackgroundImage:secondSelImage forState:(UIControlStateSelected)]; + [self.secondBtn setBackgroundImage:secondDisImage forState:(UIControlStateDisabled)]; // [self.secondBtn setTitle:@"30元" forState:(UIControlStateNormal)]; [self.secondBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)]; [self.secondBtn addRoundedCornersWithRadius:ScaleWidth(13)]; @@ -104,7 +111,7 @@ make.left.equalTo(self.firstBtn.mas_right).offset(12); make.top.equalTo(self.firstBtn); make.height.mas_equalTo(ScaleWidth(26)); - make.width.mas_equalTo(ScaleWidth(42)); + make.width.mas_equalTo(ScaleWidth(50)); }]; @@ -112,8 +119,10 @@ self.thirdBtn.hidden = YES; UIImage *thirdNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)]; UIImage *thirdSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)]; + UIImage *thirdDisImage = [UIImage imageWithColor:RGB16(0xE9E9E9)]; [self.thirdBtn setBackgroundImage:thirdNorImage forState:(UIControlStateNormal)]; [self.thirdBtn setBackgroundImage:thirdSelImage forState:(UIControlStateSelected)]; + [self.thirdBtn setBackgroundImage:thirdDisImage forState:(UIControlStateSelected)]; // [self.thirdBtn setTitle:@"60元" forState:(UIControlStateNormal)]; [self.thirdBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)]; [self.thirdBtn addRoundedCornersWithRadius:ScaleWidth(13)]; @@ -124,9 +133,28 @@ make.left.equalTo(self.secondBtn.mas_right).offset(12); make.top.equalTo(self.firstBtn); make.height.mas_equalTo(ScaleWidth(26)); - make.width.mas_equalTo(ScaleWidth(42)); + make.width.mas_equalTo(ScaleWidth(50)); }]; + self.oneMouthBtn = [[UIButton alloc] init]; + self.oneMouthBtn.hidden = YES; + UIImage *one_mouth_norImage = [UIImage imageNamed:@"one_mouth_money"]; + UIImage *one_mouth_selImage = [UIImage imageNamed:@"one_mouth_money"]; + [self.oneMouthBtn setBackgroundImage:one_mouth_norImage forState:(UIControlStateNormal)]; + [self.oneMouthBtn setBackgroundImage:one_mouth_selImage forState:(UIControlStateSelected)]; + [self.oneMouthBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; + [self.oneMouthBtn addRoundedCornersWithRadius:ScaleWidth(13)]; + self.oneMouthBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.oneMouthBtn addTarget:self action:@selector(rechargeSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.oneMouthBtn]; + [self.oneMouthBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.bgImageView.mas_right).offset(-27); + make.centerY.equalTo(self.firstBtn); + make.height.mas_equalTo(ScaleWidth(24)); + make.width.mas_equalTo(ScaleWidth(66)); + }]; + + self.giftBgView = [[UIView alloc] init]; self.giftBgView.backgroundColor = [UIColor whiteColor]; [self.giftBgView addRoundedCornersWithRadius:13]; @@ -204,30 +232,55 @@ } -(void)getFirstRechargeGiftList{ MJWeakSelf - [QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray * _Nonnull list) { - - } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - - }]; - [QXHomePageNetwork getNewUserGiftListSuccessBlock:^(NSArray * _Nonnull list) { for (int i = 0; i