Commit 8343895549175f691a793c59a0aceae9133777cc
1 parent
9b447d4c
任务总积分网络请求修改
Showing
4 changed files
with
34 additions
and
15 deletions
CNLiveCMineModule.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveCMineModule' | 10 | s.name = 'CNLiveCMineModule' |
| 11 | - s.version = '0.1.0' | 11 | + s.version = '0.1.1' |
| 12 | s.summary = '网家家C端个人中心' | 12 | s.summary = '网家家C端个人中心' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
CNLiveCMineModule/Classes/inte/Controller/CNLiveCMineInteDetaiListlViewController.m
| @@ -42,17 +42,27 @@ | @@ -42,17 +42,27 @@ | ||
| 42 | [self requestDataSourceWithPageNo:1 CurrentMonth:self.currentMonth CurrentType:self.currentType]; | 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 | -(void)requestDataSourceWithPageNo:(NSInteger)pageNo CurrentMonth:(NSString *)currentMonth CurrentType:(NSInteger)currentType | 59 | -(void)requestDataSourceWithPageNo:(NSInteger)pageNo CurrentMonth:(NSString *)currentMonth CurrentType:(NSInteger)currentType |
| 46 | { | 60 | { |
| 47 | __weak typeof(self) weakSelf = self; | 61 | __weak typeof(self) weakSelf = self; |
| 48 | self.pageNo = pageNo; | 62 | self.pageNo = pageNo; |
| 49 | self.currentType = currentType; | 63 | self.currentType = currentType; |
| 50 | self.currentMonth = currentMonth; | 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 | [self addMainRefreshView]; | 66 | [self addMainRefreshView]; |
| 57 | if (!error && listModel) { | 67 | if (!error && listModel) { |
| 58 | listModel.currentInte = weakSelf.currentInte; | 68 | listModel.currentInte = weakSelf.currentInte; |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.h
| @@ -41,14 +41,16 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, | @@ -41,14 +41,16 @@ typedef void(^ClickActionBlock)(CNLiveCMineInteScoreModel * scoreModel, | ||
| 41 | /// @param completerBlock 请求结果返回 | 41 | /// @param completerBlock 请求结果返回 |
| 42 | +(void)requestWithIntegraTaskWithSignMedthodForCompleterBlock:(void(^)(NSMutableArray * dataArray, NSString * errorMessage))completerBlock; | 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 | /// @param currentMonth 时间格式 2021-12 | 49 | /// @param currentMonth 时间格式 2021-12 |
| 47 | /// @param currentType 1-全部 2-获取 3-支出 | 50 | /// @param currentType 1-全部 2-获取 3-支出 |
| 48 | /// @param pageNo 页码(默认1) | 51 | /// @param pageNo 页码(默认1) |
| 49 | -/// @param integralBlock返回总积分请求结果 | ||
| 50 | /// @param completerBlock 结果返回 | 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 | @end | 55 | @end |
| 54 | 56 |
CNLiveCMineModule/Classes/inte/ViewModel/CNLiveCMineInteViewModel.m
| @@ -176,11 +176,9 @@ | @@ -176,11 +176,9 @@ | ||
| 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 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 | NSDictionary * paramDict = @{ | 182 | NSDictionary * paramDict = @{ |
| 185 | @"sid":[CNUserInfoManager manager].userInfoModel.uid, | 183 | @"sid":[CNUserInfoManager manager].userInfoModel.uid, |
| 186 | @"currentMonth":currentMonth, | 184 | @"currentMonth":currentMonth, |
| @@ -196,15 +194,24 @@ | @@ -196,15 +194,24 @@ | ||
| 196 | NSMutableArray * tempArray = listModel.integralList.mutableCopy; | 194 | NSMutableArray * tempArray = listModel.integralList.mutableCopy; |
| 197 | if (completerBlock) completerBlock(listModel,tempArray,error); | 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 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Host(@"/Daren/integral/getTasks.action") Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { | 207 | [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:cn_API_Host(@"/Daren/integral/getTasks.action") Param:param CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) { |
| 200 | if (!error) { | 208 | if (!error) { |
| 201 | CNLiveCMineInteTaskListModel * listModel = [CNLiveCMineInteTaskListModel mj_objectWithKeyValues:responseObject]; | 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 | @end | 217 | @end |