YOUPAILZLiveInfoUpdateAttachment.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // YOUPAILZLiveInfoUpdateAttachment.m
  3. // TIANYAN
  4. //
  5. // Created by CY on 2021/5/25.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveInfoUpdateAttachment.h"
  9. @implementation YOUPAILZLiveInfoUpdateAttachment
  10. - (NSString *)encodeAttachment
  11. {
  12. NSDictionary *dict = @{
  13. CMType : @(CustomOnLiveInfoUpdate),
  14. CMData : @{
  15. CMAnchorCharm: self.anchor_charm?self.anchor_charm:@"",
  16. CMFans: self.fans ?self.fans:@"",
  17. CMAnchorRankInfo: self.anchor_rank_info ? self.anchor_rank_info:@{},
  18. CMRankTopThree: self.rank_top_three ? self.rank_top_three:@{},
  19. }
  20. };
  21. NSData *data = [NSJSONSerialization dataWithJSONObject:dict
  22. options:0
  23. error:nil];
  24. NSString *content = nil;
  25. if (data) {
  26. content = [[NSString alloc] initWithData:data
  27. encoding:NSUTF8StringEncoding];
  28. }
  29. return content;
  30. }
  31. @end