YOUPAILZChatRoomEmojiAttachment.m 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // YOUPAILZChatRoomEmojiAttachment.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/11/11.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomEmojiAttachment.h"
  9. @implementation YOUPAILZChatRoomEmojiAttachment
  10. - (NSString *)encodeAttachment{
  11. NSDictionary *dict = @{
  12. CMType : @(CustomOnChatRoomEmoji),
  13. CMData : @{
  14. CMFrom: self.from_uid ? self.from_uid : @"",
  15. CMRoomId: self.roomid ? self.roomid : @"",
  16. CMImg: self.img ? self.img : @"",
  17. }
  18. };
  19. NSData *data = [NSJSONSerialization dataWithJSONObject:dict
  20. options:0
  21. error:nil];
  22. NSString *content = nil;
  23. if (data) {
  24. content = [[NSString alloc] initWithData:data
  25. encoding:NSUTF8StringEncoding];
  26. }
  27. return content;
  28. }
  29. @end