Commit 5204c6265602ebc95fff645161073d332db92b12

Authored by yanglingyu
1 parent 71bb7da5

积分明细增加总积分请求逻辑

CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteDetaiListlViewController.m
@@ -48,7 +48,11 @@ @@ -48,7 +48,11 @@
48 self.pageNo = pageNo; 48 self.pageNo = pageNo;
49 self.currentType = currentType; 49 self.currentType = currentType;
50 self.currentMonth = currentMonth; 50 self.currentMonth = currentMonth;
51 - [CNLiveCMineInteViewModel requestWithIntegraDetailWithCurrentMonth:currentMonth currentType:currentType pageNo:pageNo CompleterBlock:^(CNLiveCMineInteDetailModel * _Nonnull listModel, NSArray * _Nonnull dataArray, NSError * _Nonnull error) { 51 + [CNLiveCMineInteViewModel requestWithIntegraDetailWithCurrentMonth:currentMonth currentType:currentType pageNo:pageNo integralBlock:^(CNLiveCMineInteTaskListModel * _Nonnull listModel, NSError * _Nonnull error) {
  52 + weakSelf.currentInte = listModel.integral;
  53 + weakSelf.listModel.currentInte = listModel.integral;
  54 + weakSelf.detailVC.headerView.detailModel = weakSelf.listModel;
  55 + } CompleterBlock:^(CNLiveCMineInteDetailModel * _Nonnull listModel, NSArray * _Nonnull dataArray, NSError * _Nonnull error) {
52 [self addMainRefreshView]; 56 [self addMainRefreshView];
53 if (!error && listModel) { 57 if (!error && listModel) {
54 listModel.currentInte = weakSelf.currentInte; 58 listModel.currentInte = weakSelf.currentInte;
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
@@ -46,8 +46,9 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, @@ -46,8 +46,9 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel,
46 /// @param currentMonth 时间格式 2021-12 46 /// @param currentMonth 时间格式 2021-12
47 /// @param currentType 1-全部 2-获取 3-支出 47 /// @param currentType 1-全部 2-获取 3-支出
48 /// @param pageNo 页码(默认1) 48 /// @param pageNo 页码(默认1)
  49 +/// @param integralBlock返回总积分请求结果
49 /// @param completerBlock 结果返回 50 /// @param completerBlock 结果返回
50 -+(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo CompleterBlock:(void(^)(CNLiveCMineInteDetailModel * listModel,NSArray * dataArray,NSError *error))completerBlock; 51 ++(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo integralBlock:(void(^)(CNLiveCMineInteTaskListModel *listModel,NSError *error)) integralBlock CompleterBlock:(void(^)(CNLiveCMineInteDetailModel * listModel,NSArray * dataArray,NSError *error))completerBlock;
51 52
52 @end 53 @end
53 54
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.m
@@ -176,8 +176,11 @@ @@ -176,8 +176,11 @@
176 /// @param currentType 1-全部 2-获取 3-支出 176 /// @param currentType 1-全部 2-获取 3-支出
177 /// @param pageNo 页码(默认1) 177 /// @param pageNo 页码(默认1)
178 /// @param completerBlock 结果返回 178 /// @param completerBlock 结果返回
179 -+(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo CompleterBlock:(void(^)(CNLiveCMineInteDetailModel *, NSArray *,NSError *))completerBlock 179 ++(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo integralBlock:(nonnull void (^)(CNLiveCMineInteTaskListModel * _Nonnull, NSError * _Nonnull))integralBlock CompleterBlock:(void(^)(CNLiveCMineInteDetailModel *, NSArray *,NSError *))completerBlock
180 { 180 {
  181 + NSDictionary * param = @{
  182 + @"sid":[CNUserInfoManager manager].userInfoModel.uid
  183 + };
181 NSDictionary * paramDict = @{ 184 NSDictionary * paramDict = @{
182 @"sid":[CNUserInfoManager manager].userInfoModel.uid, 185 @"sid":[CNUserInfoManager manager].userInfoModel.uid,
183 @"currentMonth":currentMonth, 186 @"currentMonth":currentMonth,
@@ -193,6 +196,17 @@ @@ -193,6 +196,17 @@
193 NSMutableArray * tempArray = listModel.integralList.mutableCopy; 196 NSMutableArray * tempArray = listModel.integralList.mutableCopy;
194 if (completerBlock) completerBlock(listModel,tempArray,error); 197 if (completerBlock) completerBlock(listModel,tempArray,error);
195 }]; 198 }];
  199 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  200 + [CNLiveNetworking setupShowDataResult:YES];
  201 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Host(@"/Daren/integral/getTasks.action") Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  202 + if (!error) {
  203 + CNLiveCMineInteTaskListModel * listModel = [CNLiveCMineInteTaskListModel mj_objectWithKeyValues:responseObject];
  204 + if (integralBlock) {
  205 + integralBlock(listModel,error);
  206 + }
  207 + }
  208 +
  209 + }];
196 } 210 }
197 211
198 @end 212 @end