RQYDTQuestionModule.m 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058
  1. //
  2. // RQYDTQuestionModule.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/3/28.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQYDTQuestionModule.h"
  9. #import "RQYDTXCQuestionModule.h"
  10. #import "RQYDTHCQuestionModule.h"
  11. #import "RQYDTKCQuestionModule.h"
  12. #import "RQYDTMTCQuestionModule.h"
  13. #import "RQYDTZGZJLYQuestionModule.h"
  14. #import "RQYDTZGZKYQuestionModule.h"
  15. #import "RQYDTZGZHYQuestionModule.h"
  16. #import "RQYDTZGZWXPQuestionModule.h"
  17. #import "RQYDTZGZCZCQuestionModule.h"
  18. #import "RQYDTZGZWYCQuestionModule.h"
  19. NSString * const RQCarTypeChangeNotification = @"RQCarTypeChangeNotification";
  20. /// 正式环境key
  21. static NSString * const RQYDTQuestionCarTypeKey = @"RQYDTQuestionCarTypeKey";
  22. @interface RQYDTQuestionModule ()
  23. /// 科目一顺序练习
  24. @property (nonatomic, readwrite, copy) NSArray *subjectOneArr;
  25. /// 科目四顺序练习
  26. @property (nonatomic, readwrite, copy) NSArray *subjectFourArr;
  27. @property (nonatomic, readwrite, strong) NSString *downloadUrl;
  28. @property (nonatomic, readwrite, strong) NSString *jsDownloadUrl;
  29. @property (nonatomic, readwrite, strong) NSString *jqDownloadUrl;
  30. @end
  31. @implementation RQYDTQuestionModule
  32. static id rq_ydtQuestionModule = nil;
  33. #pragma mark - init
  34. + (instancetype)sharedInstance {
  35. static dispatch_once_t onceToken;
  36. dispatch_once(&onceToken, ^{
  37. rq_ydtQuestionModule = [[self alloc] init];
  38. });
  39. return rq_ydtQuestionModule;
  40. }
  41. - (instancetype)init {
  42. if (self = [super init]) {
  43. NSInteger userVersion = [RQ_YDT_USER_Question_Module getQuestionVersion];
  44. NSLog(@"用户题库版本号:%ld",userVersion);
  45. NSInteger xcVersion = [RQ_YDT_XC_Question_Module getQuestionVersion];
  46. NSLog(@"小车题库版本号:%ld",xcVersion);
  47. NSInteger hcVersion = [RQ_YDT_HC_Question_Module getQuestionVersion];
  48. NSLog(@"货车题库版本号:%ld",hcVersion);
  49. NSInteger kcVersion = [RQ_YDT_KC_Question_Module getQuestionVersion];
  50. NSLog(@"客车题库版本号:%ld",kcVersion);
  51. NSInteger mtcVersion = [RQ_YDT_MTC_Question_Module getQuestionVersion];
  52. NSLog(@"摩托车题库版本号:%ld",mtcVersion);
  53. NSInteger zgzJlyVersion = [RQ_YDT_ZGZ_JLY_Question_Module getQuestionVersion];
  54. NSLog(@"资格证教练员题库版本号:%ld",zgzJlyVersion);
  55. }
  56. return self;
  57. }
  58. - (void)saveQuestionsWithSubjectOneArr:(NSArray *)subjectOneArr {
  59. self.subjectOneArr = subjectOneArr;
  60. }
  61. - (void)saveQuestionsWithSubjectFourArr:(NSArray *)subjectFourArr {
  62. self.subjectFourArr = subjectFourArr;
  63. }
  64. - (void)setCarType:(RQHomePageCarType)carType {
  65. NSString *carTypeStr = [NSString stringWithFormat:@"%@",[NSNumber numberWithInteger:carType]];
  66. [[NSUserDefaults standardUserDefaults] setObject:carTypeStr forKey:RQYDTQuestionCarTypeKey];
  67. [[NSUserDefaults standardUserDefaults] synchronize];
  68. }
  69. - (NSMutableArray *)errorCollectionArr{
  70. if(!_errorCollectionArr){
  71. _errorCollectionArr = [NSMutableArray array];
  72. }
  73. return _errorCollectionArr;
  74. }
  75. - (NSMutableArray *)errorRemoveArr{
  76. if(!_errorRemoveArr){
  77. _errorRemoveArr = [NSMutableArray array];
  78. }
  79. return _errorRemoveArr;
  80. }
  81. - (RQHomePageCarType)carType {
  82. NSString *carTypeStr = [[NSUserDefaults standardUserDefaults] objectForKey:RQYDTQuestionCarTypeKey];
  83. carTypeStr = [carTypeStr rq_stringValueExtension];
  84. return carTypeStr.integerValue;
  85. }
  86. - (NSString *)carTypeStr {
  87. return [self getCarTypeNameWithCarType:self.carType];
  88. }
  89. - (NSString *)carTypeStrNew {
  90. switch (self.carType) {
  91. case RQHomePageCarType_Car:
  92. return @"cart";
  93. case RQHomePageCarType_Bus:
  94. return @"bus";
  95. case RQHomePageCarType_Truck:
  96. return @"truck";
  97. case RQHomePageCarType_Motorcycle:
  98. return @"mtc";
  99. case RQHomePageCarType_ZGZ_JLY:
  100. return @"zgzjl";
  101. case RQHomePageCarType_ZGZ_KY:
  102. return @"zgzky";
  103. case RQHomePageCarType_ZGZ_HY:
  104. return @"zgzhy";
  105. case RQHomePageCarType_ZGZ_WXP:
  106. return @"zgzwxp";
  107. case RQHomePageCarType_ZGZ_CZC:
  108. return @"zgzcz";
  109. case RQHomePageCarType_ZGZ_WYC:
  110. return @"zgzwyc";
  111. default:
  112. return @"cart";
  113. }
  114. }
  115. - (NSString *)subjectStr {
  116. return [self getSubjectNameWithSubject:self.subject];
  117. }
  118. #pragma mark - PublicMethods
  119. /// 更新题库
  120. - (void)rq_updateQuestion {
  121. @weakify(self)
  122. [[[RQ_HTTP_Service getUpdateQuestion] deliverOnMainThread] subscribeNext:^(NSArray *arr) {
  123. [[arr.rac_sequence.signal filter:^BOOL(RQDictInfoModel *dictInfoModel) {
  124. return [dictInfoModel.dictLabel isEqualToString:[RQ_YDTQuestion_Module getCarTypeCNTiKuUpdateNameWithCarType:RQ_YDTQuestion_Module.carType]];
  125. }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
  126. @strongify(self)
  127. NSInteger netVersion = dictInfoModel.remark.integerValue;
  128. NSInteger localVersion = [RQ_YDTQuestion_Module getQuestionVersion];
  129. self.downloadUrl = dictInfoModel.dictValue;
  130. if (netVersion > localVersion) {
  131. NSLog(@"题库需要更新!");
  132. [self rq_showDBUpdateView];
  133. } else {
  134. NSLog(@"题库不需要更新!");
  135. }
  136. }];
  137. [[arr.rac_sequence.signal filter:^BOOL(RQDictInfoModel *dictInfoModel) {
  138. return [dictInfoModel.dictLabel isEqualToString:@"题库解释"];
  139. }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
  140. @strongify(self)
  141. NSInteger netVersion = dictInfoModel.remark.integerValue;
  142. NSInteger localVersion = [RQ_YDT_JS_Question_Module getQuestionVersion];
  143. self.jsDownloadUrl = dictInfoModel.dictValue;
  144. if (netVersion > localVersion) {
  145. NSLog(@"解释题库需要更新!");
  146. [self rq_showJSUpdateView];
  147. } else {
  148. NSLog(@"解释题库不需要更新!");
  149. }
  150. }];
  151. [[arr.rac_sequence.signal filter:^BOOL(RQDictInfoModel *dictInfoModel) {
  152. return [dictInfoModel.dictLabel isEqualToString:@"快通解释"];
  153. }] subscribeNext:^(RQDictInfoModel *dictInfoModel) {
  154. @strongify(self)
  155. NSInteger netVersion = dictInfoModel.remark.integerValue;
  156. NSInteger localVersion = [YN_YDT_JQ_Question_Module getQuestionVersion];
  157. self.jqDownloadUrl = dictInfoModel.dictValue;
  158. if (netVersion > localVersion) {
  159. NSLog(@"快通解释题库需要更新!");
  160. [self rq_showJQUpdateView];
  161. } else {
  162. NSLog(@"快通解释题库不需要更新!");
  163. }
  164. }];
  165. }];
  166. }
  167. - (NSInteger)getQuestionVersion {
  168. switch (self.carType) {
  169. case RQHomePageCarType_Car:
  170. return [RQ_YDT_XC_Question_Module getQuestionVersion];
  171. case RQHomePageCarType_Truck:
  172. return [RQ_YDT_HC_Question_Module getQuestionVersion];
  173. case RQHomePageCarType_Bus:
  174. return [RQ_YDT_KC_Question_Module getQuestionVersion];
  175. case RQHomePageCarType_Motorcycle:
  176. return [RQ_YDT_MTC_Question_Module getQuestionVersion];
  177. case RQHomePageCarType_ZGZ_JLY:
  178. return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionVersion];
  179. case RQHomePageCarType_ZGZ_KY:
  180. return [RQ_YDT_ZGZ_KY_Question_Module getQuestionVersion];
  181. case RQHomePageCarType_ZGZ_HY:
  182. return [RQ_YDT_ZGZ_HY_Question_Module getQuestionVersion];
  183. case RQHomePageCarType_ZGZ_WXP:
  184. return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionVersion];
  185. case RQHomePageCarType_ZGZ_CZC:
  186. return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionVersion];
  187. case RQHomePageCarType_ZGZ_WYC:
  188. return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionVersion];
  189. default:
  190. return [RQ_YDT_XC_Question_Module getQuestionVersion];
  191. }
  192. }
  193. - (NSString *)getSubjectNameWithSubject:(RQHomePageSubjectType)subject {
  194. switch (subject) {
  195. case RQHomePageSubjectType_SubjectOne:
  196. return @"1";
  197. case RQHomePageSubjectType_SubjectTwo:
  198. return @"2";
  199. case RQHomePageSubjectType_SubjectThree:
  200. return @"3";
  201. case RQHomePageSubjectType_SubjectFour:
  202. return @"4";
  203. default:
  204. return @"1";
  205. }
  206. }
  207. - (RQHomePageSubjectType)getSubjectWithSubjectName:(NSString *)subjectName {
  208. if ([subjectName isEqualToString:@"1"]) {
  209. return RQHomePageSubjectType_SubjectOne;
  210. } else if ([subjectName isEqualToString:@"2"]) {
  211. return RQHomePageSubjectType_SubjectTwo;
  212. } else if ([subjectName isEqualToString:@"3"]) {
  213. return RQHomePageSubjectType_SubjectThree;
  214. } else if ([subjectName isEqualToString:@"4"]) {
  215. return RQHomePageSubjectType_SubjectFour;
  216. } else {
  217. return RQHomePageSubjectType_SubjectOne;
  218. }
  219. }
  220. - (RQHomePageCarType)getCarTypeWithCarTypeName:(NSString *)carTypeName {
  221. if ([carTypeName isEqualToString:@"C1"]) {
  222. return RQHomePageCarType_Car;
  223. } else if ([carTypeName isEqualToString:@"A2"]) {
  224. return RQHomePageCarType_Truck;
  225. } else if ([carTypeName isEqualToString:@"A1"]) {
  226. return RQHomePageCarType_Bus;
  227. } else if ([carTypeName isEqualToString:@"D"]) {
  228. return RQHomePageCarType_Motorcycle;
  229. } else if ([carTypeName isEqualToString:@"4"]) {
  230. return RQHomePageCarType_ZGZ_JLY;
  231. } else if ([carTypeName isEqualToString:@"1"]) {
  232. return RQHomePageCarType_ZGZ_KY;
  233. } else if ([carTypeName isEqualToString:@"2"]) {
  234. return RQHomePageCarType_ZGZ_HY;
  235. } else if ([carTypeName isEqualToString:@"3"]) {
  236. return RQHomePageCarType_ZGZ_WXP;
  237. } else if ([carTypeName isEqualToString:@"5"]) {
  238. return RQHomePageCarType_ZGZ_CZC;
  239. } else if ([carTypeName isEqualToString:@"6"]) {
  240. return RQHomePageCarType_ZGZ_WYC;
  241. } else {
  242. return RQHomePageCarType_Car;
  243. }
  244. }
  245. - (NSString *)getCarTypeCNNameWithCarType:(RQHomePageCarType)carType {
  246. switch (carType) {
  247. case RQHomePageCarType_Car:
  248. return @"小车";
  249. case RQHomePageCarType_Truck:
  250. return @"货车";
  251. case RQHomePageCarType_Bus:
  252. return @"客车";
  253. case RQHomePageCarType_Motorcycle:
  254. return @"摩托车";
  255. case RQHomePageCarType_ZGZ_JLY:
  256. return @"教练员";
  257. case RQHomePageCarType_ZGZ_HY:
  258. return @"货运";
  259. case RQHomePageCarType_ZGZ_WXP:
  260. return @"危险品";
  261. case RQHomePageCarType_ZGZ_KY:
  262. return @"客运";
  263. case RQHomePageCarType_ZGZ_CZC:
  264. return @"出租车";
  265. case RQHomePageCarType_ZGZ_WYC:
  266. return @"网约车";
  267. default:
  268. return @"小车";
  269. }
  270. }
  271. - (NSString *)getCarTypeCNTiKuUpdateNameWithCarType:(RQHomePageCarType)carType {
  272. switch (carType) {
  273. case RQHomePageCarType_Car:
  274. return @"小车";
  275. case RQHomePageCarType_Truck:
  276. return @"货车";
  277. case RQHomePageCarType_Bus:
  278. return @"客车";
  279. case RQHomePageCarType_Motorcycle:
  280. return @"摩托车";
  281. case RQHomePageCarType_ZGZ_JLY:
  282. return @"教练员资格证";
  283. case RQHomePageCarType_ZGZ_HY:
  284. return @"货运资格证";
  285. case RQHomePageCarType_ZGZ_WXP:
  286. return @"危险品资格证";
  287. case RQHomePageCarType_ZGZ_KY:
  288. return @"客运资格证";
  289. case RQHomePageCarType_ZGZ_CZC:
  290. return @"出租车资格证";
  291. case RQHomePageCarType_ZGZ_WYC:
  292. return @"网约车资格证";
  293. default:
  294. return @"小车";
  295. }
  296. }
  297. - (NSString *)getCarTypeExamNameWithCarType:(RQHomePageCarType)carType {
  298. switch (carType) {
  299. case RQHomePageCarType_Car:
  300. return @"小车C1/C2/C3";
  301. case RQHomePageCarType_Bus:
  302. return @"客车A1/A3/B1";
  303. case RQHomePageCarType_Truck:
  304. return @"货车A2/B2";
  305. case RQHomePageCarType_Motorcycle:
  306. return @"摩托车D/E/F";
  307. case RQHomePageCarType_ZGZ_JLY:
  308. return @"教练员";
  309. case RQHomePageCarType_ZGZ_KY:
  310. return @"客运";
  311. case RQHomePageCarType_ZGZ_HY:
  312. return @"货运";
  313. case RQHomePageCarType_ZGZ_WXP:
  314. return @"危险品";
  315. case RQHomePageCarType_ZGZ_CZC:
  316. return @"出租车";
  317. case RQHomePageCarType_ZGZ_WYC:
  318. return @"网约车";
  319. default:
  320. return @"小车";
  321. }
  322. }
  323. - (NSString *)getCar_TypeNameWithCarType:(RQHomePageCarType)carType {
  324. switch (carType) {
  325. case RQHomePageCarType_Car:
  326. return @"C1";
  327. case RQHomePageCarType_Truck:
  328. return @"A2";
  329. case RQHomePageCarType_Bus:
  330. return @"A1";
  331. case RQHomePageCarType_Motorcycle:
  332. return @"D";
  333. case RQHomePageCarType_ZGZ_JLY:
  334. return @"4";
  335. case RQHomePageCarType_ZGZ_HY:
  336. return @"2";
  337. case RQHomePageCarType_ZGZ_WXP:
  338. return @"3";
  339. case RQHomePageCarType_ZGZ_KY:
  340. return @"1";
  341. case RQHomePageCarType_ZGZ_CZC:
  342. return @"5";
  343. case RQHomePageCarType_ZGZ_WYC:
  344. return @"6";
  345. default:
  346. return @"C1";
  347. }
  348. }
  349. - (NSArray *)getQuestionWithExerciseType:(RQExerciseType)exerciseType questionIds:(NSString*)questionIds {
  350. switch (self.carType) {
  351. case RQHomePageCarType_Car:
  352. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType questionIds:questionIds];
  353. default:
  354. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  355. }
  356. return @[];
  357. }
  358. - (NSArray *)getQuestionWithExerciseType:(RQExerciseType)exerciseType code:(NSInteger)code {
  359. switch (self.carType) {
  360. case RQHomePageCarType_Car:
  361. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType code:code];
  362. default:
  363. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  364. }
  365. return @[];
  366. }
  367. - (NSArray *)getQuestionWithExerciseType:(RQExerciseType)exerciseType {
  368. switch (self.carType) {
  369. case RQHomePageCarType_Car:
  370. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  371. case RQHomePageCarType_Truck:
  372. return [RQ_YDT_HC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  373. case RQHomePageCarType_Bus:
  374. return [RQ_YDT_KC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  375. case RQHomePageCarType_Motorcycle:
  376. return [RQ_YDT_MTC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  377. case RQHomePageCarType_ZGZ_JLY:
  378. return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  379. case RQHomePageCarType_ZGZ_KY:
  380. return [RQ_YDT_ZGZ_KY_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  381. case RQHomePageCarType_ZGZ_HY:
  382. return [RQ_YDT_ZGZ_HY_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  383. case RQHomePageCarType_ZGZ_WXP:
  384. return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  385. case RQHomePageCarType_ZGZ_CZC:
  386. return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  387. case RQHomePageCarType_ZGZ_WYC:
  388. return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  389. default:
  390. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:self.subject exerciseType:exerciseType];
  391. }
  392. }
  393. - (NSArray *)getQuestionWithSubject:(RQHomePageSubjectType)subject exerciseType:(RQExerciseType)exerciseType {
  394. switch (self.carType) {
  395. case RQHomePageCarType_Car:
  396. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  397. case RQHomePageCarType_Truck:
  398. return [RQ_YDT_HC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  399. case RQHomePageCarType_Bus:
  400. return [RQ_YDT_KC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  401. case RQHomePageCarType_Motorcycle:
  402. return [RQ_YDT_MTC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  403. case RQHomePageCarType_ZGZ_JLY:
  404. return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  405. case RQHomePageCarType_ZGZ_KY:
  406. return [RQ_YDT_ZGZ_KY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  407. case RQHomePageCarType_ZGZ_HY:
  408. return [RQ_YDT_ZGZ_HY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  409. case RQHomePageCarType_ZGZ_WXP:
  410. return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  411. case RQHomePageCarType_ZGZ_CZC:
  412. return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  413. case RQHomePageCarType_ZGZ_WYC:
  414. return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  415. default:
  416. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  417. }
  418. }
  419. - (NSArray *)getQuestionWithSubject:(RQHomePageSubjectType)subject exerciseType:(RQExerciseType)exerciseType isNeedMediaData:(BOOL)isNeedMediaData {
  420. switch (self.carType) {
  421. case RQHomePageCarType_Car:
  422. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  423. case RQHomePageCarType_Truck:
  424. return [RQ_YDT_HC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  425. case RQHomePageCarType_Bus:
  426. return [RQ_YDT_KC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  427. case RQHomePageCarType_Motorcycle:
  428. return [RQ_YDT_MTC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  429. case RQHomePageCarType_ZGZ_JLY:
  430. return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  431. case RQHomePageCarType_ZGZ_KY:
  432. return [RQ_YDT_ZGZ_KY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  433. case RQHomePageCarType_ZGZ_HY:
  434. return [RQ_YDT_ZGZ_HY_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  435. case RQHomePageCarType_ZGZ_WXP:
  436. return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  437. case RQHomePageCarType_ZGZ_CZC:
  438. return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  439. case RQHomePageCarType_ZGZ_WYC:
  440. return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType ];
  441. default:
  442. return [RQ_YDT_XC_Question_Module getQuestionWithSubject:subject exerciseType:exerciseType];
  443. }
  444. }
  445. - (NSInteger)getQuestionNumWithWithSubject:(RQHomePageSubjectType)subject exerciseType:(RQExerciseType)exerciseType {
  446. switch (self.carType) {
  447. case RQHomePageCarType_Car:
  448. return [RQ_YDT_XC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
  449. case RQHomePageCarType_Truck:
  450. return [RQ_YDT_HC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
  451. case RQHomePageCarType_Bus:
  452. return [RQ_YDT_KC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
  453. case RQHomePageCarType_Motorcycle:
  454. return [RQ_YDT_MTC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
  455. case RQHomePageCarType_ZGZ_JLY:
  456. return [RQ_YDT_ZGZ_JLY_Question_Module getQuestionNumWithExerciseType:exerciseType];
  457. case RQHomePageCarType_ZGZ_KY:
  458. return [RQ_YDT_ZGZ_KY_Question_Module getQuestionNumWithExerciseType:exerciseType];
  459. case RQHomePageCarType_ZGZ_HY:
  460. return [RQ_YDT_ZGZ_HY_Question_Module getQuestionNumWithExerciseType:exerciseType];
  461. case RQHomePageCarType_ZGZ_WXP:
  462. return [RQ_YDT_ZGZ_WXP_Question_Module getQuestionNumWithExerciseType:exerciseType];
  463. case RQHomePageCarType_ZGZ_CZC:
  464. return [RQ_YDT_ZGZ_CZC_Question_Module getQuestionNumWithExerciseType:exerciseType];
  465. case RQHomePageCarType_ZGZ_WYC:
  466. return [RQ_YDT_ZGZ_WYC_Question_Module getQuestionNumWithExerciseType:exerciseType];
  467. default:
  468. return [RQ_YDT_XC_Question_Module getQuestionNumWithWithSubject:subject exerciseType:exerciseType];
  469. }
  470. }
  471. - (NSArray *)getChapterArr {
  472. switch (self.carType) {
  473. case RQHomePageCarType_Car:
  474. return [RQ_YDT_XC_Question_Module getChapter];
  475. case RQHomePageCarType_Truck:
  476. return [RQ_YDT_HC_Question_Module getChapter];
  477. case RQHomePageCarType_Bus:
  478. return [RQ_YDT_KC_Question_Module getChapter];
  479. case RQHomePageCarType_Motorcycle:
  480. return [RQ_YDT_MTC_Question_Module getChapter];
  481. case RQHomePageCarType_ZGZ_JLY:
  482. return [RQ_YDT_ZGZ_JLY_Question_Module getChapter];
  483. case RQHomePageCarType_ZGZ_KY:
  484. return [RQ_YDT_ZGZ_KY_Question_Module getChapter];
  485. case RQHomePageCarType_ZGZ_HY:
  486. return [RQ_YDT_ZGZ_HY_Question_Module getChapter];
  487. case RQHomePageCarType_ZGZ_WXP:
  488. return [RQ_YDT_ZGZ_WXP_Question_Module getChapter];
  489. case RQHomePageCarType_ZGZ_CZC:
  490. return [RQ_YDT_ZGZ_CZC_Question_Module getChapter];
  491. case RQHomePageCarType_ZGZ_WYC:
  492. return [RQ_YDT_ZGZ_WYC_Question_Module getChapter];
  493. default:
  494. return [RQ_YDT_XC_Question_Module getChapter];
  495. }
  496. }
  497. - (NSArray *)getChapterQuestionWithChapterName:(NSString *)chapterName {
  498. switch (self.carType) {
  499. case RQHomePageCarType_Car:
  500. return [RQ_YDT_XC_Question_Module getChapterQuestionWithChapterName:chapterName];
  501. case RQHomePageCarType_Truck:
  502. return [RQ_YDT_HC_Question_Module getChapterQuestionWithChapterName:chapterName];
  503. case RQHomePageCarType_Bus:
  504. return [RQ_YDT_KC_Question_Module getChapterQuestionWithChapterName:chapterName];
  505. case RQHomePageCarType_Motorcycle:
  506. return [RQ_YDT_MTC_Question_Module getChapterQuestionWithChapterName:chapterName];
  507. case RQHomePageCarType_ZGZ_JLY:
  508. return [RQ_YDT_ZGZ_JLY_Question_Module getChapterQuestionWithChapterName:chapterName];
  509. case RQHomePageCarType_ZGZ_KY:
  510. return [RQ_YDT_ZGZ_KY_Question_Module getChapterQuestionWithChapterName:chapterName];
  511. case RQHomePageCarType_ZGZ_HY:
  512. return [RQ_YDT_ZGZ_HY_Question_Module getChapterQuestionWithChapterName:chapterName];
  513. case RQHomePageCarType_ZGZ_WXP:
  514. return [RQ_YDT_ZGZ_WXP_Question_Module getChapterQuestionWithChapterName:chapterName];
  515. case RQHomePageCarType_ZGZ_CZC:
  516. return [RQ_YDT_ZGZ_CZC_Question_Module getChapterQuestionWithChapterName:chapterName];
  517. case RQHomePageCarType_ZGZ_WYC:
  518. return [RQ_YDT_ZGZ_WYC_Question_Module getChapterQuestionWithChapterName:chapterName];
  519. default:
  520. return [RQ_YDT_XC_Question_Module getChapterQuestionWithChapterName:chapterName];
  521. }
  522. }
  523. - (NSArray *)getChapterQuestionWithChapterName:(NSString *)chapterName exerciseType:(RQExerciseType)exerciseType {
  524. return [RQ_YDT_XC_Question_Module getChapterQuestionWithChapterName:chapterName exerciseType:exerciseType];
  525. }
  526. - (NSArray *)getPoint {
  527. switch (self.carType) {
  528. case RQHomePageCarType_Car:
  529. return [RQ_YDT_XC_Question_Module getPoint];
  530. case RQHomePageCarType_Truck:
  531. return [RQ_YDT_HC_Question_Module getPoint];
  532. case RQHomePageCarType_Bus:
  533. return [RQ_YDT_KC_Question_Module getPoint];
  534. case RQHomePageCarType_Motorcycle:
  535. return [RQ_YDT_MTC_Question_Module getPoint];
  536. case RQHomePageCarType_ZGZ_JLY:
  537. return [RQ_YDT_ZGZ_JLY_Question_Module getPoint];
  538. case RQHomePageCarType_ZGZ_KY:
  539. return [RQ_YDT_ZGZ_KY_Question_Module getPoint];
  540. case RQHomePageCarType_ZGZ_HY:
  541. return [RQ_YDT_ZGZ_HY_Question_Module getPoint];
  542. case RQHomePageCarType_ZGZ_WXP:
  543. return [RQ_YDT_ZGZ_WXP_Question_Module getPoint];
  544. case RQHomePageCarType_ZGZ_CZC:
  545. return [RQ_YDT_ZGZ_CZC_Question_Module getPoint];
  546. case RQHomePageCarType_ZGZ_WYC:
  547. return [RQ_YDT_ZGZ_WYC_Question_Module getPoint];
  548. default:
  549. return [RQ_YDT_XC_Question_Module getPoint];
  550. }
  551. }
  552. - (NSArray *)getPointQuestionWithPointID:(NSInteger)pointId {
  553. switch (self.carType) {
  554. case RQHomePageCarType_Car:
  555. return [RQ_YDT_XC_Question_Module getPointQuestionWithPointId:pointId];
  556. case RQHomePageCarType_Truck:
  557. return [RQ_YDT_HC_Question_Module getPointQuestionWithPointId:pointId];
  558. case RQHomePageCarType_Bus:
  559. return [RQ_YDT_KC_Question_Module getPointQuestionWithPointId:pointId];
  560. case RQHomePageCarType_Motorcycle:
  561. return [RQ_YDT_MTC_Question_Module getPointQuestionWithPointId:pointId];
  562. case RQHomePageCarType_ZGZ_JLY:
  563. return [RQ_YDT_ZGZ_JLY_Question_Module getPointQuestionWithPointId:pointId];
  564. case RQHomePageCarType_ZGZ_KY:
  565. return [RQ_YDT_ZGZ_KY_Question_Module getPointQuestionWithPointId:pointId];
  566. case RQHomePageCarType_ZGZ_HY:
  567. return [RQ_YDT_ZGZ_HY_Question_Module getPointQuestionWithPointId:pointId];
  568. case RQHomePageCarType_ZGZ_WXP:
  569. return [RQ_YDT_ZGZ_WXP_Question_Module getPointQuestionWithPointId:pointId];
  570. case RQHomePageCarType_ZGZ_CZC:
  571. return [RQ_YDT_ZGZ_CZC_Question_Module getPointQuestionWithPointId:pointId];
  572. case RQHomePageCarType_ZGZ_WYC:
  573. return [RQ_YDT_ZGZ_WYC_Question_Module getPointQuestionWithPointId:pointId];
  574. default:
  575. return [RQ_YDT_XC_Question_Module getPointQuestionWithPointId:pointId];
  576. }
  577. }
  578. - (NSArray *)getPointQuestionWithPointID:(NSInteger)pointId exerciseType:(RQExerciseType)exerciseType {
  579. return [RQ_YDT_XC_Question_Module getPointQuestionWithPointId:pointId exerciseType:exerciseType];
  580. }
  581. - (BOOL)isNewRuleQuestionWithQuestionId:(NSInteger)questionId {
  582. switch (self.carType) {
  583. case RQHomePageCarType_Car:
  584. return [RQ_YDT_XC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  585. case RQHomePageCarType_Truck:
  586. return [RQ_YDT_HC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  587. case RQHomePageCarType_Bus:
  588. return [RQ_YDT_KC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  589. case RQHomePageCarType_Motorcycle:
  590. return [RQ_YDT_MTC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  591. case RQHomePageCarType_ZGZ_JLY:
  592. return [RQ_YDT_ZGZ_JLY_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  593. case RQHomePageCarType_ZGZ_KY:
  594. return [RQ_YDT_ZGZ_KY_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  595. case RQHomePageCarType_ZGZ_HY:
  596. return [RQ_YDT_ZGZ_HY_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  597. case RQHomePageCarType_ZGZ_WXP:
  598. return [RQ_YDT_ZGZ_WXP_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  599. case RQHomePageCarType_ZGZ_CZC:
  600. return [RQ_YDT_ZGZ_CZC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  601. case RQHomePageCarType_ZGZ_WYC:
  602. return [RQ_YDT_ZGZ_WYC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  603. default:
  604. return [RQ_YDT_XC_Question_Module isNewRuleQuestionWithQuestionId:questionId];
  605. }
  606. }
  607. - (NSData *)getMediaDataWithMediaName:(NSString *)mediaName {
  608. switch (self.carType) {
  609. case RQHomePageCarType_Car:
  610. return [RQ_YDT_XC_Question_Module getMediaDataWithMediaName:mediaName];
  611. case RQHomePageCarType_Truck:
  612. return [RQ_YDT_HC_Question_Module getMediaDataWithMediaName:mediaName];
  613. case RQHomePageCarType_Bus:
  614. return [RQ_YDT_KC_Question_Module getMediaDataWithMediaName:mediaName];
  615. case RQHomePageCarType_Motorcycle:
  616. return [RQ_YDT_MTC_Question_Module getMediaDataWithMediaName:mediaName];
  617. case RQHomePageCarType_ZGZ_JLY:
  618. return [RQ_YDT_ZGZ_JLY_Question_Module getMediaDataWithMediaName:mediaName];
  619. case RQHomePageCarType_ZGZ_KY:
  620. return [RQ_YDT_ZGZ_KY_Question_Module getMediaDataWithMediaName:mediaName];
  621. case RQHomePageCarType_ZGZ_HY:
  622. return [RQ_YDT_ZGZ_HY_Question_Module getMediaDataWithMediaName:mediaName];
  623. case RQHomePageCarType_ZGZ_WXP:
  624. return [RQ_YDT_ZGZ_WXP_Question_Module getMediaDataWithMediaName:mediaName];
  625. case RQHomePageCarType_ZGZ_CZC:
  626. return [RQ_YDT_ZGZ_CZC_Question_Module getMediaDataWithMediaName:mediaName];
  627. case RQHomePageCarType_ZGZ_WYC:
  628. return [RQ_YDT_ZGZ_WYC_Question_Module getMediaDataWithMediaName:mediaName];
  629. default:
  630. return [RQ_YDT_XC_Question_Module getMediaDataWithMediaName:mediaName];
  631. }
  632. }
  633. /// 做到哪一题
  634. - (NSInteger)getHistoryQuestionNum {
  635. NSString *key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%ld-%@",self.subject,self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.loginCode)? RQ_USER_MANAGER.currentUser.loginCode : @"0"];
  636. if ((RQ_Exercise_Module.currentExerciseType == RQExerciseType_Point || RQ_Exercise_Module.currentExerciseType == RQExerciseType_Chapter) && RQStringIsNotEmpty(RQ_Exercise_Module.otherStr)) {
  637. key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%ld-%@-%@",self.subject,self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.loginCode)? RQ_USER_MANAGER.currentUser.loginCode : @"0", RQ_Exercise_Module.otherStr];
  638. }else if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Block_List) {
  639. key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%ld-%@-%@-%@",self.subject,self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.loginCode)? RQ_USER_MANAGER.currentUser.loginCode : @"0", RQ_Exercise_Module.otherStr,RQ_Exercise_Module.codeStr];
  640. }
  641. id object = [RQ_COMMON_MANAGER getObjectWithKey:key];
  642. if (RQObjectIsNil(object)) {
  643. return 0;
  644. } else {
  645. NSInteger historyQuestionNum = [object integerValue];
  646. return historyQuestionNum;
  647. }
  648. }
  649. - (void)saveHistoryQuestionNumWithQuestionId:(NSInteger)questionId {
  650. if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Error_Special_List){//易错题不记录
  651. return;
  652. }
  653. NSString *key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%ld-%@",self.subject,self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.loginCode)? RQ_USER_MANAGER.currentUser.loginCode : @"0"];
  654. if ((RQ_Exercise_Module.currentExerciseType == RQExerciseType_Point || RQ_Exercise_Module.currentExerciseType == RQExerciseType_Chapter) && RQStringIsNotEmpty(RQ_Exercise_Module.otherStr)) {
  655. key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%ld-%@-%@",self.subject,self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.loginCode)? RQ_USER_MANAGER.currentUser.loginCode : @"0", RQ_Exercise_Module.otherStr];
  656. }else if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Block_List) {
  657. key = [NSString stringWithFormat:@"HistoryQuestionNum%ld-%ld-%ld-%@-%@-%@",self.subject,self.carType,RQ_Exercise_Module.currentExerciseType,RQStringIsNotEmpty(RQ_USER_MANAGER.currentUser.loginCode)? RQ_USER_MANAGER.currentUser.loginCode : @"0", RQ_Exercise_Module.otherStr,RQ_Exercise_Module.codeStr];
  658. }
  659. [RQ_SHARE_FUNCTION saveObjectWithObject:@(questionId) ForKey:key];
  660. }
  661. - (NSString *)isWelcomed {
  662. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isWelcomed"];
  663. if (RQObjectIsNil(object)) {
  664. return @"";
  665. } else {
  666. NSString *isWelcomed = (NSString *)object;
  667. return isWelcomed;
  668. }
  669. }
  670. - (void)setIsWelcomed:(NSString *)isWelcomed {
  671. [RQ_SHARE_FUNCTION saveObjectWithObject:isWelcomed ForKey:@"isWelcomed"];
  672. }
  673. - (NSString *)car_type {
  674. return [self getCar_TypeNameWithCarType:self.carType];
  675. }
  676. - (NSString *)userSubj1Index {
  677. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"userSubj1Index"];
  678. if (RQObjectIsNil(object)) {
  679. return @"";
  680. } else {
  681. NSString *userSubj1Index = (NSString *)object;
  682. return userSubj1Index;
  683. }
  684. }
  685. - (void)setUserSubj1Index:(NSString *)userSubj1Index {
  686. [RQ_COMMON_MANAGER saveObjectWithObject:userSubj1Index ForKey:@"userSubj1Index"];
  687. }
  688. - (NSString *)userSubj4Index {
  689. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"userSubj4Index"];
  690. if (RQObjectIsNil(object)) {
  691. return @"";
  692. } else {
  693. NSString *userSubj4Index = (NSString *)object;
  694. return userSubj4Index;
  695. }
  696. }
  697. - (void)setUserSubj4Index:(NSString *)userSubj4Index {
  698. [RQ_COMMON_MANAGER saveObjectWithObject:userSubj4Index ForKey:@"userSubj4Index"];
  699. }
  700. - (NSString *)user1Index {
  701. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"user1Index"];
  702. if (RQObjectIsNil(object)) {
  703. return @"";
  704. } else {
  705. NSString *user1Index = (NSString *)object;
  706. return user1Index;
  707. }
  708. }
  709. - (void)setUser1Index:(NSString *)user1Index {
  710. [RQ_COMMON_MANAGER saveObjectWithObject:user1Index ForKey:@"user1Index"];
  711. }
  712. - (NSString *)user4Index {
  713. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"user4Index"];
  714. if (RQObjectIsNil(object)) {
  715. return @"";
  716. } else {
  717. NSString *user4Index = (NSString *)object;
  718. return user4Index;
  719. }
  720. }
  721. - (void)setUser4Index:(NSString *)user4Index {
  722. [RQ_COMMON_MANAGER saveObjectWithObject:user4Index ForKey:@"user4Index"];
  723. }
  724. - (NSString *)A2Subj1Index {
  725. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A2Subj1Index"];
  726. if (RQObjectIsNil(object)) {
  727. return @"";
  728. } else {
  729. NSString *A2Subj1Index = (NSString *)object;
  730. return A2Subj1Index;
  731. }
  732. }
  733. - (void)setA2Subj1Index:(NSString *)A2Subj1Index{
  734. [RQ_COMMON_MANAGER saveObjectWithObject:A2Subj1Index ForKey:@"A2Subj1Index"];
  735. }
  736. - (NSString *)A2Subj4Index {
  737. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A2Subj4Index"];
  738. if (RQObjectIsNil(object)) {
  739. return @"";
  740. } else {
  741. NSString *A2Subj4Index = (NSString *)object;
  742. return A2Subj4Index;
  743. }
  744. }
  745. - (void)setA2Subj4Index:(NSString *)A2Subj4Index {
  746. [RQ_COMMON_MANAGER saveObjectWithObject:A2Subj4Index ForKey:@"A2Subj4Index"];
  747. }
  748. - (NSString *)A1Subj1Index {
  749. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A1Subj1Index"];
  750. if (RQObjectIsNil(object)) {
  751. return @"";
  752. } else {
  753. NSString *A1Subj1Index = (NSString *)object;
  754. return A1Subj1Index;
  755. }
  756. }
  757. - (void)setA1Subj1Index:(NSString *)A1Subj1Index {
  758. [RQ_COMMON_MANAGER saveObjectWithObject:A1Subj1Index ForKey:@"A1Subj1Index"];
  759. }
  760. - (NSString *)A1Subj4Index {
  761. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A1Subj4Index"];
  762. if (RQObjectIsNil(object)) {
  763. return @"";
  764. } else {
  765. NSString *A1Subj4Index = (NSString *)object;
  766. return A1Subj4Index;
  767. }
  768. }
  769. - (void)setA1Subj4Index:(NSString *)A1Subj4Index {
  770. [RQ_COMMON_MANAGER saveObjectWithObject:A1Subj4Index ForKey:@"A1Subj4Index"];
  771. }
  772. - (NSString *)DSubj1Index {
  773. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"DSubj1Index"];
  774. if (RQObjectIsNil(object)) {
  775. return @"";
  776. } else {
  777. NSString *DSubj1Index = (NSString *)object;
  778. return DSubj1Index;
  779. }
  780. }
  781. - (void)setDSubj1Index:(NSString *)DSubj1Index {
  782. [RQ_COMMON_MANAGER saveObjectWithObject:DSubj1Index ForKey:@"DSubj1Index"];
  783. }
  784. - (NSString *)DSubj4Index {
  785. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"DSubj4Index"];
  786. if (RQObjectIsNil(object)) {
  787. return @"";
  788. } else {
  789. NSString *DSubj4Index = (NSString *)object;
  790. return DSubj4Index;
  791. }
  792. }
  793. - (void)setDSubj4Index:(NSString *)DSubj4Index {
  794. [RQ_COMMON_MANAGER saveObjectWithObject:DSubj4Index ForKey:@"DSubj4Index"];
  795. }
  796. - (NSString *)coachIndex {
  797. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"coachIndex"];
  798. if (RQObjectIsNil(object)) {
  799. return @"";
  800. } else {
  801. NSString *coachIndex = (NSString *)object;
  802. return coachIndex;
  803. }
  804. }
  805. - (void)setCoachIndex:(NSString *)coachIndex {
  806. [RQ_COMMON_MANAGER saveObjectWithObject:coachIndex ForKey:@"coachIndex"];
  807. }
  808. - (NSString *)A1Index {
  809. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A1Index"];
  810. if (RQObjectIsNil(object)) {
  811. return @"";
  812. } else {
  813. NSString *A1Index = (NSString *)object;
  814. return A1Index;
  815. }
  816. }
  817. - (void)setA1Index:(NSString *)A1Index {
  818. [RQ_COMMON_MANAGER saveObjectWithObject:A1Index ForKey:@"A1Index"];
  819. }
  820. - (NSString *)A2Index {
  821. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"A2Index"];
  822. if (RQObjectIsNil(object)) {
  823. return @"";
  824. } else {
  825. NSString *A2Index = (NSString *)object;
  826. return A2Index;
  827. }
  828. }
  829. - (void)setA2Index:(NSString *)A2Index {
  830. [RQ_COMMON_MANAGER saveObjectWithObject:A2Index ForKey:@"A2Index"];
  831. }
  832. - (NSString *)dangerIndex {
  833. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"dangerIndex"];
  834. if (RQObjectIsNil(object)) {
  835. return @"";
  836. } else {
  837. NSString *dangerIndex = (NSString *)object;
  838. return dangerIndex;
  839. }
  840. }
  841. - (void)setDangerIndex:(NSString *)dangerIndex {
  842. [RQ_COMMON_MANAGER saveObjectWithObject:dangerIndex ForKey:@"dangerIndex"];
  843. }
  844. - (NSString *)texiIndex {
  845. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"texiIndex"];
  846. if (RQObjectIsNil(object)) {
  847. return @"";
  848. } else {
  849. NSString *texiIndex = (NSString *)object;
  850. return texiIndex;
  851. }
  852. }
  853. - (void)setTexiIndex:(NSString *)texiIndex {
  854. [RQ_COMMON_MANAGER saveObjectWithObject:texiIndex ForKey:@"texiIndex"];
  855. }
  856. - (NSString *)wycIndex {
  857. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"wycIndex"];
  858. if (RQObjectIsNil(object)) {
  859. return @"";
  860. } else {
  861. NSString *wycIndex = (NSString *)object;
  862. return wycIndex;
  863. }
  864. }
  865. - (void)setWycIndex:(NSString *)wycIndex {
  866. [RQ_COMMON_MANAGER saveObjectWithObject:wycIndex ForKey:@"wycIndex"];
  867. }
  868. - (NSString *)isZhiGeZheng {
  869. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"isZhiGeZheng"];
  870. if (RQObjectIsNil(object)) {
  871. return @"NO";
  872. } else {
  873. NSString *isZhiGeZheng = (NSString *)object;
  874. return isZhiGeZheng;
  875. }
  876. }
  877. - (void)setIsZhiGeZheng:(NSString *)isZhiGeZheng {
  878. [RQ_COMMON_MANAGER saveObjectWithObject:isZhiGeZheng ForKey:@"isZhiGeZheng"];
  879. }
  880. #pragma mark - PrivateMethods
  881. - (NSString *)getCarTypeNameWithCarType:(RQHomePageCarType)carType {
  882. switch (carType) {
  883. case RQHomePageCarType_Car:
  884. return @"xc";
  885. case RQHomePageCarType_Bus:
  886. return @"kc";
  887. case RQHomePageCarType_Truck:
  888. return @"hc";
  889. case RQHomePageCarType_Motorcycle:
  890. return @"mtc";
  891. case RQHomePageCarType_ZGZ_JLY:
  892. return @"zgzjl";
  893. case RQHomePageCarType_ZGZ_KY:
  894. return @"zgzky";
  895. case RQHomePageCarType_ZGZ_HY:
  896. return @"zgzhy";
  897. case RQHomePageCarType_ZGZ_WXP:
  898. return @"zgzwxp";
  899. case RQHomePageCarType_ZGZ_CZC:
  900. return @"zgzcz";
  901. case RQHomePageCarType_ZGZ_WYC:
  902. return @"zgzwyc";
  903. default:
  904. return @"xc";
  905. }
  906. }
  907. - (void)rq_showDBUpdateView {
  908. @weakify(self)
  909. dispatch_async(dispatch_get_main_queue(), ^{
  910. @strongify(self)
  911. RQUpdateView *dbUpdateView = [RQUpdateView updateView];
  912. dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_LibDownload;
  913. dbUpdateView.downloadUrl = self.downloadUrl;
  914. QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
  915. dbModalViewController.contentView = dbUpdateView;
  916. dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
  917. dbModalViewController.modal = YES;
  918. dbUpdateView.modalViewController = dbModalViewController;
  919. [dbModalViewController showWithAnimated:YES completion:nil];
  920. });
  921. }
  922. - (void)rq_showJSUpdateView {
  923. @weakify(self)
  924. dispatch_async(dispatch_get_main_queue(), ^{
  925. @strongify(self)
  926. RQUpdateView *dbUpdateView = [RQUpdateView updateView];
  927. dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_ExplainDownload;
  928. dbUpdateView.jsDownloadUrl = self.jsDownloadUrl;
  929. QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
  930. dbModalViewController.contentView = dbUpdateView;
  931. dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
  932. dbModalViewController.modal = YES;
  933. dbUpdateView.modalViewController = dbModalViewController;
  934. [dbModalViewController showWithAnimated:YES completion:nil];
  935. });
  936. }
  937. - (void)rq_showJQUpdateView {
  938. @weakify(self)
  939. dispatch_async(dispatch_get_main_queue(), ^{
  940. @strongify(self)
  941. RQUpdateView *dbUpdateView = [RQUpdateView updateView];
  942. dbUpdateView.questionUpdateViewType = RQQuestionUpdateViewType_ExplainDownload;
  943. dbUpdateView.jsDownloadUrl = self.jqDownloadUrl;
  944. QMUIModalPresentationViewController *dbModalViewController = [[QMUIModalPresentationViewController alloc] init];
  945. dbModalViewController.contentView = dbUpdateView;
  946. dbModalViewController.contentViewMargins = UIEdgeInsetsMake(0, 0, 0, 0);
  947. dbModalViewController.modal = YES;
  948. dbUpdateView.modalViewController = dbModalViewController;
  949. [dbModalViewController showWithAnimated:YES completion:nil];
  950. });
  951. }
  952. @end