// // YOUPAILZLivePKDataAttachment.m // TIANYAN // // Created by CY on 2021/5/31. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAILZLivePKDataAttachment.h" @implementation YOUPAILZLivePKDataAttachment - (NSString *)encodeAttachment{ NSDictionary *dict = @{ CMEvent : CMEventWithPKData, CMData : @{ CMType: self.type?self.type:@"", CMTimer: self.time?self.time:@"", CMStartTime: self.start_time?self.start_time:@"", CMPkEndTime: self.pk_end_time?self.pk_end_time:@"", CMPunishEndTime: self.punish_end_time?self.punish_end_time:@"", CMRoomId: self.roomid?self.roomid:@"", CMFrom: self.from_uid?self.from_uid:@"", CMFromNum: self.from_num?self.from_num:@"", CMTo: self.to_uid?self.to_uid:@"", CMToNum: self.to_num?self.to_num:@"", CMId: self.id?self.id:@"", } }; NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil]; NSString *content = nil; if (data) { content = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } return content; } @end