YOUPAILZLiveVipBarrageAttachment.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // YOUPAILZLiveVipBarrageAttachment.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/8/30.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveVipBarrageAttachment.h"
  9. @implementation YOUPAILZLiveVipBarrageAttachment
  10. - (NSString *)encodeAttachment
  11. {
  12. NSDictionary *dict = @{
  13. CMType : @(CustomOnLiveVipBarrage),
  14. CMData : @{
  15. CMBBox: self.b_box?self.b_box:@"",
  16. CMAvatarFrame: self.avatar_frame?self.avatar_frame:@"",
  17. CMName: self.name?self.name:@"",
  18. CMAvatar: self.avatar?self.avatar:@"",
  19. CMNobleName: self.noble_name?self.noble_name:@"",
  20. }
  21. };
  22. NSData *data = [NSJSONSerialization dataWithJSONObject:dict
  23. options:0
  24. error:nil];
  25. NSString *content = nil;
  26. if (data) {
  27. content = [[NSString alloc] initWithData:data
  28. encoding:NSUTF8StringEncoding];
  29. }
  30. return content;
  31. }
  32. @end