YOUPAILZLivePKAttachment.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // YOUPAILZLivePKAttachment.m
  3. // TIANYAN
  4. //
  5. // Created by CY on 2021/5/31.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLivePKAttachment.h"
  9. @implementation YOUPAILZLivePKAttachment
  10. - (NSString *)encodeAttachment{
  11. NSDictionary *dict = @{
  12. CMEvent : CMEventWithPK,
  13. CMData : @{
  14. CMType: self.type?self.type:@"",
  15. CMFromRoomid: self.from_roomid?self.from_roomid:@"",
  16. CMFrom: self.from_uid?self.from_uid:@"",
  17. CMToRoomid: self.to_roomid?self.to_roomid:@"",
  18. CMTo: self.to_uid?self.to_uid:@"",
  19. CMId: self.id?self.id:@"",
  20. CMOperateUid: self.operate_uid?self.operate_uid:@"",
  21. }
  22. };
  23. NSData *data = [NSJSONSerialization dataWithJSONObject:dict
  24. options:0
  25. error:nil];
  26. NSString *content = nil;
  27. if (data) {
  28. content = [[NSString alloc] initWithData:data
  29. encoding:NSUTF8StringEncoding];
  30. }
  31. return content;
  32. }
  33. @end