Commit 8343895549175f691a793c59a0aceae9133777cc
1 parent
9b447d4c
任务总积分网络请求修改
Showing
4 changed files
with
34 additions
and
15 deletions
CNLiveCMineModule.podspec
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteDetaiListlViewController.m
| ... | ... | @@ -42,17 +42,27 @@ |
| 42 | 42 | [self requestDataSourceWithPageNo:1 CurrentMonth:self.currentMonth CurrentType:self.currentType]; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | +- (void)viewWillAppear:(BOOL)animated | |
| 46 | +{ | |
| 47 | + [super viewWillAppear:animated]; | |
| 48 | + [self requestIntegralTask]; | |
| 49 | +} | |
| 50 | + | |
| 51 | +- (void)requestIntegralTask{ | |
| 52 | + __weak typeof(self) weakSelf = self; | |
| 53 | + [CNLiveCMineInteViewModel requestIntegralTaskComperBlock:^(CNLiveCMineInteTaskListModel * _Nonnull listModel, NSError * _Nonnull error) { | |
| 54 | + weakSelf.currentInte = listModel.integral; | |
| 55 | + weakSelf.listModel.currentInte = listModel.integral; | |
| 56 | + weakSelf.detailVC.headerView.detailModel = weakSelf.listModel; | |
| 57 | + }]; | |
| 58 | +} | |
| 45 | 59 | -(void)requestDataSourceWithPageNo:(NSInteger)pageNo CurrentMonth:(NSString *)currentMonth CurrentType:(NSInteger)currentType |
| 46 | 60 | { |
| 47 | 61 | __weak typeof(self) weakSelf = self; |
| 48 | 62 | self.pageNo = pageNo; |
| 49 | 63 | self.currentType = currentType; |
| 50 | 64 | self.currentMonth = currentMonth; |
| 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) { | |
| 65 | + [CNLiveCMineInteViewModel requestWithIntegraDetailWithCurrentMonth:currentMonth currentType:currentType pageNo:pageNo CompleterBlock:^(CNLiveCMineInteDetailModel * _Nonnull listModel, NSArray * _Nonnull dataArray, NSError * _Nonnull error) { | |
| 56 | 66 | [self addMainRefreshView]; |
| 57 | 67 | if (!error && listModel) { |
| 58 | 68 | listModel.currentInte = weakSelf.currentInte; | ... | ... |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
| ... | ... | @@ -41,14 +41,16 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, |
| 41 | 41 | /// @param completerBlock 请求结果返回 |
| 42 | 42 | +(void)requestWithIntegraTaskWithSignMedthodForCompleterBlock:(void(^)(NSMutableArray * dataArray, NSString * errorMessage))completerBlock; |
| 43 | 43 | |
| 44 | +/// 请求总积分数借口 | |
| 45 | +/// @param comperBlock 结果返回 | |
| 46 | ++(void)requestIntegralTaskComperBlock:(void(^)(CNLiveCMineInteTaskListModel *listModel,NSError *error))comperBlock; | |
| 44 | 47 | |
| 45 | 48 | /// 获取积分明细(新) |
| 46 | 49 | /// @param currentMonth 时间格式 2021-12 |
| 47 | 50 | /// @param currentType 1-全部 2-获取 3-支出 |
| 48 | 51 | /// @param pageNo 页码(默认1) |
| 49 | -/// @param integralBlock返回总积分请求结果 | |
| 50 | 52 | /// @param 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; | |
| 53 | ++(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo CompleterBlock:(void(^)(CNLiveCMineInteDetailModel * listModel,NSArray * dataArray,NSError *error))completerBlock; | |
| 52 | 54 | |
| 53 | 55 | @end |
| 54 | 56 | ... | ... |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.m
| ... | ... | @@ -176,11 +176,9 @@ |
| 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 integralBlock:(nonnull void (^)(CNLiveCMineInteTaskListModel * _Nonnull, NSError * _Nonnull))integralBlock CompleterBlock:(void(^)(CNLiveCMineInteDetailModel *, NSArray *,NSError *))completerBlock | |
| 179 | ++(void)requestWithIntegraDetailWithCurrentMonth:(NSString *)currentMonth currentType:(NSInteger)currentType pageNo:(NSInteger)pageNo CompleterBlock:(void(^)(CNLiveCMineInteDetailModel *, NSArray *,NSError *))completerBlock | |
| 180 | 180 | { |
| 181 | - NSDictionary * param = @{ | |
| 182 | - @"sid":[CNUserInfoManager manager].userInfoModel.uid | |
| 183 | - }; | |
| 181 | + | |
| 184 | 182 | NSDictionary * paramDict = @{ |
| 185 | 183 | @"sid":[CNUserInfoManager manager].userInfoModel.uid, |
| 186 | 184 | @"currentMonth":currentMonth, |
| ... | ... | @@ -196,15 +194,24 @@ |
| 196 | 194 | NSMutableArray * tempArray = listModel.integralList.mutableCopy; |
| 197 | 195 | if (completerBlock) completerBlock(listModel,tempArray,error); |
| 198 | 196 | }]; |
| 197 | +} | |
| 198 | + | |
| 199 | +/// 请求总积分数借口 | |
| 200 | +/// @param comperBlock 结果返回 | |
| 201 | ++(void)requestIntegralTaskComperBlock:(void(^)(CNLiveCMineInteTaskListModel *listModel,NSError *error))comperBlock{ | |
| 202 | + NSDictionary * param = @{ | |
| 203 | + @"sid":[CNUserInfoManager manager].userInfoModel.uid | |
| 204 | + }; | |
| 205 | + [CNLiveNetworking setAllowRequestDefaultArgument:YES]; | |
| 206 | + [CNLiveNetworking setupShowDataResult:YES]; | |
| 199 | 207 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Host(@"/Daren/integral/getTasks.action") Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 200 | 208 | if (!error) { |
| 201 | 209 | CNLiveCMineInteTaskListModel * listModel = [CNLiveCMineInteTaskListModel mj_objectWithKeyValues:responseObject]; |
| 202 | - if (integralBlock) { | |
| 203 | - integralBlock(listModel,error); | |
| 210 | + if (comperBlock) { | |
| 211 | + comperBlock(listModel,error); | |
| 204 | 212 | } |
| 205 | 213 | } |
| 206 | 214 | |
| 207 | 215 | }]; |
| 208 | 216 | } |
| 209 | - | |
| 210 | 217 | @end | ... | ... |