YMIncomeBreakdownListPointsAndEarningsSectionViewModel.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // YMIncomeBreakdownListPointsAndEarningsSectionViewModel.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/3.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMIncomeBreakdownListPointsAndEarningsSectionViewModel.h"
  9. #import "YMPointsAndEarningsListModel.h"
  10. @interface YMIncomeBreakdownListPointsAndEarningsSectionViewModel ()
  11. /// 分组标题
  12. @property (nonatomic, copy, readwrite) NSString *sectionTitle;
  13. /// 行数据
  14. @property (nonatomic, strong, readwrite) NSArray <YMIncomeBreakdownListPointsAndEarningsCellViewModel*>*rowDataArray;
  15. @end
  16. @implementation YMIncomeBreakdownListPointsAndEarningsSectionViewModel
  17. - (void)ym_initialize{
  18. [super ym_initialize];
  19. NSInteger categoryType = [self.params integerValueForKey:ParamsCategoryType defaultValue:0];
  20. if ([self.params[ParamsModel] isKindOfClass:[YMPointsAndEarningsListModel class]]) {
  21. YMPointsAndEarningsListModel *model = self.params[ParamsModel];
  22. self.sectionTitle = model.date;
  23. self.rowDataArray = [model.list.rac_sequence map:^id _Nullable(YMPointsAndEarningsItemModel * _Nullable model) {
  24. YMIncomeBreakdownListPointsAndEarningsCellViewModel *viewModel = [[YMIncomeBreakdownListPointsAndEarningsCellViewModel alloc]initWithParams:@{
  25. ParamsModel:model,
  26. ParamsCategoryType:@(categoryType)
  27. }];
  28. return viewModel;
  29. }].array;
  30. }
  31. }
  32. @end