加入、退出粉丝团接口及协议处理

This commit is contained in:
chenguilong
2022-04-08 15:42:25 +08:00
parent 6c4360ab96
commit 5942609f58
20 changed files with 419 additions and 164 deletions

View File

@@ -93,6 +93,8 @@
return [self createRoomFaceAttribute:attachment];
} else if (first == CustomMessageType_Tarot) {//
return [self createTarotAttribute:attachment];
} else if (first == CustomMessageType_Anchor_FansTeam) {//
return [self createAnchorFansTeamAttribute:attachment];
}
return nil;
}
@@ -408,6 +410,36 @@
return attribute;
}
#pragma mark -
- (NSAttributedString *)createAnchorFansTeamAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSInteger uid = 0;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
uid = ((NSNumber *)attachment.data[@"uid"]).integerValue;
} else if ([attachment.data[@"uid"] isKindOfClass:[NSString class]]) {
uid = ((NSString *)attachment.data[@"uid"]).integerValue;
}
NSString *idString = [NSString stringWithFormat:@"%ld", uid];
NSString *nickName = attachment.data[@"nickName"];
if ([idString isEqualToString:[[AccountInfoStorage instance] getUid]]) {
nickName = @"您";
}
if (attachment.second == Custom_Message_Sub_FansTeam_Open_Success) {///
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:nickName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"开通粉丝团成功" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
} else if (attachment.second == Custom_Message_Sub_FansTeam_Join_Success) {///
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:nickName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"加入粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
} else if (attachment.second == Custom_Message_Sub_FansTeam_Out_Success) {//退
[attribute appendAttributedString:[self createTextAttribute:nickName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"已退出粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
[self attributeAddHihtLight:attribute uid:uid];
return attribute;
}
#pragma mark - //
- (NSAttributedString *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];