123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990 |
- //
- // RQYDTQuestionModule.m
- // jiaPei
- //
- // Created by 张嵘 on 2022/3/28.
- // Copyright © 2022 JCZ. All rights reserved.
- //
- #import "RQYDTQuestionModule.h"
- #import "RQYDTXCQuestionModule.h"
- #import "RQYDTHCQuestionModule.h"
- #import "RQYDTKCQuestionModule.h"
- #import "RQYDTMTCQuestionModule.h"
- #import "RQYDTZGZJLYQuestionModule.h"
- #import "RQYDTZGZKYQuestionModule.h"
- #import "RQYDTZGZHYQuestionModule.h"
- #import "RQYDTZGZWXPQuestionModule.h"
- #import "RQYDTZGZCZCQuestionModule.h"
- #import "RQYDTZGZWYCQuestionModule.h"
- NSString * const RQCarTypeChangeNotification = @"RQCarTypeChangeNotification";
- /// 正式环境key
- static NSString * const RQYDTQuestionCarTypeKey = @"RQYDTQuestionCarTypeKey";
- @interface RQYDTQuestionModule ()
- /// 科目一顺序练习
- @property (nonatomic, readwrite, copy) NSArray *subjectOneArr;
- /// 科目四顺序练习
- @property (nonatomic, readwrite, copy) NSArray *subjectFourArr;
- @property (nonatomic, readwrite, strong) NSString *downloadUrl;
- @property (nonatomic, readwrite, strong) NSString *jsDownloadUrl;
- @property (nonatomic, readwrite, strong) NSString *jqDownloadUrl;
- @end
- @implementation RQYDTQuestionModule
- static id rq_ydtQuestionModule = nil;
- #pragma mark - init
- + (instancetype)sharedInstance {
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- rq_ydtQuestionModule = [[self alloc] init];
- });
- return rq_ydtQuestionModule;
- }
- - (instancetype)init {
- if (self = [super init]) {
- NSInteger userVersion = [RQ_YDT_USER_Question_Module getQuestionVersion];
- NSLog(@"用户题库版本号:%ld",userVersion);
- NSInteger xcVersion = [RQ_YDT_XC_Question_Module getQuestionVersion];
- NSLog(@"小车题库版本号:%ld",xcVersion);
- NSInteger hcVersion = [RQ_YDT_HC_Question_Module getQuestionVersion];
- NSLog(@"货车题库版本号:%ld",hcVersion);
- NSInteger kcVersion = [RQ_YDT_KC_Question_Module getQuestionVersion];
- NSLog(@"客车题库版本号:%ld",kcVersion);
- NSInteger mtcVersion = [RQ_YDT_MTC_Question_Module getQuestionVersion];
- NSLog(@"摩托车题库版本号:%ld",mtcVersion);
- NSInteger zgzJlyVersion = [RQ_YDT_ZGZ_JLY_Question_Module getQuestionVersion];
- NSLog(@"资格证教练员题库版本号:%ld",zgzJlyVersion);
-
- }
- return self;
- }
- - (void)saveQuestionsWithSubjectOneArr:(NSArray *)subjectOneArr {
- self.subjectOneArr = subjectOneArr;
- }
- - (void)saveQuestionsWithSubjectFourArr:(NSArray *)subjectFourArr {
- self.subjectFourArr = subjectFourArr;
- }
- - (void)setCarType:(RQHomePageCarType)carType {
- NSString *carTypeStr = [NSString stringWithFormat:@"%@",[NSNumber numberWithInteger:carType]];
- [[NSUserDefaults standardUserDefaults] setObject:carTypeStr forKey:RQYDTQuestionCarTypeKey];
- [[NSUserDefaults standardUserDefaults] synchronize];
- }
- - (RQHomePageCarType)carType {
- NSString *carTypeStr = [[NSUserDefaults standardUserDefaults] objectForKey:RQYDTQuestionCarTypeKey];
- carTypeStr = [carTypeStr rq_stringValueExtension];
- return carTypeStr.integerValue;
- }
- - (NSString *)carTypeStr {
- return [self getCarTypeNameWithCarType:self.carType];
- }
- - (NSString *)subjectStr {
- return [self getSubjectNameWithSubject:self.subject];
- }
- #pragma mark - PublicMethods
- /// 更新题库
- - (void)rq_updateQuestion {
- @weakify(self)
- [[[RQ_HTTP_Service getUpdateQuestion] deliverOnMainThread] subscribeNext:^(NSArray *arr) {
- [[arr.rac_sequence.signal filter:^BOOL(RQDictInfoModel *dictInfoModel) {
- return [dictInfoModel.dictLabel isEqualToString:[RQ_YDTQuestion_Module getCarTypeCNTiKuUpdateNameWithCarType:RQ_YDTQuestion_Module.carType]];
- }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
- @strongify(self)
- NSInteger netVersion = dictInfoModel.remark.integerValue;
- NSInteger localVersion = [RQ_YDTQuestion_Module getQuestionVersion];
- self.downloadUrl = dictInfoModel.dictValue;
- if (netVersion > localVersion) {
- NSLog(@"题库需要更新!");
- [self rq_showDBUpdateView];
- } else {
- NSLog(@"题库不需要更新!");
- }
- }];
-
- [[arr.rac_sequence.signal filter:^BOOL(RQDictInfoModel *dictInfoModel) {
- return [dictInfoModel.dictLabel isEqualToString:@"题库解释"];
- }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
- @strongify(self)
- NSInteger netVersion = dictInfoModel.remark.integerValue;
- NSInteger localVersion = [RQ_YDT_JS_Question_Module getQuestionVersion];
- self.jsDownloadUrl = dictInfoModel.dictValue;
- if (netVersion > localVersion) {
- NSLog(@"解释题库需要更新!");
- [self rq_showJSUpdateView];
- } else {
- NSLog(@"解释题库不需要更新!");
- }
- }];
-
- [[arr.rac_sequence.signal filter:^BOOL(RQDictInfoModel *dictInfoModel) {
- return [dictInfoModel.dictLabel isEqualToString:@"快通解释"];
- }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
- @strongify(self)
- NSInteger netVersion = dictInfoModel.remark.integerValue;
- NSInteger localVersion = [YN_YDT_JQ_Question_Module getQuestionVersion];
- self.jqDownloadUrl = dictInfoModel.dictValue;
- if (netVersion > localVersion) {
- NSLog(@"快通解释题库需要更新!");
- [self rq_showJQUpdateView];
- } else {
- NSLog(@"快通解释题库不需要更新!");
- }
- }];
- }];
- }
- - (NSInteger)getQuestionVersion {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getQuestionVersion];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getQuestionVersion];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getQuestionVersion];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getQuestionVersion];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionVersion];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getQuestionVersion];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getQuestionVersion];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionVersion];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionVersion];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionVersion];
- default:
- return [RQ_YDT_XC_Question_Module getQuestionVersion];
- }
- }
- - (NSString *)getSubjectNameWithSubject:(RQHomePageSubjectType)subject {
- switch (subject) {
- case RQHomePageSubjectType_SubjectOne:
- return @"1";
- case RQHomePageSubjectType_SubjectTwo:
- return @"2";
- case RQHomePageSubjectType_SubjectThree:
- return @"3";
- case RQHomePageSubjectType_SubjectFour:
- return @"4";
-
- default:
- return @"1";
- }
- }
- - (RQHomePageSubjectType)getSubjectWithSubjectName:(NSString *)subjectName {
- if ([subjectName isEqualToString:@"1"]) {
- return RQHomePageSubjectType_SubjectOne;
- } else if ([subjectName isEqualToString:@"2"]) {
- return RQHomePageSubjectType_SubjectTwo;
- } else if ([subjectName isEqualToString:@"3"]) {
- return RQHomePageSubjectType_SubjectThree;
- } else if ([subjectName isEqualToString:@"4"]) {
- return RQHomePageSubjectType_SubjectFour;
- } else {
- return RQHomePageSubjectType_SubjectOne;
- }
- }
- - (RQHomePageCarType)getCarTypeWithCarTypeName:(NSString *)carTypeName {
- if ([carTypeName isEqualToString:@"C1"]) {
- return RQHomePageCarType_Car;
- } else if ([carTypeName isEqualToString:@"A2"]) {
- return RQHomePageCarType_Truck;
- } else if ([carTypeName isEqualToString:@"A1"]) {
- return RQHomePageCarType_Bus;
- } else if ([carTypeName isEqualToString:@"D"]) {
- return RQHomePageCarType_Motorcycle;
- } else if ([carTypeName isEqualToString:@"4"]) {
- return RQHomePageCarType_ZGZ_JLY;
- } else if ([carTypeName isEqualToString:@"1"]) {
- return RQHomePageCarType_ZGZ_KY;
- } else if ([carTypeName isEqualToString:@"2"]) {
- return RQHomePageCarType_ZGZ_HY;
- } else if ([carTypeName isEqualToString:@"3"]) {
- return RQHomePageCarType_ZGZ_WXP;
- } else if ([carTypeName isEqualToString:@"5"]) {
- return RQHomePageCarType_ZGZ_CZC;
- } else if ([carTypeName isEqualToString:@"6"]) {
- return RQHomePageCarType_ZGZ_WYC;
- } else {
- return RQHomePageCarType_Car;
- }
- }
- - (NSString *)getCarTypeCNNameWithCarType:(RQHomePageCarType)carType {
- switch (carType) {
- case RQHomePageCarType_Car:
- return @"小车";
- case RQHomePageCarType_Truck:
- return @"货车";
- case RQHomePageCarType_Bus:
- return @"客车";
- case RQHomePageCarType_Motorcycle:
- return @"摩托车";
- case RQHomePageCarType_ZGZ_JLY:
- return @"教练员";
- case RQHomePageCarType_ZGZ_HY:
- return @"货运";
- case RQHomePageCarType_ZGZ_WXP:
- return @"危险品";
- case RQHomePageCarType_ZGZ_KY:
- return @"客运";
- case RQHomePageCarType_ZGZ_CZC:
- return @"出租车";
- case RQHomePageCarType_ZGZ_WYC:
- return @"网约车";
-
- default:
- return @"小车";
- }
- }
- - (NSString *)getCarTypeCNTiKuUpdateNameWithCarType:(RQHomePageCarType)carType {
- switch (carType) {
- case RQHomePageCarType_Car:
- return @"小车";
- case RQHomePageCarType_Truck:
- return @"货车";
- case RQHomePageCarType_Bus:
- return @"客车";
- case RQHomePageCarType_Motorcycle:
- return @"摩托车";
- case RQHomePageCarType_ZGZ_JLY:
- return @"教练员资格证";
- case RQHomePageCarType_ZGZ_HY:
- return @"货运资格证";
- case RQHomePageCarType_ZGZ_WXP:
- return @"危险品资格证";
- case RQHomePageCarType_ZGZ_KY:
- return @"客运资格证";
- case RQHomePageCarType_ZGZ_CZC:
- return @"出租车资格证";
- case RQHomePageCarType_ZGZ_WYC:
- return @"网约车资格证";
-
- default:
- return @"小车";
- }
- }
- - (NSString *)getCarTypeExamNameWithCarType:(RQHomePageCarType)carType {
- switch (carType) {
- case RQHomePageCarType_Car:
- return @"小车C1/C2/C3";
- case RQHomePageCarType_Bus:
- return @"客车A1/A3/B1";
- case RQHomePageCarType_Truck:
- return @"货车A2/B2";
- case RQHomePageCarType_Motorcycle:
- return @"摩托车D/E/F";
- case RQHomePageCarType_ZGZ_JLY:
- return @"教练员";
- case RQHomePageCarType_ZGZ_KY:
- return @"客运";
- case RQHomePageCarType_ZGZ_HY:
- return @"货运";
- case RQHomePageCarType_ZGZ_WXP:
- return @"危险品";
- case RQHomePageCarType_ZGZ_CZC:
- return @"出租车";
- case RQHomePageCarType_ZGZ_WYC:
- return @"网约车";
-
- default:
- return @"小车";
- }
- }
- - (NSString *)getCar_TypeNameWithCarType:(RQHomePageCarType)carType {
- switch (carType) {
- case RQHomePageCarType_Car:
- return @"C1";
- case RQHomePageCarType_Truck:
- return @"A2";
- case RQHomePageCarType_Bus:
- return @"A1";
- case RQHomePageCarType_Motorcycle:
- return @"D";
- case RQHomePageCarType_ZGZ_JLY:
- return @"4";
- case RQHomePageCarType_ZGZ_HY:
- return @"2";
- case RQHomePageCarType_ZGZ_WXP:
- return @"3";
- case RQHomePageCarType_ZGZ_KY:
- return @"1";
- case RQHomePageCarType_ZGZ_CZC:
- return @"5";
- case RQHomePageCarType_ZGZ_WYC:
- return @"6";
-
- default:
- return @"C1";
- }
- }
- - (NSArray *)getQuestionWithExerciseType:(RQExerciseType)exerciseType {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- default:
- return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
- }
- }
- - (NSArray *)getQuestionWithSubject:(RQHomePageSubjectType)subject exerciseType:(RQExerciseType)exerciseType {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- default:
- return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- }
- }
- - (NSArray *)getQuestionWithSubject:(RQHomePageSubjectType)subject exerciseType:(RQExerciseType)exerciseType isNeedMediaData:(BOOL)isNeedMediaData {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
- default:
- return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
- }
- }
- - (NSInteger)getQuestionNumWithWithSubject:(RQHomePageSubjectType)subject exerciseType:(RQExerciseType)exerciseType {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionNumWithExerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getQuestionNumWithExerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getQuestionNumWithExerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionNumWithExerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionNumWithExerciseType:exerciseType];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionNumWithExerciseType:exerciseType];
- default:
- return [RQ_YDT_XC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
- }
- }
- - (NSArray *)getChapterArr {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getChapter];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getChapter];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getChapter];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getChapter];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getChapter];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getChapter];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getChapter];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getChapter];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getChapter];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getChapter];
- default:
- return [RQ_YDT_XC_Question_Module getChapter];
- }
- }
- - (NSArray *)getChapterQuestionWithChapterName:(NSString *)chapterName {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getChapterQuestionWithChapterName:chapterName];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getChapterQuestionWithChapterName:chapterName];
- default:
- return [RQ_YDT_XC_Question_Module getChapterQuestionWithChapterName:chapterName];
- }
- }
- - (NSArray *)getChapterQuestionWithChapterName:(NSString *)chapterName exerciseType:(RQExerciseType)exerciseType {
- return [RQ_YDT_XC_Question_Module getChapterQuestionWithChapterName:chapterName exerciseType:exerciseType];
- }
- - (NSArray *)getPoint {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getPoint];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getPoint];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getPoint];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getPoint];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getPoint];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getPoint];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getPoint];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getPoint];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getPoint];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getPoint];
- default:
- return [RQ_YDT_XC_Question_Module getPoint];
- }
- }
- - (NSArray *)getPointQuestionWithPointID:(NSInteger)pointId {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getPointQuestionWithPointId:pointId];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getPointQuestionWithPointId:pointId];
- default:
- return [RQ_YDT_XC_Question_Module getPointQuestionWithPointId:pointId];
- }
- }
- - (NSArray *)getPointQuestionWithPointID:(NSInteger)pointId exerciseType:(RQExerciseType)exerciseType {
- return [RQ_YDT_XC_Question_Module getPointQuestionWithPointId:pointId exerciseType:exerciseType];
- }
- - (BOOL)isNewRuleQuestionWithQuestionId:(NSInteger)questionId {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- default:
- return [RQ_YDT_XC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
- }
- }
- - (NSData *)getMediaDataWithMediaName:(NSString *)mediaName {
- switch (self.carType) {
- case RQHomePageCarType_Car:
- return [RQ_YDT_XC_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_Truck:
- return [RQ_YDT_HC_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_Bus:
- return [RQ_YDT_KC_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_Motorcycle:
- return [RQ_YDT_MTC_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_ZGZ_JLY:
- return [RQ_YDT_ZGZ_JLY_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_ZGZ_KY:
- return [RQ_YDT_ZGZ_KY_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_ZGZ_HY:
- return [RQ_YDT_ZGZ_HY_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_ZGZ_WXP:
- return [RQ_YDT_ZGZ_WXP_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_ZGZ_CZC:
- return [RQ_YDT_ZGZ_CZC_Question_Module getMediaDataWithMediaName:mediaName];
- case RQHomePageCarType_ZGZ_WYC:
- return [RQ_YDT_ZGZ_WYC_Question_Module getMediaDataWithMediaName:mediaName];
- default:
- return [RQ_YDT_XC_Question_Module getMediaDataWithMediaName:mediaName];
- }
- }
- /// 做到哪一题
- - (NSInteger)getHistoryQuestionNum {
- NSString *key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%@",self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.stuNum)? RQ_USER_MANAGER.currentUser.stuNum : @"0"];
- if ((RQ_Exercise_Module.currentExerciseType == RQExerciseType_Point || RQ_Exercise_Module.currentExerciseType == RQExerciseType_Chapter) && RQStringIsNotEmpty(RQ_Exercise_Module.otherStr)) {
- key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%@-%@",self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.stuNum)? RQ_USER_MANAGER.currentUser.stuNum : @"0", RQ_Exercise_Module.otherStr];
- }
- id object = [RQ_COMMON_MANAGER getObjectWithKey:key];
- if (RQObjectIsNil(object)) {
- return 0;
- } else {
- NSInteger historyQuestionNum = [object integerValue];
- return historyQuestionNum;
- }
- }
- - (void)saveHistoryQuestionNumWithQuestionId:(NSInteger)questionId {
- NSString *key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%@",self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.stuNum)? RQ_USER_MANAGER.currentUser.stuNum : @"0"];
- if ((RQ_Exercise_Module.currentExerciseType == RQExerciseType_Point || RQ_Exercise_Module.currentExerciseType == RQExerciseType_Chapter) && RQStringIsNotEmpty(RQ_Exercise_Module.otherStr)) {
- key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%@-%@",self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.stuNum)? RQ_USER_MANAGER.currentUser.stuNum : @"0", RQ_Exercise_Module.otherStr];
- }
- [RQ_SHARE_FUNCTION saveObjectWithObject:@(questionId) ForKey:key];
- }
- - (NSString *)isWelcomed {
- id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isWelcomed"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *isWelcomed = (NSString *)object;
- return isWelcomed;
- }
- }
- - (void)setIsWelcomed:(NSString *)isWelcomed {
- [RQ_SHARE_FUNCTION saveObjectWithObject:isWelcomed ForKey:@"isWelcomed"];
- }
- - (NSString *)car_type {
- return [self getCar_TypeNameWithCarType:self.carType];
- }
- - (NSString *)userSubj1Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"userSubj1Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *userSubj1Index = (NSString *)object;
- return userSubj1Index;
- }
- }
- - (void)setUserSubj1Index:(NSString *)userSubj1Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:userSubj1Index ForKey:@"userSubj1Index"];
- }
- - (NSString *)userSubj4Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"userSubj4Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *userSubj4Index = (NSString *)object;
- return userSubj4Index;
- }
- }
- - (void)setUserSubj4Index:(NSString *)userSubj4Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:userSubj4Index ForKey:@"userSubj4Index"];
- }
- - (NSString *)user1Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"user1Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *user1Index = (NSString *)object;
- return user1Index;
- }
- }
- - (void)setUser1Index:(NSString *)user1Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:user1Index ForKey:@"user1Index"];
- }
- - (NSString *)user4Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"user4Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *user4Index = (NSString *)object;
- return user4Index;
- }
- }
- - (void)setUser4Index:(NSString *)user4Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:user4Index ForKey:@"user4Index"];
- }
- - (NSString *)A2Subj1Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A2Subj1Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *A2Subj1Index = (NSString *)object;
- return A2Subj1Index;
- }
- }
- - (void)setA2Subj1Index:(NSString *)A2Subj1Index{
- [RQ_COMMON_MANAGER saveObjectWithObject:A2Subj1Index ForKey:@"A2Subj1Index"];
- }
- - (NSString *)A2Subj4Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A2Subj4Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *A2Subj4Index = (NSString *)object;
- return A2Subj4Index;
- }
- }
- - (void)setA2Subj4Index:(NSString *)A2Subj4Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:A2Subj4Index ForKey:@"A2Subj4Index"];
- }
- - (NSString *)A1Subj1Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A1Subj1Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *A1Subj1Index = (NSString *)object;
- return A1Subj1Index;
- }
- }
- - (void)setA1Subj1Index:(NSString *)A1Subj1Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:A1Subj1Index ForKey:@"A1Subj1Index"];
- }
- - (NSString *)A1Subj4Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A1Subj4Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *A1Subj4Index = (NSString *)object;
- return A1Subj4Index;
- }
- }
- - (void)setA1Subj4Index:(NSString *)A1Subj4Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:A1Subj4Index ForKey:@"A1Subj4Index"];
- }
- - (NSString *)DSubj1Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"DSubj1Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *DSubj1Index = (NSString *)object;
- return DSubj1Index;
- }
- }
- - (void)setDSubj1Index:(NSString *)DSubj1Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:DSubj1Index ForKey:@"DSubj1Index"];
- }
- - (NSString *)DSubj4Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"DSubj4Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *DSubj4Index = (NSString *)object;
- return DSubj4Index;
- }
- }
- - (void)setDSubj4Index:(NSString *)DSubj4Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:DSubj4Index ForKey:@"DSubj4Index"];
- }
- - (NSString *)coachIndex {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"coachIndex"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *coachIndex = (NSString *)object;
- return coachIndex;
- }
- }
- - (void)setCoachIndex:(NSString *)coachIndex {
- [RQ_COMMON_MANAGER saveObjectWithObject:coachIndex ForKey:@"coachIndex"];
- }
- - (NSString *)A1Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A1Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *A1Index = (NSString *)object;
- return A1Index;
- }
- }
- - (void)setA1Index:(NSString *)A1Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:A1Index ForKey:@"A1Index"];
- }
- - (NSString *)A2Index {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A2Index"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *A2Index = (NSString *)object;
- return A2Index;
- }
- }
- - (void)setA2Index:(NSString *)A2Index {
- [RQ_COMMON_MANAGER saveObjectWithObject:A2Index ForKey:@"A2Index"];
- }
- - (NSString *)dangerIndex {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"dangerIndex"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *dangerIndex = (NSString *)object;
- return dangerIndex;
- }
- }
- - (void)setDangerIndex:(NSString *)dangerIndex {
- [RQ_COMMON_MANAGER saveObjectWithObject:dangerIndex ForKey:@"dangerIndex"];
- }
- - (NSString *)texiIndex {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"texiIndex"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *texiIndex = (NSString *)object;
- return texiIndex;
- }
- }
- - (void)setTexiIndex:(NSString *)texiIndex {
- [RQ_COMMON_MANAGER saveObjectWithObject:texiIndex ForKey:@"texiIndex"];
- }
- - (NSString *)wycIndex {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"wycIndex"];
- if (RQObjectIsNil(object)) {
- return @"";
- } else {
- NSString *wycIndex = (NSString *)object;
- return wycIndex;
- }
- }
- - (void)setWycIndex:(NSString *)wycIndex {
- [RQ_COMMON_MANAGER saveObjectWithObject:wycIndex ForKey:@"wycIndex"];
- }
- - (NSString *)isZhiGeZheng {
- id object = [RQ_COMMON_MANAGER getObjectWithKey:@"isZhiGeZheng"];
- if (RQObjectIsNil(object)) {
- return @"NO";
- } else {
- NSString *isZhiGeZheng = (NSString *)object;
- return isZhiGeZheng;
- }
- }
- - (void)setIsZhiGeZheng:(NSString *)isZhiGeZheng {
- [RQ_COMMON_MANAGER saveObjectWithObject:isZhiGeZheng ForKey:@"isZhiGeZheng"];
- }
- #pragma mark - PrivateMethods
- - (NSString *)getCarTypeNameWithCarType:(RQHomePageCarType)carType {
- switch (carType) {
- case RQHomePageCarType_Car:
- return @"xc";
- case RQHomePageCarType_Bus:
- return @"kc";
- case RQHomePageCarType_Truck:
- return @"hc";
- case RQHomePageCarType_Motorcycle:
- return @"mtc";
- case RQHomePageCarType_ZGZ_JLY:
- return @"zgzjl";
- case RQHomePageCarType_ZGZ_KY:
- return @"zgzky";
- case RQHomePageCarType_ZGZ_HY:
- return @"zgzhy";
- case RQHomePageCarType_ZGZ_WXP:
- return @"zgzwxp";
- case RQHomePageCarType_ZGZ_CZC:
- return @"zgzcz";
- case RQHomePageCarType_ZGZ_WYC:
- return @"zgzwyc";
-
- default:
- return @"xc";
- }
- }
- - (void)rq_showDBUpdateView {
- @weakify(self)
- dispatch_async(dispatch_get_main_queue(), ^{
- @strongify(self)
- RQUpdateView *dbUpdateView = [RQUpdateView updateView];
- dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_LibDownload;
- dbUpdateView.downloadUrl = self.downloadUrl;
-
- QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
- dbModalViewController.contentView = dbUpdateView;
- dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
- dbModalViewController.modal = YES;
-
- dbUpdateView.modalViewController = dbModalViewController;
- [dbModalViewController showWithAnimated:YES completion:nil];
-
- });
- }
- - (void)rq_showJSUpdateView {
- @weakify(self)
- dispatch_async(dispatch_get_main_queue(), ^{
- @strongify(self)
- RQUpdateView *dbUpdateView = [RQUpdateView updateView];
- dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_ExplainDownload;
- dbUpdateView.jsDownloadUrl = self.jsDownloadUrl;
-
- QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
- dbModalViewController.contentView = dbUpdateView;
- dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
- dbModalViewController.modal = YES;
-
- dbUpdateView.modalViewController = dbModalViewController;
- [dbModalViewController showWithAnimated:YES completion:nil];
-
- });
- }
- - (void)rq_showJQUpdateView {
- @weakify(self)
- dispatch_async(dispatch_get_main_queue(), ^{
- @strongify(self)
- RQUpdateView *dbUpdateView = [RQUpdateView updateView];
- dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_ExplainDownload;
- dbUpdateView.jsDownloadUrl = self.jqDownloadUrl;
- QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
- dbModalViewController.contentView = dbUpdateView;
- dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
- dbModalViewController.modal = YES;
-
- dbUpdateView.modalViewController = dbModalViewController;
- [dbModalViewController showWithAnimated:YES completion:nil];
- });
- }
- @end
|