'''
NSString *keyName = [NSString stringWithFormat:@"/Documents/wordClass_%@_%ld.json",[PlayerInfoModel shared].uid,self.studyInfoModel.courseId];
NSDictionary *dic = [AppUntils readLocalFileWithName:keyName];
self.model = [WordsMainModel modelWithDictionary:dic];
self.isDone = 0;
NSString *filePath_fist = [NSString stringWithFormat:@"/Documents/wordInfo_%ld_%@",self.studyInfoModel.courseId,[self.model.wordsArr firstObject]];
NSDictionary *fistDic = [AppUntils readLocalFileWithName:filePath_fist];
//创建一个NSBlockOperation对象,传入一个block
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
queue.maxConcurrentOperationCount = 1000;
if (fistDic != nil) {
self.progressView.hidden = NO;
DLog(@"---------- 开始下载 -----------");
for (int i = 0; i < self.model.wordsArr.count; i ++) {
NSString *urlString = [NSString stringWithFormat:@"%@word/file?courseId=%ld&word=%@&fileType=0",ApiString,(long)self.studyInfoModel.courseId,[AppUntils hexStringFromString:[self.model.wordsArr objectAtIndex:i]]];
NSString *filePath = [NSString stringWithFormat:@"/Documents/wordInfo_%ld_%@",self.studyInfoModel.courseId,[self.model.wordsArr objectAtIndex:i]];
NSString *urlString_2 = [NSString stringWithFormat:@"%@word/file?courseId=%ld&word=%@&fileType=2",ApiString,(long)self.studyInfoModel.courseId,[AppUntils hexStringFromString:[self.model.wordsArr objectAtIndex:i]]];
NSString *filePath_2 = [NSString stringWithFormat:@"/Documents/word_audio_uk_%ld_%@",self.studyInfoModel.courseId,[self.model.wordsArr objectAtIndex:i]];
NSString *urlString_3 = [NSString stringWithFormat:@"%@word/file?courseId=%ld&word=%@&fileType=3",ApiString,(long)self.studyInfoModel.courseId,[AppUntils hexStringFromString:[self.model.wordsArr objectAtIndex:i]]];
NSString *filePath_3 = [NSString stringWithFormat:@"/Documents/word_audio_en_%ld_%@",self.studyInfoModel.courseId,[self.model.wordsArr objectAtIndex:i]];
DLog(@"第%d个任务加入队列",i);
[queue addOperationWithBlock:^{
[XHNetworking GET:urlString parameters:@{} success:^(id responseObject) {
NSString *receiveStr = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
self.isDone ++;
NSData * datas = [receiveStr dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:datas options:NSJSONReadingMutableLeaves error:nil];
[AppUntils writJson:jsonDict WithKeyName:filePath];
} failure:^(NSError *error) {
DLog(@">>>>>>>>wordInfo下载失败");
self.isDone ++;
}];
}];
[queue addOperationWithBlock:^{
[XHNetworking GET:urlString_2 parameters:@{} success:^(id responseObject) {
[AppUntils writData:responseObject WithKeyName:filePath_2];
self.isDone ++;
} failure:^(NSError *error) {
self.isDone ++;
DLog(@">>>>>>>>音频1下载失败");
}];
}];
[queue addOperationWithBlock:^{
[XHNetworking GET:urlString_3 parameters:@{} success:^(id responseObject) {
[AppUntils writData:responseObject WithKeyName:filePath_3];
self.isDone ++;
} failure:^(NSError *error) {
self.isDone ++;
DLog(@">>>>>>>>音频2下载失败");
}];
}];
}
}
'''