塔罗公屏不显示的问题

This commit is contained in:
fengshuo
2022-08-30 17:52:28 +08:00
parent 789c11ac34
commit f3f3731993
4 changed files with 43 additions and 4 deletions

View File

@@ -21,7 +21,7 @@
int second = [dict[@"second"] intValue]; int second = [dict[@"second"] intValue];
NSDictionary *data = dict[@"data"]; NSDictionary *data = dict[@"data"];
if ([data isKindOfClass:[NSString class]]) { if ([data isKindOfClass:[NSString class]]) {
data = [(NSString *)data model2dictionary]; data = [self dictionaryWithJsonString:(NSString *)data];
} }
if ([data isKindOfClass:[NSDictionary class]]) { if ([data isKindOfClass:[NSDictionary class]]) {
AttachmentModel *attachment = [[AttachmentModel alloc]init]; AttachmentModel *attachment = [[AttachmentModel alloc]init];
@@ -36,4 +36,35 @@
return attachment; return attachment;
} }
//json
- (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString {
if (jsonString == nil) {
return nil;
}
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONReadingMutableContainers
error:&err];
if(err) {
NSLog(@"json解析失败%@",err);
return nil;
}
return dic;
}
@end @end

View File

@@ -730,9 +730,9 @@
NSString *text = [NSString stringWithFormat:@" %@", attachment.data[@"drawMsgText"]]; NSString *text = [NSString stringWithFormat:@" %@", attachment.data[@"drawMsgText"]];
[attribute appendAttributedString:[self createTextAttribute:text color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:text color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
if ([attachment.data[@"drawGoldNum"] intValue] > 1) { if ([attachment.data[@"drawGoldNum"] intValue] > 1) {
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%d",[attachment.data[@"drawGoldNum"] intValue]] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%d",[attachment.data[@"drawGoldNum"] intValue]] color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
} }
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@ ", attachment.data[@"chargeProdName"]] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createTextAttribute:@"钻石" color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
} }
messageInfo.content = attribute; messageInfo.content = attribute;
return messageInfo; return messageInfo;

View File

@@ -454,6 +454,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[NSSet setWithObjects: [NSSet setWithObjects:
@(Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room), @(Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room),
nil], nil],
@(CustomMessageType_Tarot):
[NSSet setWithObjects:
@(Custom_Message_Sub_Tarot),
nil],
@(CustomMessageType_Room_PK): @(CustomMessageType_Room_PK):
[NSSet setWithObjects: [NSSet setWithObjects:
@(Custom_Message_Sub_Room_PK_Manager_Up_Mic), @(Custom_Message_Sub_Room_PK_Manager_Up_Mic),

View File

@@ -340,6 +340,10 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey;
[NSSet setWithObjects: [NSSet setWithObjects:
@(Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room), @(Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room),
nil], nil],
@(CustomMessageType_Tarot):
[NSSet setWithObjects:
@(Custom_Message_Sub_Tarot),
nil],
@(CustomMessageType_Room_PK): @(CustomMessageType_Room_PK):
[NSSet setWithObjects: [NSSet setWithObjects:
@(Custom_Message_Sub_Room_PK_Manager_Up_Mic), @(Custom_Message_Sub_Room_PK_Manager_Up_Mic),
@@ -363,7 +367,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicPlayMusicOrderKey;
@(Custom_Message_Sub_Sailing_AllRoom), @(Custom_Message_Sub_Sailing_AllRoom),
@(Custom_Message_Sub_Sailing_AllRoom_Notify), @(Custom_Message_Sub_Sailing_AllRoom_Notify),
@(Custom_Message_Sub_Sailing_InRoom_NeedAllMicSend), @(Custom_Message_Sub_Sailing_InRoom_NeedAllMicSend),
nil] nil],
}; };
} }