WFCCChannelInfo.m 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // WFCCChatroomInfo.m
  3. // WFChatClient
  4. //
  5. // Created by heavyrain lee on 2018/8/24.
  6. // Copyright © 2018 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCCChannelInfo.h"
  9. @implementation WFCCChannelInfo
  10. - (id)toJsonObj {
  11. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  12. dict[@"channelId"] = self.channelId;
  13. dict[@"name"] = self.name;
  14. dict[@"portrait"] = self.portrait;
  15. dict[@"owner"] = self.owner;
  16. dict[@"desc"] = self.desc;
  17. dict[@"extra"] = self.extra;
  18. dict[@"secret"] = self.secret;
  19. dict[@"callback"] = self.callback;
  20. dict[@"status"] = @(self.status);
  21. [self setDict:dict key:@"updateDt" longlongValue:self.updateDt];
  22. if (self.menus.count) {
  23. NSMutableArray *subMenus = [[NSMutableArray alloc] init];
  24. [self.menus enumerateObjectsUsingBlock:^(WFCCChannelMenu * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  25. id subs = [obj toJsonObj];
  26. [subMenus addObject:subs];
  27. }];
  28. dict[@"menus"] = subMenus;
  29. }
  30. return dict;
  31. }
  32. @end