礼物值送礼物更新礼物值

This commit is contained in:
fengshuo
2021-12-13 18:45:24 +08:00
parent 260cec82be
commit 5411d961bb
9 changed files with 90 additions and 76 deletions

View File

@@ -305,7 +305,7 @@
E8DEC98F27643EB30078CB70 /* XPCandyTreeAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC98E27643EB30078CB70 /* XPCandyTreeAnimationManager.m */; };
E8DEC992276441AA0078CB70 /* XPCandyTreeAnimationModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC991276441AA0078CB70 /* XPCandyTreeAnimationModel.m */; };
E8DACCFB2766EDC60052092C /* MicroGiftValueView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */; };
E8DACCFE27673F870052092C /* MicroGiftValueModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFD27673F870052092C /* MicroGiftValueModel.m */; };
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DACCFD27673F870052092C /* GiftValueInfoModel.m */; };
E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC99427648FA50078CB70 /* ClientConfig.m */; };
E8DEC99E2764A5B60078CB70 /* XPRoomMoreMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC99D2764A5B60078CB70 /* XPRoomMoreMenuViewController.m */; };
E8DEC9A12764A5D20078CB70 /* XPRoomMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8DEC9A02764A5D20078CB70 /* XPRoomMoreItemModel.m */; };
@@ -931,8 +931,8 @@
E8DEC991276441AA0078CB70 /* XPCandyTreeAnimationModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeAnimationModel.m; sourceTree = "<group>"; };
E8DACCF92766EDC60052092C /* MicroGiftValueView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroGiftValueView.h; sourceTree = "<group>"; };
E8DACCFA2766EDC60052092C /* MicroGiftValueView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroGiftValueView.m; sourceTree = "<group>"; };
E8DACCFC27673F870052092C /* MicroGiftValueModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroGiftValueModel.h; sourceTree = "<group>"; };
E8DACCFD27673F870052092C /* MicroGiftValueModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroGiftValueModel.m; sourceTree = "<group>"; };
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftValueInfoModel.h; sourceTree = "<group>"; };
E8DACCFD27673F870052092C /* GiftValueInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftValueInfoModel.m; sourceTree = "<group>"; };
E8DEC99327648FA50078CB70 /* ClientConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClientConfig.h; sourceTree = "<group>"; };
E8DEC99427648FA50078CB70 /* ClientConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ClientConfig.m; sourceTree = "<group>"; };
E8DEC99C2764A5B60078CB70 /* XPRoomMoreMenuViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuViewController.h; sourceTree = "<group>"; };
@@ -1987,8 +1987,6 @@
E874B88727215D39003954B9 /* MicroStateModel.m */,
E874B88927215EAF003954B9 /* MicroQueueModel.h */,
E874B88A27215EAF003954B9 /* MicroQueueModel.m */,
E8DACCFC27673F870052092C /* MicroGiftValueModel.h */,
E8DACCFD27673F870052092C /* MicroGiftValueModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -2018,6 +2016,8 @@
E884C36B2743951B00E1EBED /* GiftReceiveInfoModel.m */,
E8E7DAE92745158500C631CC /* XPGiftUserInfoModel.h */,
E8E7DAEA2745158500C631CC /* XPGiftUserInfoModel.m */,
E8DACCFC27673F870052092C /* GiftValueInfoModel.h */,
E8DACCFD27673F870052092C /* GiftValueInfoModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -3073,7 +3073,7 @@
E8AEAED6271412EC0017FCE0 /* XPRoomViewController.m in Sources */,
E8E70D9226F2F60C00F03460 /* XPMineItemModel.m in Sources */,
189DD74A26E21D8400AB55B1 /* SSKeychain.m in Sources */,
E8DACCFE27673F870052092C /* MicroGiftValueModel.m in Sources */,
E8DACCFE27673F870052092C /* GiftValueInfoModel.m in Sources */,
E8B846CF26FDD96100A777FE /* XPMineRechageHeadView.m in Sources */,
186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */,
E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */,

View File

@@ -24,6 +24,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Kick_User = 18,
///糖果树
CustomMessageType_Candy_Tree = 26,
///房间礼物值
CustomMessageType_Room_GiftValue = 42,
///福袋消息
CustomMessageType_LuckyBag = 61,
};
@@ -96,6 +98,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubCandyTree) {
//暴击的没用 不写了
};
///first = CustomMessageType_Room_GiftValue
typedef NS_ENUM(NSUInteger, CustomMessageSubRoomGiftValue) {
///礼物值同步
Custom_Message_Sub_Room_GiftValue_Sync = 421
};
///first = CustomMessageType_LuckyBag
typedef NS_ENUM(NSUInteger, CustomMessageSubLuckyBag) {
/// 福袋礼物房间飘屏通知

View File

@@ -4,47 +4,10 @@
//
// Created by 冯硕 on 2021/11/16.
//
/*
avatar = "http://img.uat.lecheng163.com/FoNOJJrSIf9WpJ8jHC_7OGxP841o?imageslim";
currentTime = 1637047533593;
gift = {
consumeType = 1;
giftId = 1423;
giftName = "\U795e\U79d8\U7cbd\U5b50";
giftType = 2;
giftUrl = "http://image.uat.zhongjialx.com/FmDCm483cDGPfM1cy-KW2558HUHx?imageslim";
goldPrice = 33;
hasEffect = 0;
hasLatest = 0;
hasTimeLimit = 0;
hasVggPic = 0;
isNobleGift = 0;
isSendMsg = 0;
isSkipRoom = 0;
isWholeServer = 0;
nobleId = 0;
nobleName = "";
roomExclude = 0;
seqNo = 1;
vggUrl = "http://image.uat.zhongjialx.com/FmDCm483cDGPfM1cy-KW2558HUHx?imageslim";
};
giftId = 1423;
giftNum = 1;
nick = "\U636e\U5065\U5065\U5eb7\U5eb7****";
targetUsers = (
{
avatar = "http://img.uat.lecheng163.com/FnEA7WfDtE2gMLyEvGLkY0Sa9cRk?imageslim";
nick = "IU\U7684\U79d8\U5bc6\U7537\U53cb";
uid = 940317;
}
);
uid = 940318;*/
#import <Foundation/Foundation.h>
#import "GiftInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@class GiftValueInfoModel;
@interface GiftReceiveUserInfoModel : NSObject
///收礼物的人
@property(nonatomic, strong)NSString *nick;
@@ -113,6 +76,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign) GiftSourceType sourceType;
///房间送礼物的类型
@property (nonatomic,assign) RoomSendGiftType roomSendGiftType;
///礼物值信息
@property (nonatomic, strong) NSArray<GiftValueInfoModel *> *giftValueVos;
///是否是背包礼物
@property (nonatomic,assign) BOOL isLuckyBagGift;
///是不是全麦

View File

@@ -8,13 +8,13 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class MicroGiftValueDetailModel;
@interface MicroGiftValueModel : NSObject
@class GiftValueDetailModel;
@interface GiftValueInfoModel : NSObject
@property (nonatomic, copy) NSString *currentTime;//系统时间戳
@property (nonatomic, strong) NSArray<MicroGiftValueDetailModel *> *giftValueVos;
@property (nonatomic, strong) NSArray<GiftValueDetailModel *> *giftValueVos;
@end
@interface MicroGiftValueDetailModel : NSObject
@interface GiftValueDetailModel : NSObject
///用户的uid
@property (nonatomic, copy) NSString * uid;
///礼物值

View File

@@ -0,0 +1,23 @@
//
// MicroGiftValueModel.m
// xplan-ios
//
// Created by on 2021/12/13.
//
#import "GiftValueInfoModel.h"
@implementation GiftValueInfoModel
+ (NSDictionary *)objectClassInArray {
return @{@"giftValueVos":GiftValueDetailModel.class};
}
@end
@implementation GiftValueDetailModel
@end

View File

@@ -249,6 +249,7 @@
- (MicroGiftValueView *)giftValueView {
if (!_giftValueView) {
_giftValueView = [[MicroGiftValueView alloc] init];
_giftValueView.hidden = YES;
}
return _giftValueView;
}

View File

@@ -1,23 +0,0 @@
//
// MicroGiftValueModel.m
// xplan-ios
//
// Created by on 2021/12/13.
//
#import "MicroGiftValueModel.h"
@implementation MicroGiftValueModel
+ (NSDictionary *)objectClassInArray {
return @{@"giftValueVos":MicroGiftValueDetailModel.class};
}
@end
@implementation MicroGiftValueDetailModel
@end

View File

@@ -26,7 +26,7 @@
#import "MicroQueueModel.h"
#import "AttachmentModel.h"
#import "GiftReceiveInfoModel.h"
#import "MicroGiftValueModel.h"
#import "GiftValueInfoModel.h"
///View
#import "NetImageView.h"
#import "XPUserCardViewController.h"
@@ -171,6 +171,7 @@
[view configMicroView:model];
[view showLeaveMode:i == 0 && leaveMode];
if (model.userInfo == nil) [view resetGiftValue];
[view showGiftValueMode:roomInfo.showGiftValue];
if (self.hostDelegate.getUserInfo.uid && model.userInfo.uid == self.hostDelegate.getUserInfo.uid) {
selfNeedBroadcast = model.microState.micState == MicroMicStateType_Open;
}
@@ -190,9 +191,9 @@
}
- (void)giftValueUpdate:(NSDictionary *)dic {
MicroGiftValueModel * model = [MicroGiftValueModel modelWithDictionary:dic];
GiftValueInfoModel * model = [GiftValueInfoModel modelWithDictionary:dic];
for (int i = 0; i < model.giftValueVos.count; i++) {
MicroGiftValueDetailModel * giftValueModel = [model.giftValueVos objectAtIndex:i];
GiftValueDetailModel * giftValueModel = [model.giftValueVos objectAtIndex:i];
UIView<MicroViewProtocol> * view = [self findMicroViewByUid:giftValueModel.uid];
if (view == nil) continue;
[view configGiftValue:giftValueModel.giftValue];
@@ -256,8 +257,29 @@
if (changeType == 1) { //
MicroQueueModel *sequence = [self.micQueue objectForKey:position];
sequence.userInfo = userInfo;
if (self.hostDelegate.getRoomInfo.showGiftValue && userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
RoomInfoModel * roomInfo =self.hostDelegate.getRoomInfo;
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
NSString * uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
[Api roomGiftValueUpMic:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NIMMessage * message = [[NIMMessage alloc] init];
AttachmentModel * attachMent = [[AttachmentModel alloc] init];
attachMent.first = CustomMessageType_Room_GiftValue;
attachMent.second = Custom_Message_Sub_Room_GiftValue_Sync;
attachMent.data = data.data;
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachMent;
message.messageObject = object;
//
NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
}
} roomUid:roomUid micUid:uid position:position uid:uid];
}
}
microQueueChanged = YES;
}
break;
@@ -319,7 +341,14 @@
}];
}];
}
}
} else if(attachment.first == CustomMessageType_Room_GiftValue && attachment.second == Custom_Message_Sub_Room_GiftValue_Sync) {
[self giftValueUpdate:attachment.data];
} else if(attachment.first == CustomMessageType_Gift && (attachment.second == Custom_Message_Sub_Gift_Send || attachment.second == Custom_Message_Sub_Gift_LuckySend || attachment.second == Custom_Message_Sub_Gift_ChannelNotify)) {
[self giftValueUpdate:attachment.data];
}else if(attachment.first == CustomMessageType_AllMicroSend && (attachment.second == Custom_Message_Sub_AllMicroSend || attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend)) {
[self giftValueUpdate:attachment.data];
}
}
#pragma mark - RtcDelegate -

View File

@@ -285,6 +285,17 @@
}
}
//
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
if (error) return;
if (message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
[self.stageView handleNIMCustomMessage:obj.attachment];
}
}
}
#pragma mark - RoomDelegate
- (RoomInfoModel *)getRoomInfo {
return self.roomInfo;