소스 검색

模拟考试,修改成api 取题

openlockPPP 1 년 전
부모
커밋
b2c9406fb2

+ 6 - 0
SDJK.xcodeproj/project.pbxproj

@@ -38,6 +38,7 @@
 		85ECB151279AA7AA0008F45E /* MPTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 85ECB14F279AA7A90008F45E /* MPTransition.m */; };
 		85ECB152279AA7AA0008F45E /* MPUserDynamicTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 85ECB150279AA7A90008F45E /* MPUserDynamicTransition.m */; };
 		8D4B373DA8B72000086B74AF /* libPods-SDJK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9FE044E85A0834D96AB68FA /* libPods-SDJK.a */; };
+		901FDA3A2B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.m in Sources */ = {isa = PBXBuildFile; fileRef = 901FDA392B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.m */; };
 		9C4E370607084E9AC4FB2183 /* libPods-NotificationService.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E2AE1200CC8E3289DDD48217 /* libPods-NotificationService.a */; };
 		D000701D29EE696A00DC1CEB /* RQHTTPService+RQCollections.m in Sources */ = {isa = PBXBuildFile; fileRef = D000701C29EE696A00DC1CEB /* RQHTTPService+RQCollections.m */; };
 		D000701F29EE6F0900DC1CEB /* user.db in Resources */ = {isa = PBXBuildFile; fileRef = D000701E29EE6F0900DC1CEB /* user.db */; };
@@ -637,6 +638,8 @@
 		85ECB14E279AA7A90008F45E /* MPTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTransition.h; sourceTree = "<group>"; };
 		85ECB14F279AA7A90008F45E /* MPTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTransition.m; sourceTree = "<group>"; };
 		85ECB150279AA7A90008F45E /* MPUserDynamicTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPUserDynamicTransition.m; sourceTree = "<group>"; };
+		901FDA382B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RQHTTPService+SelectTestK14QuestionInfoList.h"; sourceTree = "<group>"; };
+		901FDA392B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RQHTTPService+SelectTestK14QuestionInfoList.m"; sourceTree = "<group>"; };
 		A018283DDB3F90044487C9A2 /* Pods-SDJK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDJK.release.xcconfig"; path = "Target Support Files/Pods-SDJK/Pods-SDJK.release.xcconfig"; sourceTree = "<group>"; };
 		A9FE044E85A0834D96AB68FA /* libPods-SDJK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SDJK.a"; sourceTree = BUILT_PRODUCTS_DIR; };
 		D000701B29EE696A00DC1CEB /* RQHTTPService+RQCollections.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RQHTTPService+RQCollections.h"; sourceTree = "<group>"; };
@@ -1771,6 +1774,8 @@
 				D0B3FC41286AC6FA003C52BA /* RQHTTPService+RQGetSelectMiQuestionInfoList.m */,
 				D0C414852874047C0036692E /* RQExplainModel.h */,
 				D0C414862874047C0036692E /* RQExplainModel.m */,
+				901FDA382B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.h */,
+				901FDA392B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -4927,6 +4932,7 @@
 				D02A4EC726BBD36000BB73F9 /* UITableView+YYAdd.m in Sources */,
 				D0438A8C26D792C000FA6434 /* RQHTTPService+RQGetScoreInfoList.m in Sources */,
 				D079A6D026AFD5A200EA90F4 /* RQHTTPService+RQRegister.m in Sources */,
+				901FDA3A2B33E3EA0014816E /* RQHTTPService+SelectTestK14QuestionInfoList.m in Sources */,
 				D079A80926AFD5A200EA90F4 /* YYAnimatedImageView+RQExtension.m in Sources */,
 				D0B68D532871626C00B2A5EA /* RQExercisExplainItemViewModel.m in Sources */,
 				D0B3FCAF286DACFF003C52BA /* UIView+QQCorner.m in Sources */,

+ 54 - 3
SDJK/Modules/OtherModule/ExerciseModule/Controller/RQExerciseSubViewController.m

@@ -351,9 +351,61 @@
 
 ///  根据车型取题
 - (void)changeCityQuestion {
-//    @weakify(self)
-    self.questionArr = [RQ_QUESTION_DB_MANAGER getQuestionWithCarType:self.viewModel.homePageCarType subject:self.viewModel.homePageSubjectType pageType:self.viewModel.homeSubPageType name:self.viewModel.titleStr exerciseType:self.viewModel.exerciseType].mutableCopy;
     
+    if (self.viewModel.homeSubPageType == RQHomeSubPageType_MockExamination &&
+        self.viewModel.exerciseType == RQExerciseType_Exam) { //模拟考从网络获取考题
+        @weakify(self)
+        ///  默认为轿车 cart,bus,truck
+        NSString *carTypeStr = @"cart";
+        switch (self.viewModel.homePageCarType) {
+            case RQHomePageCarType_Car:
+                carTypeStr = @"cart";
+                break;
+            case RQHomePageCarType_Bus:
+                carTypeStr = @"bus";
+                break;
+            case RQHomePageCarType_Truck:
+                carTypeStr = @"truck";
+                break;
+            case RQHomePageCarType_Motorcycle:
+                carTypeStr = @"mtc";
+                break;
+                
+            default:
+                break;
+        }
+        ///  默认科目一
+        NSString *subjectTypeStr = @"1";
+        switch (self.viewModel.homePageSubjectType) {
+            case RQHomePageSubjectType_SubjectOne:
+                subjectTypeStr = @"1";
+                break;
+            case RQHomePageSubjectType_SubjectTwo:
+                subjectTypeStr = @"2";
+                break;
+            case RQHomePageSubjectType_SubjectThree:
+                subjectTypeStr = @"3";
+                break;
+            case RQHomePageSubjectType_SubjectFour:
+                subjectTypeStr = @"4";
+                break;
+            default:
+                break;
+        }
+        [[[RQ_HTTP_Service getSelectTestK14QuestionInfoList:carTypeStr subject:subjectTypeStr] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSArray *array) {
+            //获取考题
+            @strongify(self)
+            self.questionArr = array.mutableCopy;
+            [self setup_dataarray];
+        } error:^(NSError * _Nullable error) {
+        }];
+        return;
+    }
+    self.questionArr = [RQ_QUESTION_DB_MANAGER getQuestionWithCarType:self.viewModel.homePageCarType subject:self.viewModel.homePageSubjectType pageType:self.viewModel.homeSubPageType name:self.viewModel.titleStr exerciseType:self.viewModel.exerciseType].mutableCopy;
+    [self setup_dataarray];
+}
+
+- (void)setup_dataarray{
     NSString *titleStr = [self.viewModel.title componentsSeparatedByString:@"/"].lastObject;
     RQHistoryModel *history = [RQ_SDJK_DB_MANAGER queryHistoryModelWithCarType:self.viewModel.homePageCarType subjectType:self.viewModel.homePageSubjectType homeSubPageTyp:self.viewModel.homeSubPageType titleStr:titleStr];
     if (!RQObjectIsNil(history)) {
@@ -389,7 +441,6 @@
         [self creatCoverVC];
         [self creatToolsBar];
     }
-    
 }
 
 ///  查看答题记录

+ 14 - 10
SDJK/Modules/OtherModule/ExerciseModule/Model/RQExerciseModel.h

@@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
  *  一点通问题id
  */
 @property (nonatomic, readwrite, assign) NSInteger id_ydt;
-
+@property (nonatomic, readwrite, assign) NSInteger idYdt;
 /**
  *  问题序号
  */
@@ -56,22 +56,22 @@ NS_ASSUME_NONNULL_BEGIN
  *  技巧讲解图片URL
  */
 @property (nonatomic, readwrite, copy) NSString *explain_gif;
-
+@property (nonatomic, readwrite, copy) NSString *explainGif;
 /**
  *  技巧讲解说明
  */
 @property (nonatomic, readwrite, copy) NSString *explain_jq;
-
+@property (nonatomic, readwrite, copy) NSString *explainJq;
 /**
  *  官方解释
  */
 @property (nonatomic, readwrite, copy) NSString *explain_js;
-
+@property (nonatomic, readwrite, copy) NSString *explainJs;
 /**
  *  技巧讲解语音URL
  */
 @property (nonatomic, readwrite, copy) NSString *explain_mp3;
-
+@property (nonatomic, readwrite, copy) NSString *explainMp3;
 /**
  *  题目图片URL
  */
@@ -81,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
  *  题目图片URL2
  */
 @property (nonatomic, readwrite, copy) NSString *image_ydt;
-
+@property (nonatomic, readwrite, copy) NSString *imageYdt;
 /**
  *  题目
  */
@@ -206,6 +206,7 @@ NS_ASSUME_NONNULL_BEGIN
  *  题目类型1判断题2单选题3多选题
  */
 @property (nonatomic, readwrite, assign) NSInteger question_type;
+@property (nonatomic, readwrite, assign) NSInteger questionType;
 
 /**
  *  题目在分类中所属的模块排序
@@ -230,17 +231,17 @@ NS_ASSUME_NONNULL_BEGIN
  *  章节ID
  */
 @property (nonatomic, readwrite, assign) NSInteger chapter_id;
-
+@property (nonatomic, readwrite, assign) NSInteger chapterId;
 /**
  *  难度等级
  */
 @property (nonatomic, readwrite, assign) NSInteger diff_degree;
-
+@property (nonatomic, readwrite, assign) NSInteger diffDegree;
 /**
  *  是否为新规题
  */
 @property (nonatomic, readwrite, assign) BOOL is_new;
-
+@property (nonatomic, readwrite, assign) BOOL isNew;
 /**
  *  错误率
  */
@@ -254,7 +255,10 @@ NS_ASSUME_NONNULL_BEGIN
  *  用户选项
  */
 @property (nonatomic, readwrite, copy) NSString *userAnswer;
-
+/**
+ *  model
+ */
+@property (nonatomic, readwrite, copy) NSString *model;
 /**
  *  是否收藏0收藏1否
  */

+ 60 - 0
SDJK/Modules/OtherModule/ExerciseModule/Model/RQExerciseModel.m

@@ -76,6 +76,66 @@
     return exerciseModel;
 }
 
+- (void)setChapterId:(NSInteger)chapterId
+{
+    _chapterId = chapterId;
+    _chapter_id = chapterId;
+}
+
+- (void)setQuestionType:(NSInteger)questionType
+{
+    _questionType = questionType;
+    _question_type = questionType;
+}
+
+- (void)setExplainGif:(NSString *)explainGif
+{
+    _explainGif = explainGif;
+    _explain_gif = explainGif;
+}
+
+- (void)setExplainJq:(NSString *)explainJq
+{
+    _explainJq = explainJq;
+    _explain_jq = explainJq;
+}
+
+- (void)setExplainJs:(NSString *)explainJs
+{
+    _explainJs = explainJs;
+    _explain_js = explainJs;
+}
+
+- (void)setExplainMp3:(NSString *)explainMp3
+{
+    _explainMp3 = explainMp3;
+    _explain_mp3 = explainMp3;
+}
+
+- (void)setImageYdt:(NSString *)imageYdt
+{
+    _imageYdt = imageYdt;
+    _image_ydt = imageYdt;
+}
+
+- (void)setIsNew:(BOOL)isNew
+{
+    _isNew = isNew;
+    _is_new = isNew;
+}
+
+- (void)setDiffDegree:(NSInteger)diffDegree
+{
+    _diffDegree = diffDegree;
+    _diff_degree = diffDegree;
+}
+
+- (void)setIdYdt:(NSInteger)idYdt
+{
+    _idYdt = idYdt;
+    _id_ydt = idYdt;
+}
+
 - (void)setUserAnswer:(NSString *)userAnswer {
     _userAnswer = userAnswer;
     if (![userAnswer containsString:@"预选Option"]) {

+ 23 - 0
SDJK/Modules/OtherModule/QuestionModule/Model/RQHTTPService+SelectTestK14QuestionInfoList.h

@@ -0,0 +1,23 @@
+//
+//  RQHTTPService+SelectTestK14QuestionInfoList.h
+//  SDJK
+//
+//  Created by Ning.ge on 2023/12/21.
+//
+
+#import "RQHTTPService.h"
+
+#define RQ_GET_SelectTestK14QuestionInfoList         @"https://jpcj.zzxcx.net/jpcj-admin/open-api/question2/info/selectTestK14QuestionInfoList"
+NS_ASSUME_NONNULL_BEGIN
+
+@interface RQHTTPService (SelectTestK14QuestionInfoList)
+
+/**
+ 取模拟考试题库
+ @return Returns a signal which will send complete, or error.
+ */
+- (RACSignal *)getSelectTestK14QuestionInfoList:(NSString*)model subject:(NSString *)subject;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 30 - 0
SDJK/Modules/OtherModule/QuestionModule/Model/RQHTTPService+SelectTestK14QuestionInfoList.m

@@ -0,0 +1,30 @@
+//
+//  RQHTTPService+SelectTestK14QuestionInfoList.m
+//  SDJK
+//
+//  Created by Ning.ge on 2023/12/21.
+//
+
+#import "RQHTTPService+SelectTestK14QuestionInfoList.h"
+
+@implementation RQHTTPService (SelectTestK14QuestionInfoList)
+
+/**
+ 取模拟考试题库
+ @return Returns a signal which will send complete, or error.
+ */
+- (RACSignal *)getSelectTestK14QuestionInfoList:(NSString*)model subject:(NSString *)subject{
+    /// 1. 配置参数
+    RQKeyedSubscript *subscript = [RQKeyedSubscript subscript];
+    subscript[@"model"] = model;
+    subscript[@"subject"] = subject;
+
+    /// 2. 配置参数模型
+    RQURLParameters *paramters = [RQURLParameters urlParametersWithMethod:RQ_HTTTP_METHOD_GET path:RQ_GET_SelectTestK14QuestionInfoList parameters:subscript.dictionary];
+    
+    /// 3.发起请求
+    return [[[RQHTTPRequest requestWithParameters:paramters]
+             enqueueResultClass:[RQExerciseModel class]]
+            rq_parsedResults];
+}
+@end

+ 1 - 0
SDJK/Modules/OtherModule/QuestionModule/RQQuestionModule.h

@@ -28,6 +28,7 @@ typedef NS_ENUM(NSUInteger, RQQuestionUpdateViewType) {
 #pragma mark - Vendor
 
 #pragma mark - Model
+#import "RQHTTPService+SelectTestK14QuestionInfoList.h"
 #import "RQHTTPService+RQGetVersionList.h"
 #import "RQExamRuleModel.h"
 #import "RQHTTPService+RQGetSelectMiQuestionInfoList.h"

+ 161 - 137
SDJK/Utils/Manager/QuestionDBManager/RQQuestionDBManager.m

@@ -176,16 +176,19 @@ static id rq_questionDBManager = nil;
     NSMutableArray *arr = @[].mutableCopy;
     ///  默认为轿车 cart,bus,truck
     NSString *queryCarTypeStr = @"model LIKE '%cart%'";
-    
+    NSString *carTypeStr = @"cart";
     switch (carType) {
         case RQHomePageCarType_Car:
             queryCarTypeStr = @"model LIKE '%cart%'";
+            carTypeStr = @"cart";
             break;
         case RQHomePageCarType_Bus:
             queryCarTypeStr = @"model LIKE '%bus%'";
+            carTypeStr = @"bus";
             break;
         case RQHomePageCarType_Truck:
             queryCarTypeStr = @"model LIKE '%truck%'";
+            carTypeStr = @"truck";
             break;
         case RQHomePageCarType_Motorcycle:
             queryCarTypeStr = @"model LIKE '%mtc%'";
@@ -196,19 +199,23 @@ static id rq_questionDBManager = nil;
     }
     ///  默认科目一
     NSString *querySubjectTypeStr = @"subject = 1";
-    
+    NSString *subjectTypeStr = @"1";
     switch (subject) {
         case RQHomePageSubjectType_SubjectOne:
             querySubjectTypeStr = @"subject = 1";
+            subjectTypeStr = @"1";
             break;
         case RQHomePageSubjectType_SubjectTwo:
             querySubjectTypeStr = @"subject = 2";
+            subjectTypeStr = @"2";
             break;
         case RQHomePageSubjectType_SubjectThree:
             querySubjectTypeStr = @"subject = 3";
+            subjectTypeStr = @"3";
             break;
         case RQHomePageSubjectType_SubjectFour:
             querySubjectTypeStr = @"subject = 4";
+            subjectTypeStr = @"4";
             break;
             
         default:
@@ -261,16 +268,16 @@ static id rq_questionDBManager = nil;
 //            exerciseTypeStr = [NSString stringWithFormat:@"%@ + 0 ASC", orderStr];
             break;
         case RQExerciseType_Random:
-            exerciseTypeStr = @"random()";
+//            exerciseTypeStr = @"random()";
             break;
         case RQExerciseType_Recitation:
 //            exerciseTypeStr = [NSString stringWithFormat:@"%@ + 0 ASC", orderStr];
             break;
         case RQExerciseType_Test:
-            exerciseTypeStr = @"random() limit 50";
+//            exerciseTypeStr = @"random() limit 50";
             break;
         case RQExerciseType_Exam:
-            exerciseTypeStr = @"random() limit 5";
+//            exerciseTypeStr = @"random() limit 5";
             break;
             
         default:
@@ -368,142 +375,159 @@ static id rq_questionDBManager = nil;
         return arr.copy;
     } else if (pageType == RQHomeSubPageType_MockExamination && exerciseType == RQExerciseType_Exam) {
         @weakify(self)
-        RACSignal *signal0 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
-            NSMutableArray *difficultArr = @[].mutableCopy;
-            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
-                NSString *chapterIdStr = [NSString stringWithFormat:@"chapter_id = %ld",(long)examRuleModel.chapter_id];
-                NSString *typeStr = [NSString stringWithFormat:@"question_type IN %@",(subject == RQHomePageSubjectType_SubjectOne)? @"(1, 2)" : @"(1, 2, 3)"];
-                NSString *randomStr = [NSString stringWithFormat:@"RANDOM() LIMIT %@",[NSString qmui_stringWithNSInteger:examRuleModel.difficult_count]];
-                NSString *difficultQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND diff_degree IN (4, 5) AND place_issue IS NULL AND %@ AND %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, typeStr, randomStr];
-                return difficultQueryStr;
-            }].toArray.rac_sequence.signal subscribeNext:^(NSString *difficultQueryStr) {
-                @strongify(self)
-                [difficultArr addObjectsFromArray:[self queryQuestionWithQueryStr:difficultQueryStr]];
-            } completed:^{
-                [subscriber sendNext:difficultArr.copy];
-                [subscriber sendCompleted];
-            }];
-            return [RACDisposable disposableWithBlock:^{}];
+        RACSignal *signal0 = [RQ_HTTP_Service getSelectTestK14QuestionInfoList:carTypeStr subject:subjectTypeStr];
+        [[signal0 takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSArray *array) {
+            NSLog(@"%@",array);
+        } error:^(NSError * _Nullable error) {
         }];
-        
-        RACSignal *signal1 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
-            NSMutableArray *judgeArr = @[].mutableCopy;
-            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
-                NSString *chapterIdStr = [NSString stringWithFormat:@"AND chapter_id = %ld",(long)examRuleModel.chapter_id];
-                NSString *judgeCountStr = [NSString stringWithFormat:@"RANDOM() LIMIT %ld",(long)examRuleModel.judge_count];
-                NSString *judgeQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND question_type = 1 AND diff_degree IN (0,1,2,3) AND place_issue IS NULL %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, judgeCountStr];
-                NSMutableArray *judgeChapterArr = [self queryQuestionWithQueryStr:judgeQueryStr].mutableCopy;
-                if (judgeChapterArr.count < examRuleModel.judge_count) {
-                    NSString *judgeQueryAddStr = [NSString stringWithFormat:@"SELECT DISTINCT * FROM %@ WHERE %@ AND %@ AND question_type = 1 AND diff_degree IN (4,5) AND place_issue IS NULL %@ ORDER BY RANDOM() LIMIT %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, [NSString stringWithFormat:@"%ld",(long)(examRuleModel.judge_count - judgeChapterArr.count)]];
-                    NSArray *judgeChapterAddArr = [self queryQuestionWithQueryStr:judgeQueryAddStr];
-                    [judgeChapterArr addObjectsFromArray:judgeChapterAddArr];
-                    return judgeChapterArr.copy;
-                } else {
-                    return judgeChapterArr.copy;
-                }
-            }].toArray.rac_sequence.signal subscribeNext:^(NSArray *judgeChapterArr) {
-                [judgeArr addObjectsFromArray:judgeChapterArr];
-            } completed:^{
-                [subscriber sendNext:judgeArr.copy];
-                [subscriber sendCompleted];
-            }];
-            return [RACDisposable disposableWithBlock:^{}];
-        }];
-        
-        RACSignal *signal2 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
-            NSMutableArray *choiceArr = @[].mutableCopy;
-            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
-                NSString *chapterIdStr = [NSString stringWithFormat:@"AND chapter_id = %ld",(long)examRuleModel.chapter_id];
-                NSString *choiceCountStr = [NSString stringWithFormat:@"RANDOM() LIMIT %ld",(long)examRuleModel.choice_count];
-                NSString *choiceQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND question_type = 2 AND diff_degree IN (0,1,2,3) AND place_issue IS NULL %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, choiceCountStr];
-                NSMutableArray *choiceChapterArr = [self queryQuestionWithQueryStr:choiceQueryStr].mutableCopy;
-                if (choiceChapterArr.count < examRuleModel.choice_count) {
-                    NSString *choiceQueryAddStr = [NSString stringWithFormat:@"SELECT DISTINCT * FROM %@ WHERE %@ AND %@ AND question_type = 2 AND diff_degree IN (4,5) AND place_issue IS NULL %@ ORDER BY RANDOM() LIMIT %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, [NSString stringWithFormat:@"%ld",(long)(examRuleModel.choice_count - choiceChapterArr.count)]];
-                    NSArray *choiceChapterAddArr = [self queryQuestionWithQueryStr:choiceQueryAddStr];
-                    [choiceChapterArr addObjectsFromArray:choiceChapterAddArr];
-                    return choiceChapterArr.copy;
-                } else {
-                    return choiceChapterArr.copy;
-                }
-            }].toArray.rac_sequence.signal subscribeNext:^(NSArray *choiceChapterArr) {
-                [choiceArr addObjectsFromArray:choiceChapterArr];
-            } completed:^{
-                [subscriber sendNext:choiceArr.copy];
-                [subscriber sendCompleted];
-            }];
-            return [RACDisposable disposableWithBlock:^{}];
-        }];
-        RACSignal *signal3 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
-            NSMutableArray *multipleChoiceArr = @[].mutableCopy;
-            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
-                NSString *chapterIdStr = [NSString stringWithFormat:@"AND chapter_id = %ld",(long)examRuleModel.chapter_id];
-                NSString *multipleChoiceCountStr = [NSString stringWithFormat:@"RANDOM() LIMIT %ld",(long)examRuleModel.multiple_choice_count];
-                NSString *multipleChoiceQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND question_type = 3 AND diff_degree IN (0,1,2,3) AND place_issue IS NULL %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, multipleChoiceCountStr];
-                NSMutableArray *multipleChoiceChapterArr = [self queryQuestionWithQueryStr:multipleChoiceQueryStr].mutableCopy;
-                if (multipleChoiceChapterArr.count < examRuleModel.multiple_choice_count) {
-                    NSString *multipleChoiceQueryAddStr = [NSString stringWithFormat:@"SELECT DISTINCT * FROM %@ WHERE %@ AND %@ AND question_type = 3 AND diff_degree IN (4,5) AND place_issue IS NULL %@ ORDER BY RANDOM() LIMIT %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, [NSString stringWithFormat:@"%ld",(long)(examRuleModel.multiple_choice_count - multipleChoiceChapterArr.count)]];
-                    NSArray *multipleChoiceChapterAddArr = [self queryQuestionWithQueryStr:multipleChoiceQueryAddStr];
-                    [multipleChoiceChapterArr addObjectsFromArray:multipleChoiceChapterAddArr];
-                    return multipleChoiceChapterArr.copy;
-                } else {
-                    return multipleChoiceChapterArr.copy;
-                }
-            }].toArray.rac_sequence.signal subscribeNext:^(NSArray *multipleChoiceChapterArr) {
-                [multipleChoiceArr addObjectsFromArray:multipleChoiceChapterArr];
-            } completed:^{
-                [subscriber sendNext:multipleChoiceArr.copy];
-                [subscriber sendCompleted];
-            }];
-            return [RACDisposable disposableWithBlock:^{}];
-        }];
-        return [[[RACSignal combineLatest:@[signal0, signal1, signal2, signal3] reduce:^id (NSArray *arr0, NSArray *arr1, NSArray *arr2, NSArray *arr3){
-            NSMutableArray *judgeArr = [NSMutableArray arrayWithArray:arr1];
-            NSMutableArray *choiceArr = [NSMutableArray arrayWithArray:arr2];
-            NSMutableArray *multipleChoiceArr = [NSMutableArray arrayWithArray:arr3];
-            dispatch_semaphore_t sema = dispatch_semaphore_create(0);
-            [[arr0.rac_sequence.signal filter:^BOOL(RQExerciseModel *difficultQuestionModel) {
-                return ![judgeArr containsObject:difficultQuestionModel] && ![choiceArr containsObject:difficultQuestionModel] && ![multipleChoiceArr containsObject:difficultQuestionModel];
-            }].toArray.rac_sequence.signal subscribeNext:^(RQExerciseModel *difficultQuestionModel) {
-                if (difficultQuestionModel.question_type == 1) {
-                    NSMutableArray *sortChapterArr = [judgeArr.rac_sequence.signal filter:^BOOL(RQExerciseModel *judgeQuestionModel) {
-                        return (judgeQuestionModel.chapter_id == difficultQuestionModel.chapter_id) && ![arr0 containsObject:judgeQuestionModel];
-                    }].toArray.mutableCopy;
-                    if (sortChapterArr.count > 0) {
-                        [judgeArr replaceObjectAtIndex:[judgeArr indexOfObject:sortChapterArr.lastObject] withObject:difficultQuestionModel];
-                    }
-                } else if (difficultQuestionModel.question_type == 2) {
-                    NSMutableArray *sortChapterArr = [choiceArr.rac_sequence.signal filter:^BOOL(RQExerciseModel *choiceQuestionModel) {
-                        return (choiceQuestionModel.chapter_id == difficultQuestionModel.chapter_id) && ![arr0 containsObject:choiceQuestionModel];
-                    }].toArray.mutableCopy;
-                    if (sortChapterArr.count > 0) {
-                        [choiceArr replaceObjectAtIndex:[choiceArr indexOfObject:sortChapterArr.lastObject] withObject:difficultQuestionModel];
-                    }
-                } else {
-                    NSMutableArray *sortChapterArr = [multipleChoiceArr.rac_sequence.signal filter:^BOOL(RQExerciseModel *multiChoiceQuestionModel) {
-                        return (multiChoiceQuestionModel.chapter_id == difficultQuestionModel.chapter_id) && ![arr0 containsObject:multiChoiceQuestionModel];
-                    }].toArray.mutableCopy;
-                    if (sortChapterArr.count > 0) {
-                        [multipleChoiceArr replaceObjectAtIndex:[multipleChoiceArr indexOfObject:sortChapterArr.lastObject] withObject:difficultQuestionModel];
-                    }
-                }
-            } completed:^{
-                /// Key: 按照排序的key; ascending: YES为升序, NO为降序。
-                NSSortDescriptor *strTppeSorter = [[NSSortDescriptor alloc] initWithKey:@"chapter_id" ascending:YES];
-//                NSSortDescriptor *diff_degreeSorter = [NSSortDescriptor sortDescriptorWithKey:@"diff_degree" ascending:YES];
-                NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:strTppeSorter, nil];
-                
-                [arr addObjectsFromArray:[judgeArr sortedArrayUsingDescriptors:sortDescriptors]];
-                [arr addObjectsFromArray:[choiceArr sortedArrayUsingDescriptors:sortDescriptors]];
-                [arr addObjectsFromArray:[multipleChoiceArr sortedArrayUsingDescriptors:sortDescriptors]];
-                dispatch_semaphore_signal(sema);
-            }];
-            dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
 
+        RACSignal *signal = [RACSignal combineLatest:@[signal0] reduce:^id (NSArray *arr1) {
+            NSLog(@"signal0=========%@",arr1);
+            [arr addObjectsFromArray:arr1];
             return arr.copy;
-        }] map:^id _Nullable(NSArray *examArr) {
-            return examArr;
-        }].toArray firstObject];
+        }];
+        [signal subscribeNext:^(NSArray *allArr) {
+            
+        }];
         return arr.copy;
+//        RACSignal *signal0 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
+//            @strongify(self)
+//            NSMutableArray *difficultArr = @[].mutableCopy;
+//
+////            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
+////                NSString *chapterIdStr = [NSString stringWithFormat:@"chapter_id = %ld",(long)examRuleModel.chapter_id];
+////                NSString *typeStr = [NSString stringWithFormat:@"question_type IN %@",(subject == RQHomePageSubjectType_SubjectOne)? @"(1, 2)" : @"(1, 2, 3)"];
+////                NSString *randomStr = [NSString stringWithFormat:@"RANDOM() LIMIT %@",[NSString qmui_stringWithNSInteger:examRuleModel.difficult_count]];
+////                NSString *difficultQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND diff_degree IN (4, 5) AND place_issue IS NULL AND %@ AND %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, typeStr, randomStr];
+////                return difficultQueryStr;
+////            }].toArray.rac_sequence.signal subscribeNext:^(NSString *difficultQueryStr) {
+////                @strongify(self)
+////                [difficultArr addObjectsFromArray:[self queryQuestionWithQueryStr:difficultQueryStr]];
+////            } completed:^{
+////                [subscriber sendNext:difficultArr.copy];
+////                [subscriber sendCompleted];
+////            }];
+//            return [RACDisposable disposableWithBlock:^{}];
+//        }];
+        
+//        RACSignal *signal1 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
+//            NSMutableArray *judgeArr = @[].mutableCopy;
+//            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
+//                NSString *chapterIdStr = [NSString stringWithFormat:@"AND chapter_id = %ld",(long)examRuleModel.chapter_id];
+//                NSString *judgeCountStr = [NSString stringWithFormat:@"RANDOM() LIMIT %ld",(long)examRuleModel.judge_count];
+//                NSString *judgeQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND question_type = 1 AND diff_degree IN (0,1,2,3) AND place_issue IS NULL %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, judgeCountStr];
+//                NSMutableArray *judgeChapterArr = [self queryQuestionWithQueryStr:judgeQueryStr].mutableCopy;
+//                if (judgeChapterArr.count < examRuleModel.judge_count) {
+//                    NSString *judgeQueryAddStr = [NSString stringWithFormat:@"SELECT DISTINCT * FROM %@ WHERE %@ AND %@ AND question_type = 1 AND diff_degree IN (4,5) AND place_issue IS NULL %@ ORDER BY RANDOM() LIMIT %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, [NSString stringWithFormat:@"%ld",(long)(examRuleModel.judge_count - judgeChapterArr.count)]];
+//                    NSArray *judgeChapterAddArr = [self queryQuestionWithQueryStr:judgeQueryAddStr];
+//                    [judgeChapterArr addObjectsFromArray:judgeChapterAddArr];
+//                    return judgeChapterArr.copy;
+//                } else {
+//                    return judgeChapterArr.copy;
+//                }
+//            }].toArray.rac_sequence.signal subscribeNext:^(NSArray *judgeChapterArr) {
+//                [judgeArr addObjectsFromArray:judgeChapterArr];
+//            } completed:^{
+//                [subscriber sendNext:judgeArr.copy];
+//                [subscriber sendCompleted];
+//            }];
+//            return [RACDisposable disposableWithBlock:^{}];
+//        }];
+//
+//        RACSignal *signal2 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
+//            NSMutableArray *choiceArr = @[].mutableCopy;
+//            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
+//                NSString *chapterIdStr = [NSString stringWithFormat:@"AND chapter_id = %ld",(long)examRuleModel.chapter_id];
+//                NSString *choiceCountStr = [NSString stringWithFormat:@"RANDOM() LIMIT %ld",(long)examRuleModel.choice_count];
+//                NSString *choiceQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND question_type = 2 AND diff_degree IN (0,1,2,3) AND place_issue IS NULL %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, choiceCountStr];
+//                NSMutableArray *choiceChapterArr = [self queryQuestionWithQueryStr:choiceQueryStr].mutableCopy;
+//                if (choiceChapterArr.count < examRuleModel.choice_count) {
+//                    NSString *choiceQueryAddStr = [NSString stringWithFormat:@"SELECT DISTINCT * FROM %@ WHERE %@ AND %@ AND question_type = 2 AND diff_degree IN (4,5) AND place_issue IS NULL %@ ORDER BY RANDOM() LIMIT %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, [NSString stringWithFormat:@"%ld",(long)(examRuleModel.choice_count - choiceChapterArr.count)]];
+//                    NSArray *choiceChapterAddArr = [self queryQuestionWithQueryStr:choiceQueryAddStr];
+//                    [choiceChapterArr addObjectsFromArray:choiceChapterAddArr];
+//                    return choiceChapterArr.copy;
+//                } else {
+//                    return choiceChapterArr.copy;
+//                }
+//            }].toArray.rac_sequence.signal subscribeNext:^(NSArray *choiceChapterArr) {
+//                [choiceArr addObjectsFromArray:choiceChapterArr];
+//            } completed:^{
+//                [subscriber sendNext:choiceArr.copy];
+//                [subscriber sendCompleted];
+//            }];
+//            return [RACDisposable disposableWithBlock:^{}];
+//        }];
+//        RACSignal *signal3 = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
+//            NSMutableArray *multipleChoiceArr = @[].mutableCopy;
+//            [[[self getExamRuleWithCarType:carType subject:subject].rac_sequence.signal map:^id _Nullable(RQExamRuleModel *examRuleModel) {
+//                NSString *chapterIdStr = [NSString stringWithFormat:@"AND chapter_id = %ld",(long)examRuleModel.chapter_id];
+//                NSString *multipleChoiceCountStr = [NSString stringWithFormat:@"RANDOM() LIMIT %ld",(long)examRuleModel.multiple_choice_count];
+//                NSString *multipleChoiceQueryStr = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ AND %@ AND question_type = 3 AND diff_degree IN (0,1,2,3) AND place_issue IS NULL %@ ORDER BY %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, multipleChoiceCountStr];
+//                NSMutableArray *multipleChoiceChapterArr = [self queryQuestionWithQueryStr:multipleChoiceQueryStr].mutableCopy;
+//                if (multipleChoiceChapterArr.count < examRuleModel.multiple_choice_count) {
+//                    NSString *multipleChoiceQueryAddStr = [NSString stringWithFormat:@"SELECT DISTINCT * FROM %@ WHERE %@ AND %@ AND question_type = 3 AND diff_degree IN (4,5) AND place_issue IS NULL %@ ORDER BY RANDOM() LIMIT %@",questionTableNameStr , queryCarTypeStr, querySubjectTypeStr, chapterIdStr, [NSString stringWithFormat:@"%ld",(long)(examRuleModel.multiple_choice_count - multipleChoiceChapterArr.count)]];
+//                    NSArray *multipleChoiceChapterAddArr = [self queryQuestionWithQueryStr:multipleChoiceQueryAddStr];
+//                    [multipleChoiceChapterArr addObjectsFromArray:multipleChoiceChapterAddArr];
+//                    return multipleChoiceChapterArr.copy;
+//                } else {
+//                    return multipleChoiceChapterArr.copy;
+//                }
+//            }].toArray.rac_sequence.signal subscribeNext:^(NSArray *multipleChoiceChapterArr) {
+//                [multipleChoiceArr addObjectsFromArray:multipleChoiceChapterArr];
+//            } completed:^{
+//                [subscriber sendNext:multipleChoiceArr.copy];
+//                [subscriber sendCompleted];
+//            }];
+//            return [RACDisposable disposableWithBlock:^{}];
+//        }];
+        
+//        return [[[RACSignal combineLatest:@[signal0] reduce:^id (NSArray *arr0){
+//            NSMutableArray *judgeArr = [NSMutableArray array];
+//            dispatch_semaphore_t sema = dispatch_semaphore_create(0);
+//            [[arr0.rac_sequence.signal filter:^BOOL(RQExerciseModel *difficultQuestionModel) {
+//                return ![judgeArr containsObject:difficultQuestionModel];
+//            }].toArray.rac_sequence.signal subscribeNext:^(RQExerciseModel *difficultQuestionModel) {
+//                if (difficultQuestionModel.question_type == 1) {
+//                    NSMutableArray *sortChapterArr = [judgeArr.rac_sequence.signal filter:^BOOL(RQExerciseModel *judgeQuestionModel) {
+//                        return (judgeQuestionModel.chapter_id == difficultQuestionModel.chapter_id) && ![arr0 containsObject:judgeQuestionModel];
+//                    }].toArray.mutableCopy;
+//                    if (sortChapterArr.count > 0) {
+//                        [judgeArr replaceObjectAtIndex:[judgeArr indexOfObject:sortChapterArr.lastObject] withObject:difficultQuestionModel];
+//                    }
+//                }
+////                else if (difficultQuestionModel.question_type == 2) {
+////                    NSMutableArray *sortChapterArr = [choiceArr.rac_sequence.signal filter:^BOOL(RQExerciseModel *choiceQuestionModel) {
+////                        return (choiceQuestionModel.chapter_id == difficultQuestionModel.chapter_id) && ![arr0 containsObject:choiceQuestionModel];
+////                    }].toArray.mutableCopy;
+////                    if (sortChapterArr.count > 0) {
+////                        [choiceArr replaceObjectAtIndex:[choiceArr indexOfObject:sortChapterArr.lastObject] withObject:difficultQuestionModel];
+////                    }
+////                } else {
+////                    NSMutableArray *sortChapterArr = [multipleChoiceArr.rac_sequence.signal filter:^BOOL(RQExerciseModel *multiChoiceQuestionModel) {
+////                        return (multiChoiceQuestionModel.chapter_id == difficultQuestionModel.chapter_id) && ![arr0 containsObject:multiChoiceQuestionModel];
+////                    }].toArray.mutableCopy;
+////                    if (sortChapterArr.count > 0) {
+////                        [multipleChoiceArr replaceObjectAtIndex:[multipleChoiceArr indexOfObject:sortChapterArr.lastObject] withObject:difficultQuestionModel];
+////                    }
+////                }
+//            } completed:^{
+//                /// Key: 按照排序的key; ascending: YES为升序, NO为降序。
+//                NSSortDescriptor *strTppeSorter = [[NSSortDescriptor alloc] initWithKey:@"chapter_id" ascending:YES];
+////                NSSortDescriptor *diff_degreeSorter = [NSSortDescriptor sortDescriptorWithKey:@"diff_degree" ascending:YES];
+//                NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:strTppeSorter, nil];
+//                
+//                [arr addObjectsFromArray:[judgeArr sortedArrayUsingDescriptors:sortDescriptors]];
+////                [arr addObjectsFromArray:[choiceArr sortedArrayUsingDescriptors:sortDescriptors]];
+////                [arr addObjectsFromArray:[multipleChoiceArr sortedArrayUsingDescriptors:sortDescriptors]];
+//                dispatch_semaphore_signal(sema);
+//            }];
+//            dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
+//
+//            return arr.copy;
+//        }] map:^id _Nullable(NSArray *examArr) {
+//            return examArr;
+//        }].toArray firstObject];
+//        return arr.copy;
     } else if (pageType == RQHomeSubPageType_FreeTry) {
         queryStr = [NSString stringWithFormat:@"SELECT * FROM question_info INNER JOIN question_free ON question_info.id = question_free.id AND question_free.subject = '%@' ORDER BY %@", [RQ_COMMON_MANAGER getSubjectTypeNumStrWithSubjectType:subject],(exerciseType == RQExerciseType_Random)? @"random()" : @"question_free.free_sort + 0 ASC"];
         return [self queryQuestionWithQueryStr:queryStr exerciseType:exerciseType];