// // RQVipCenterViewModel.m // jiaPei // // Created by 张嵘 on 2022/8/5. // Copyright © 2022 JCZ. All rights reserved. // #import "RQVipCenterViewModel.h" @interface RQVipCenterViewModel () @property (nonatomic, readwrite, copy) NSArray *typeModels; @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType; @end @implementation RQVipCenterViewModel #pragma mark - Public Method - (instancetype)initWithServices:(id)services params:(NSDictionary *)params { if (self = [super initWithServices:services params:params]) { self.typeModels = params[RQViewModelUtilKey]; self.homePageSubjectType = [params[RQViewCommonValueKey] integerValue]; } return self; } - (void)initialize { [super initialize]; self.title = @"会员中心"; ///配置数据 [self rq_configureData]; } // 请求数据 - (RACSignal *)requestRemoteDataSignalWithPage:(NSUInteger)page { [MBProgressHUD rq_showProgressHUD:@"获取会员套餐..."]; NSArray * (^typeModelsBlock)(NSArray *) = ^(NSArray *products) { [MBProgressHUD rq_hideHUD]; if (page == 1) { /// 下拉刷新 } else { /// 上拉加载 products = @[(self.typeModels ?: @[]).rac_sequence, products.rac_sequence].rac_sequence.flatten.array; } return products; }; return [[[self.services.client getTypeWithDictType:(!RQObjectIsNil(RQ_VIP_Module.activationModel) && RQ_VIP_Module.activationModel.isShare && !(RQ_VIP_Module.activationModel.isActive == 1))? RQ_USER_MANAGER.currentUser.city : @"vip_package"] map:typeModelsBlock] doError:^(NSError * _Nonnull error) { [MBProgressHUD rq_hideHUD]; [MBProgressHUD rq_showErrorTips:error]; }]; } #pragma mark - PrivateMethod - (void)rq_configureData { } @end