RQTreeListModel.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RQTreeListModel.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2021/10/25.
  6. // Copyright © 2021 JCZ. All rights reserved.
  7. //
  8. #import "RQTreeListModel.h"
  9. @implementation VideosItem
  10. + (NSDictionary *)modelCustomPropertyMapper {
  11. return @{
  12. @"video_url" : @"fileUrl",
  13. };
  14. }
  15. + (id)videoItemModelWithDictionary:(NSDictionary *)dic {
  16. VideosItem *item = [[VideosItem alloc] init];
  17. item.video_url = RQStringIsEmpty(item.video_url)? dic[@"videoPath"] : item.video_url;
  18. item.coverFileUrl = RQStringIsEmpty(item.coverFileUrl)? dic[@"image"] : item.coverFileUrl;
  19. item.title = RQStringIsEmpty(item.title)? dic[@"title"] : item.title;
  20. item.videoDescribe = RQStringIsEmpty(item.videoDescribe)? dic[@"content"] : item.videoDescribe;
  21. item.videoDuration = RQStringIsEmpty(item.videoDuration)? [NSString stringWithFormat:@"%@",dic[@"times"]] : item.videoDuration;
  22. return item;
  23. }
  24. @end
  25. @implementation ChildrenItem
  26. // 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
  27. + (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass {
  28. return @{
  29. @"children" : [ChildrenItem class],
  30. @"videos" : [VideosItem class],
  31. };
  32. }
  33. @end
  34. @implementation RQTreeListModel
  35. // 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
  36. + (NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass {
  37. return @{
  38. @"children" : [ChildrenItem class],
  39. @"videos" : [VideosItem class],
  40. };
  41. }
  42. @end