YOUPAILZLivePKDataAttachment.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // YOUPAILZLivePKDataAttachment.m
  3. // TIANYAN
  4. //
  5. // Created by CY on 2021/5/31.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLivePKDataAttachment.h"
  9. @implementation YOUPAILZLivePKDataAttachment
  10. - (NSString *)encodeAttachment{
  11. NSDictionary *dict = @{
  12. CMEvent : CMEventWithPKData,
  13. CMData : @{
  14. CMType: self.type?self.type:@"",
  15. CMTimer: self.time?self.time:@"",
  16. CMStartTime: self.start_time?self.start_time:@"",
  17. CMPkEndTime: self.pk_end_time?self.pk_end_time:@"",
  18. CMPunishEndTime: self.punish_end_time?self.punish_end_time:@"",
  19. CMRoomId: self.roomid?self.roomid:@"",
  20. CMFrom: self.from_uid?self.from_uid:@"",
  21. CMFromNum: self.from_num?self.from_num:@"",
  22. CMTo: self.to_uid?self.to_uid:@"",
  23. CMToNum: self.to_num?self.to_num:@"",
  24. CMId: self.id?self.id:@"",
  25. }
  26. };
  27. NSData *data = [NSJSONSerialization dataWithJSONObject:dict
  28. options:0
  29. error:nil];
  30. NSString *content = nil;
  31. if (data) {
  32. content = [[NSString alloc] initWithData:data
  33. encoding:NSUTF8StringEncoding];
  34. }
  35. return content;
  36. }
  37. @end