Files
peko-ios/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftReceiveInfoModel.m
2024-12-11 10:48:01 +08:00

108 lines
1.9 KiB
Objective-C

//
// GiftReceiveInfoModel.m
// YUMI
//
// Created by YUMI on 2021/11/16.
//
#import "GiftReceiveInfoModel.h"
#import "NSObject+MJExtension.h"
@implementation GiftReceiveUserInfoModel
@end
@implementation GiftLuckyUserInfo
@end
@implementation GiftListsInfo
@end
@implementation GiftLuckyBagGiftsInfo
+ (NSDictionary *)objectClassInArray {
return @{@"giftList":GiftListsInfo.class
};
}
@end
@implementation GiftReceiveInfoModel
+ (NSDictionary *)objectClassInArray {
return @{@"targetUsers":GiftReceiveUserInfoModel.class,
@"displayGift":GiftInfoModel.class,
@"luckyBagGifts":GiftLuckyBagGiftsInfo.class
};
}
- (BOOL)isEqual:(id)other
{
if (other == self) {
return YES;
}
GiftReceiveInfoModel *otherInfo = (GiftReceiveInfoModel *)other;
if ([self.uid isEqualToString:otherInfo.uid]
// && [self.giftId isEqualToString:otherInfo.giftId]
// && [self isEqualUIDs:otherInfo]
) {
return YES;
}
return NO;
}
- (BOOL)isEqualUIDs:(GiftReceiveInfoModel *)other {
if ([self.targetUid isEqualToString:other.targetUid]) {
return YES;
}
if ([self.targetUids isEqualToArray:other.targetUids]) {
return YES;
}
return NO;
}
- (NSUInteger)hash
{
return self.uid.hash ^ self.giftId.hash;// ^ self.targetUid.hash ^ self.targetUids.hash;
}
- (NSInteger)receiveUserCount {
if (self.targetUids.count > 0) {
return self.targetUids.count;
}
return 1;
}
- (void)giftDataAlignment {
if (!_gift) {
if (_giftVo) {
_gift = _giftVo;
} else if (_giftInfo) {
_gift = _giftInfo;
}
}
if (!_giftVo) {
if (_gift) {
_giftVo = _gift;
} else if (_giftInfo) {
_giftVo = _giftInfo;
}
}
if (!_giftInfo) {
if (_giftVo) {
_giftInfo = _giftVo;
} else if (_gift) {
_giftInfo = _gift;
}
}
}
@end