YOUPAILZChatRoomModeUpdateAttrchment.m 1.2 KB

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