Browse Source

首页接口刷新逻辑调整

Steven 7 months ago
parent
commit
e96e604d06

+ 14 - 33
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.m

@@ -58,10 +58,8 @@
 
 #import "JXCategoryView.h"
 #import "JXPagerListRefreshView.h"
-#import "HomePageBodyView.h"
 #import "HomeInformationBodyView.h"
 
-#import "TeacherStyleModel.h"
 #import "HomeTeacherLiveModel.h"
 
 #import "ToneTuningViewController.h"
@@ -144,8 +142,6 @@
 
 @property (nonatomic, assign) NSInteger headViewHeight;
 
-
-@property (nonatomic, strong) NSMutableArray *teacherArray;
 @property (nonatomic, strong) NSMutableArray *liveListArray;
 @property (nonatomic, strong) NSMutableArray *informationArray;
 
@@ -459,6 +455,9 @@
             [self requestData];
         }
     }
+    else { // 刷新老师数据
+        [self refreshTalentAndRefresh];
+    }
 }
 
 - (void)showInstrumentView:(BOOL)hideBackButton {
@@ -620,28 +619,27 @@
     }];
 }
 
-- (void)requestTeacherStyle {
-    dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager homeQueryTeacherStyle:KS_POST page:1 rows:10 version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
+- (void)refreshTalentAndRefresh {
+    [KSNetworkingManager queryHotTeacherListRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
-            NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"rows"];
-            NSMutableArray *styleArray = [NSMutableArray array];
+            NSArray *sourceArray = [dic ks_arrayValueForKey:@"data"];
+            NSMutableArray *talentArray = [NSMutableArray array];
             for (NSDictionary *parm in sourceArray) {
-                TeacherStyleModel *model = [[TeacherStyleModel alloc] initWithDictionary:parm];
-                [styleArray addObject:model];
+                TalentTeacherModel *model = [[TalentTeacherModel alloc] initWithDictionary:parm];
+                [talentArray addObject:model];
             }
-            self.teacherArray = [NSMutableArray arrayWithArray:styleArray];
+            self.talentArray = [NSMutableArray arrayWithArray:talentArray];
         }
         else {
             [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
         }
-        // 回调
+        [self refreshTalentView];
     } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
+        
     }];
 }
 
+
 - (void)requestLiveList {
     dispatch_group_enter(self.requestGroup);
     [KSNetworkingManager queryTeacherLivingListRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
@@ -693,7 +691,6 @@
     [self requestCourseInfo];
     // 老师
     [self requestTalentSource];
-    [self requestTeacherStyle];
     [self requestLiveList];
     [self requestInformationList];
     if ([self checkHasShowAwardAlert] == NO) {
@@ -795,13 +792,7 @@
 - (void)refreshPageView {
     for (NSInteger i = 0; i < self.listViewArray.count; i++) {
         id view = self.listViewArray[i];
-        if ([view isKindOfClass:[HomePageBodyView class]]) {
-            HomePageBodyView *styleView = (HomePageBodyView *)view;
-            styleView.styleArray = [self.teacherArray mutableCopy];
-            styleView.liveArray = [self.liveListArray mutableCopy];
-            [styleView resetAndRefresh];
-        }
-        else if ([view isKindOfClass:[HomeInformationBodyView class]]) {
+         if ([view isKindOfClass:[HomeInformationBodyView class]]) {
             HomeInformationBodyView *informationView = (HomeInformationBodyView *)view;
             informationView.informationArray = [self.informationArray mutableCopy];
             [informationView beginFirstRefresh];
@@ -1026,10 +1017,6 @@
             KSJXBodyView *listView = (KSJXBodyView *)value;
             [listView beginFirstRefresh];
         }
-        else if ([value isKindOfClass:[kSJXCollectionView class]]) {
-            kSJXCollectionView *listView = (kSJXCollectionView *)value;
-            [listView beginFirstRefresh];
-        }
     }
 }
 
@@ -1579,12 +1566,6 @@
     return _informationArray;
 }
 
-- (NSMutableArray *)teacherArray {
-    if (!_teacherArray) {
-        _teacherArray = [NSMutableArray array];
-    }
-    return _teacherArray;
-}
 
 - (NSMutableArray *)liveListArray {
     if (!_liveListArray) {

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/NoticeCenter/Controller/NotiferMessageViewController.m

@@ -357,7 +357,7 @@
     [self.navigationController pushViewController:ctrl animated:YES];
 }
 - (void)toCourseTable {
-    [self selectBarHomeWithIndex:1];
+    [self selectBarHomeWithIndex:2];
     [self.navigationController popToRootViewControllerAnimated:YES];
 }