// // YMIncomeBreakdownListPointsAndEarningsSectionViewModel.m // MSYOUPAI // // Created by YoMi on 2024/3/3. // Copyright © 2024 MS. All rights reserved. // #import "YMIncomeBreakdownListPointsAndEarningsSectionViewModel.h" #import "YMPointsAndEarningsListModel.h" @interface YMIncomeBreakdownListPointsAndEarningsSectionViewModel () /// 分组标题 @property (nonatomic, copy, readwrite) NSString *sectionTitle; /// 行数据 @property (nonatomic, strong, readwrite) NSArray *rowDataArray; @end @implementation YMIncomeBreakdownListPointsAndEarningsSectionViewModel - (void)ym_initialize{ [super ym_initialize]; NSInteger categoryType = [self.params integerValueForKey:ParamsCategoryType defaultValue:0]; if ([self.params[ParamsModel] isKindOfClass:[YMPointsAndEarningsListModel class]]) { YMPointsAndEarningsListModel *model = self.params[ParamsModel]; self.sectionTitle = model.date; self.rowDataArray = [model.list.rac_sequence map:^id _Nullable(YMPointsAndEarningsItemModel * _Nullable model) { YMIncomeBreakdownListPointsAndEarningsCellViewModel *viewModel = [[YMIncomeBreakdownListPointsAndEarningsCellViewModel alloc]initWithParams:@{ ParamsModel:model, ParamsCategoryType:@(categoryType) }]; return viewModel; }].array; } } @end