Commit 5204c6265602ebc95fff645161073d332db92b12
1 parent
71bb7da5
积分明细增加总积分请求逻辑
Showing
3 changed files
with
22 additions
and
3 deletions
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteDetaiListlViewController.m
| ... | ... | @@ -48,7 +48,11 @@ |
| 48 | 48 | self.pageNo = pageNo; |
| 49 | 49 | self.currentType = currentType; |
| 50 | 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 | 56 | [self addMainRefreshView]; |
| 53 | 57 | if (!error && listModel) { |
| 54 | 58 | listModel.currentInte = weakSelf.currentInte; | ... | ... |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
| ... | ... | @@ -46,8 +46,9 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, |
| 46 | 46 | /// @param currentMonth 时间格式 2021-12 |
| 47 | 47 | /// @param currentType 1-全部 2-获取 3-支出 |
| 48 | 48 | /// @param pageNo 页码(默认1) |
| 49 | +/// @param integralBlock返回总积分请求结果 | |
| 49 | 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 | 53 | @end |
| 53 | 54 | ... | ... |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.m
| ... | ... | @@ -176,8 +176,11 @@ |
| 176 | 176 | /// @param currentType 1-全部 2-获取 3-支出 |
| 177 | 177 | /// @param pageNo 页码(默认1) |
| 178 | 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 | 184 | NSDictionary * paramDict = @{ |
| 182 | 185 | @"sid":[CNUserInfoManager manager].userInfoModel.uid, |
| 183 | 186 | @"currentMonth":currentMonth, |
| ... | ... | @@ -193,6 +196,17 @@ |
| 193 | 196 | NSMutableArray * tempArray = listModel.integralList.mutableCopy; |
| 194 | 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 | 212 | @end | ... | ... |