소스 검색

黑名单搜索模糊匹配

Steven 2 달 전
부모
커밋
ea2ab2b325
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      KulexiuForTeacher/KulexiuForTeacher/Module/Chat/View/ChatBlackListBodyView.m

+ 11 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/View/ChatBlackListBodyView.m

@@ -131,7 +131,17 @@
             else {
             else {
                 model.roleType = @"STUDENT";
                 model.roleType = @"STUDENT";
             }
             }
-            [self.blackListArray addObject:model];
+            // 模糊匹配条件
+            BOOL shouldAdd = YES;
+            if (self.searchKey.length > 0) {
+                NSString *searchText = [self.searchKey lowercaseString];
+                NSString *nickname = [info.userFullInfo.nickName lowercaseString];
+                shouldAdd = [nickname containsString:searchText];
+            }
+
+            if (shouldAdd) {
+                [self.blackListArray addObject:model];
+            }
         }
         }
         [self changePromptLabelStateWithArray:self.blackListArray];
         [self changePromptLabelStateWithArray:self.blackListArray];
         [self.tableView reloadData];
         [self.tableView reloadData];