2
0

WFCCChannelMenu.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // WFCCChannelMenu.m
  3. // WFChatClient
  4. //
  5. // Created by Rain on 2022/8/11.
  6. // Copyright © 2022 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCCChannelMenu.h"
  9. @implementation WFCCChannelMenu
  10. - (id)toJsonObj {
  11. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  12. dict[@"type"] = self.type;
  13. dict[@"name"] = self.name;
  14. if(self.menuId.length) dict[@"menuId"] = self.menuId;
  15. if(self.key.length) dict[@"key"] = self.key;
  16. if(self.url.length) dict[@"url"] = self.url;
  17. if(self.mediaId.length) dict[@"mediaId"] = self.mediaId;
  18. if(self.articleId.length) dict[@"articleId"] = self.articleId;
  19. if(self.appId.length) dict[@"appId"] = self.appId;
  20. if(self.appPage.length) dict[@"appPage"] = self.appPage;
  21. if(self.extra.length) dict[@"extra"] = self.extra;
  22. if (self.subMenus.count) {
  23. NSMutableArray *subMenus = [[NSMutableArray alloc] init];
  24. [self.subMenus enumerateObjectsUsingBlock:^(WFCCChannelMenu * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  25. id subs = [obj toJsonObj];
  26. [subMenus addObject:subs];
  27. }];
  28. dict[@"subMenus"] = subMenus;
  29. }
  30. return dict;
  31. }
  32. @end