RQVIPModule.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. //
  2. // RQVIPModule.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/2/28.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQVIPModule.h"
  9. #include <CommonCrypto/CommonCrypto.h>
  10. @interface RQVIPModule ()
  11. @end
  12. @implementation RQVIPModule
  13. static id rq_VIPModule = nil;
  14. #pragma mark - init
  15. + (instancetype)sharedInstance {
  16. static dispatch_once_t onceToken;
  17. dispatch_once(&onceToken, ^{
  18. rq_VIPModule = [[self alloc] init];
  19. });
  20. return rq_VIPModule;
  21. }
  22. - (instancetype)init {
  23. if (self = [super init]) {
  24. }
  25. return self;
  26. }
  27. #pragma mark - PublicMethods
  28. - (void)gotoBuyVipWithVipPageType:(RQVIPPageType)vipPageType {
  29. [self gotoBuyVipWithVipPageType:vipPageType subject:RQ_YDTQuestion_Module.subject];
  30. }
  31. - (void)gotoBuyVipWithVipPageType:(RQVIPPageType)vipPageType subject:(RQHomePageSubjectType)subject {
  32. WeakSelf(weakSelf)
  33. [RQ_VIP_Module isActiveWithCcomplete:^(RQActivationModel * _Nullable activationModel, BOOL isSuccess) {
  34. if (isSuccess) {
  35. if (activationModel.isShare) {
  36. if (vipPageType == RQVIPPageType_Alert) {
  37. [weakSelf showVipAlertWithDictType:RQ_USER_MANAGER.currentUser.city subject:subject];
  38. } else {
  39. [weakSelf gotoVipViewWithDictType:RQ_USER_MANAGER.currentUser.city subject:subject];
  40. }
  41. } else {
  42. if (vipPageType == RQVIPPageType_Alert) {
  43. [weakSelf showVipAlertWithDictType:@"vip_package" subject:subject];
  44. } else {
  45. [weakSelf gotoVipViewWithDictType:@"vip_package" subject:subject];
  46. }
  47. }
  48. }
  49. }];
  50. }
  51. - (void)showVipAlertWithDictType:(NSString *)dictType subject:(RQHomePageSubjectType)subject {
  52. if (RQ_USER_MANAGER.isShouldLogin) {
  53. [MBProgressHUD rq_showProgressHUD:@"获取VIP套餐..."];
  54. [[RQ_HTTP_Service getTypeWithDictType:dictType] subscribeNext:^(NSArray *typeModels) {
  55. [MBProgressHUD rq_hideHUD];
  56. RQVipViewModel *vipViewModel = [[RQVipViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  57. RQViewModelIDKey : @(RQVIPPageType_Alert),
  58. RQViewModelUtilKey : typeModels,
  59. RQViewCommonValueKey : @(subject),
  60. }];
  61. RQVipViewController *vipViewController = [[RQVipViewController alloc] initWithViewModel:vipViewModel];
  62. [RQControllerHelper.topViewController presentPanModal:vipViewController];
  63. } error:^(NSError * _Nullable error) {
  64. [MBProgressHUD rq_hideHUD];
  65. [MBProgressHUD rq_showErrorTips:error];
  66. }];
  67. }
  68. }
  69. - (void)gotoVipViewWithDictType:(NSString *)dictType {
  70. [self gotoVipViewWithDictType:dictType subject:RQ_YDTQuestion_Module.subject];
  71. }
  72. - (void)gotoVipViewWithDictType:(NSString *)dictType subject:(RQHomePageSubjectType)subject {
  73. if (RQ_USER_MANAGER.isShouldLogin) {
  74. [MBProgressHUD rq_showProgressHUD:@"获取VIP套餐..."];
  75. [[RQ_HTTP_Service getTypeWithDictType:dictType] subscribeNext:^(NSArray *typeModels) {
  76. [MBProgressHUD rq_hideHUD];
  77. [RQ_APPDELEGATE.services pushViewModel:[[RQVipViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  78. RQViewModelIDKey : @(RQVIPPageType_Full),
  79. RQViewModelUtilKey : typeModels,
  80. RQViewCommonValueKey : @(subject),
  81. }] animated:YES];
  82. } error:^(NSError * _Nullable error) {
  83. [MBProgressHUD rq_hideHUD];
  84. [MBProgressHUD rq_showErrorTips:error];
  85. }];
  86. }
  87. }
  88. - (void)gotoVipCenter {
  89. [self gotoVipCenterWithSubject:RQ_YDTQuestion_Module.subject];
  90. }
  91. - (void)gotoVipCenterWithSubject:(RQHomePageSubjectType)subject {
  92. @weakify(self)
  93. [RQ_VIP_Module isActiveWithCcomplete:^(RQActivationModel * _Nullable activationModel, BOOL isSuccess) {
  94. @strongify(self)
  95. if (isSuccess) {
  96. if (activationModel.isShare) {
  97. [self gotoVipCenterWithDictType:RQ_USER_MANAGER.currentUser.city subject:subject];
  98. } else {
  99. [self gotoVipCenterWithDictType:@"vip_package" subject:subject];
  100. }
  101. }
  102. }];
  103. }
  104. - (void)gotoVipCenterWithDictType:(NSString *)dictType subject:(RQHomePageSubjectType)subject {
  105. if (RQ_USER_MANAGER.isShouldLogin) {
  106. [MBProgressHUD rq_showProgressHUD:@"获取VIP套餐..."];
  107. [[RQ_HTTP_Service getTypeWithDictType:dictType] subscribeNext:^(NSArray *typeModels) {
  108. [MBProgressHUD rq_hideHUD];
  109. RQVipCenterViewModel *vipCenterViewModel = [[RQVipCenterViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  110. RQViewModelUtilKey : [typeModels isKindOfClass:[NSArray class]]? typeModels : @[],
  111. RQViewCommonValueKey : @(subject),
  112. }];
  113. [RQ_APPDELEGATE.services pushViewModel:vipCenterViewModel animated:YES];
  114. } error:^(NSError * _Nullable error) {
  115. [MBProgressHUD rq_hideHUD];
  116. [MBProgressHUD rq_showErrorTips:error];
  117. }];
  118. }
  119. }
  120. //vip处理
  121. - (void)isVipWithSubjectDto:(NSInteger)subject complete:(VoidBlock_Bool)complete {
  122. if (RQ_USER_MANAGER.isShouldLogin) {
  123. __block BOOL isVerify;
  124. [[RQ_HTTP_Service getVideoVipWithUserId:RQ_USER_MANAGER.currentUser._id] subscribeNext:^(RQVideoVipModel *videoVipModel) {
  125. //rsa 公钥
  126. NSString *publicKey = [NSString stringWithFormat:@"%@%@%@",@"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCzR04LMmDlwyVRfK+Kgsm/vFMOFyqvGk4QIVC",@"Gj2CKKfhycRExm15N3tKOOouIjl/EU79It45oS+ltJkscvYrJn1zz+1bSoBLelZzJrn7K0NpHF8k", @"bCprsFHd60x+YJ4l8C3SDxfFebo4kqveJzx6JNZKwzFm7LPEO5XB9pEBRwIDAQAB"];
  127. // 构造被签名串
  128. NSMutableString *mutableVerifyString = [[NSMutableString alloc] initWithString:[NSString stringWithFormat:@"%ld",videoVipModel.userId]];
  129. if (RQStringIsNotEmpty(videoVipModel.subject1)) {
  130. [mutableVerifyString appendFormat:@"%ld",[RQ_SHARE_FUNCTION getTimeStampWithTimeStr:videoVipModel.subject1 formatter:@"yyyy-MM-dd HH:mm:ss"]];
  131. }
  132. if (RQStringIsNotEmpty(videoVipModel.subject2)) {
  133. [mutableVerifyString appendFormat:@"%ld",[RQ_SHARE_FUNCTION getTimeStampWithTimeStr:videoVipModel.subject2 formatter:@"yyyy-MM-dd HH:mm:ss"]];
  134. }
  135. if (RQStringIsNotEmpty(videoVipModel.subject3)) {
  136. [mutableVerifyString appendFormat:@"%ld",[RQ_SHARE_FUNCTION getTimeStampWithTimeStr:videoVipModel.subject3 formatter:@"yyyy-MM-dd HH:mm:ss"]];
  137. }
  138. if (RQStringIsNotEmpty(videoVipModel.subject4)) {
  139. [mutableVerifyString appendFormat:@"%ld",[RQ_SHARE_FUNCTION getTimeStampWithTimeStr:videoVipModel.subject4 formatter:@"yyyy-MM-dd HH:mm:ss"]];
  140. }
  141. [mutableVerifyString appendFormat:@"%ld",videoVipModel.subject1Int];
  142. [mutableVerifyString appendFormat:@"%ld",videoVipModel.subject2Int];
  143. [mutableVerifyString appendFormat:@"%ld",videoVipModel.subject3Int];
  144. [mutableVerifyString appendFormat:@"%ld",videoVipModel.subject4Int];
  145. //公钥验签
  146. isVerify = [self verify:mutableVerifyString.copy signature:RQStringIsNotEmpty(videoVipModel.sign)? videoVipModel.sign : @"" withPublivKey:publicKey];
  147. NSLog(@"验签通过了吧------%@", isVerify ? @"YES":@"NO");
  148. if (complete) {
  149. BOOL result;
  150. RQ_VIP_Module.isSubject1Vip = videoVipModel.subject1Int;
  151. RQ_VIP_Module.isSubject2Vip = videoVipModel.subject2Int;
  152. RQ_VIP_Module.isSubject3Vip = videoVipModel.subject3Int;
  153. RQ_VIP_Module.isSubject4Vip = videoVipModel.subject4Int;
  154. RQ_VIP_Module.isSubjectAllVip = RQ_VIP_Module.isSubject1Vip && RQ_VIP_Module.isSubject2Vip && RQ_VIP_Module.isSubject3Vip && RQ_VIP_Module.isSubject4Vip;
  155. self.videoVipModel = videoVipModel;
  156. NSInteger isAds = 0;
  157. if (subject == 1) {
  158. isAds ++;
  159. result = isVerify? RQ_VIP_Module.isSubject1Vip : NO;
  160. } else if (subject == 2) {
  161. isAds ++;
  162. result = isVerify? RQ_VIP_Module.isSubject2Vip : NO;
  163. } else if (subject == 3) {
  164. isAds ++;
  165. result = isVerify? RQ_VIP_Module.isSubject3Vip : NO;
  166. } else if (subject == 4) {
  167. isAds ++;
  168. result = isVerify? RQ_VIP_Module.isSubject4Vip : NO;
  169. } else {
  170. result = isVerify? (RQ_VIP_Module.isSubject1Vip || RQ_VIP_Module.isSubject2Vip || RQ_VIP_Module.isSubject3Vip || RQ_VIP_Module.isSubject4Vip) : NO;
  171. }
  172. RQ_VIP_Module.isADVip = (isAds >=2);
  173. RQ_VIP_Module.isVip = result;
  174. // complete(result? result : (RQ_COMMON_MANAGER.APP_SWITCH? YES : NO));
  175. complete(result? result :NO);
  176. }
  177. } error:^(NSError * _Nullable error) {
  178. [MBProgressHUD rq_showErrorTips:error];
  179. if (complete) {
  180. RQ_VIP_Module.isSubject1Vip = NO;
  181. RQ_VIP_Module.isSubject2Vip = NO;
  182. RQ_VIP_Module.isSubject3Vip = NO;
  183. RQ_VIP_Module.isSubject4Vip = NO;
  184. RQ_VIP_Module.isSubjectAllVip = NO;
  185. RQ_VIP_Module.isVip = NO;
  186. RQ_VIP_Module.isADVip = NO;
  187. self.videoVipModel = nil;
  188. complete(NO);
  189. }
  190. }];
  191. } else {
  192. if (complete) {
  193. RQ_VIP_Module.isSubject1Vip = NO;
  194. RQ_VIP_Module.isSubject2Vip = NO;
  195. RQ_VIP_Module.isSubject3Vip = NO;
  196. RQ_VIP_Module.isSubject4Vip = NO;
  197. RQ_VIP_Module.isSubjectAllVip = NO;
  198. RQ_VIP_Module.isVip = NO;
  199. RQ_VIP_Module.isADVip = NO;
  200. self.videoVipModel = nil;
  201. complete(NO);
  202. }
  203. }
  204. }
  205. /// 是否Vip
  206. - (void)isVipWithSubject:(NSInteger)subject complete:(VoidBlock_Bool)complete {
  207. if( RQ_COMMON_MANAGER.APP_SWITCH && !RQ_USER_MANAGER.isLogin ){//审核时提示 - v2.1.1
  208. [RQ_SHARE_FUNCTION showAlertWithTitle:@"提示" message:@"使用计时平台账号登录极速驾培,可享受跨平台使用权益,直接购买只会绑定当前设备" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"登录账号购买(推荐)",@"游客登录"] otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
  209. if (selectedOtherButtonIndex == 0) { //登录账号
  210. if(RQ_USER_MANAGER.isShouldLogin){
  211. NSLog(@"跳转登录");
  212. }
  213. }else if (selectedOtherButtonIndex == 1) {//游客登录
  214. NSString *deviceidStr = [SAMKeychain deviceId];
  215. NSArray *components = [deviceidStr componentsSeparatedByString:@"-"];
  216. NSString *logincode = [components lastObject];
  217. [MBProgressHUD rq_showProgressHUD:@""];
  218. [[RQ_HTTP_Service getAppleUserInfo:logincode] subscribeNext:^(RQUserModel *userModel) {
  219. [MBProgressHUD rq_hideHUD];
  220. if(userModel){
  221. userModel.nickName = userModel.userName;
  222. /// 存储用户数据nickName
  223. [RQ_USER_MANAGER loginUser:userModel];
  224. if (userModel.channel == RQUserLoginChannelTypePhone) {
  225. /// 切换更控制器
  226. dispatch_async(dispatch_get_main_queue(), ^{
  227. /// 发通知
  228. [[NSNotificationCenter defaultCenter] postNotificationName:RQSwitchRootViewControllerNotification object:nil userInfo:@{RQSwitchRootViewControllerUserInfoKey:@(RQSwitchRootViewControllerFromTypeLogin)}];
  229. });
  230. }
  231. [MBProgressHUD rq_showTips:@"登录成功"];
  232. }
  233. } error:^(NSError * _Nullable error) {
  234. [MBProgressHUD rq_hideHUD];
  235. [MBProgressHUD rq_showTips:error.description];
  236. } completed:^{
  237. }];
  238. }
  239. NSLog(@"index=%zd",selectedOtherButtonIndex);
  240. }];
  241. } else {
  242. [self isVipWithSubjectDto:subject complete:complete];
  243. }
  244. }
  245. - (void)isActiveWithCcomplete:(RQGetActivationModelBlock)complete {
  246. if (RQ_USER_MANAGER.isShouldLogin) {
  247. if([RQ_USER_MANAGER.currentUser.userName containsString:@"游客"]){//游客特殊处理
  248. if (complete) {
  249. self.activationModel = [[RQActivationModel alloc] init];
  250. self.activationModel.isActive = 1;
  251. self.activationModel.isShare = 0;
  252. self.activationModel.userId = RQ_USER_MANAGER.currentUser._id.intValue;
  253. if (!RQObjectIsNil(self.activationModel)) {
  254. if ([self.activationModel isKindOfClass:[RQActivationModel class]]) {
  255. complete(self.activationModel, YES);
  256. } else {
  257. [MBProgressHUD rq_showTips:@"获取激活信息失败"];
  258. complete(self.activationModel, NO);
  259. }
  260. } else {
  261. [MBProgressHUD rq_showTips:@"获取激活信息失败"];
  262. complete(self.activationModel, NO);
  263. }
  264. }
  265. return;
  266. }
  267. [[RQ_HTTP_Service getActivationWithUserId:RQ_USER_MANAGER.currentUser._id] subscribeNext:^(RQActivationModel *activationModel) {
  268. if (complete) {
  269. self.activationModel = activationModel;
  270. if (!RQObjectIsNil(self.activationModel)) {
  271. if ([self.activationModel isKindOfClass:[RQActivationModel class]]) {
  272. complete(self.activationModel, YES);
  273. } else {
  274. [MBProgressHUD rq_showTips:@"获取激活信息失败"];
  275. complete(self.activationModel, NO);
  276. }
  277. } else {
  278. [MBProgressHUD rq_showTips:@"获取激活信息失败"];
  279. complete(self.activationModel, NO);
  280. }
  281. }
  282. } error:^(NSError * _Nullable error) {
  283. [MBProgressHUD rq_showErrorTips:error];
  284. if (complete) {
  285. self.activationModel = nil;
  286. complete(self.activationModel, NO);
  287. }
  288. }];
  289. } else {
  290. if (complete) {
  291. self.activationModel = nil;
  292. complete(self.activationModel, NO);
  293. }
  294. }
  295. }
  296. #pragma mark - PrivateMethods
  297. // verify Signature
  298. - (BOOL)verify:(NSString *)content signature:(NSString *)signature withPublivKey:(NSString *)publicKey {
  299. SecKeyRef publicKeyRef = [self addPublicKey:publicKey];
  300. if (!publicKeyRef) { NSLog(@"添加公钥失败"); return NO; }
  301. NSData *originData = [self sha256:content];
  302. NSData *signatureData = [[NSData alloc] initWithBase64EncodedString:signature options:NSDataBase64DecodingIgnoreUnknownCharacters];
  303. if (!originData || !signatureData) { return NO; }
  304. OSStatus status = SecKeyRawVerify(publicKeyRef, kSecPaddingPKCS1SHA256, [originData bytes], originData.length, [signatureData bytes], signatureData.length);
  305. if (status ==noErr) { return YES; }
  306. else{ NSLog(@"验签失败:%d",status); return NO; }
  307. }
  308. // digest message with sha1
  309. - (NSData *)sha256:(NSString *)str {
  310. const void *data = [str cStringUsingEncoding:NSUTF8StringEncoding];
  311. CC_LONG len = (CC_LONG)strlen(data);
  312. uint8_t * md = malloc( CC_SHA256_DIGEST_LENGTH * sizeof(uint8_t) );;
  313. CC_SHA256(data, len, md);
  314. return [NSData dataWithBytes:md length:CC_SHA256_DIGEST_LENGTH];
  315. }
  316. - (SecKeyRef)addPublicKey:(NSString *)pubKey {
  317. NSData *data = [[NSData alloc] initWithBase64EncodedString:pubKey options:NSDataBase64DecodingIgnoreUnknownCharacters];
  318. //a tag to read/write keychain storage
  319. NSString *tag = @"RSA_PUBLIC_KEY";
  320. NSData *d_tag = [NSData dataWithBytes:[tag UTF8String] length:[tag length]];
  321. // Delete any old lingering key with the same tag
  322. NSMutableDictionary *publicKey = [[NSMutableDictionary alloc] init];
  323. [publicKey setObject:(__bridge id) kSecClassKey forKey:(__bridge id)kSecClass];
  324. [publicKey setObject:(__bridge id) kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType];
  325. [publicKey setObject:d_tag forKey:(__bridge id)kSecAttrApplicationTag];
  326. SecItemDelete((__bridge CFDictionaryRef)publicKey);
  327. // Add persistent version of the key to system keychain
  328. [publicKey setObject:data forKey:(__bridge id)kSecValueData];
  329. [publicKey setObject:(__bridge id) kSecAttrKeyClassPublic forKey:(__bridge id)kSecAttrKeyClass];
  330. [publicKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id)kSecReturnPersistentRef];
  331. CFTypeRef persistKey = nil;
  332. OSStatus status = SecItemAdd((__bridge CFDictionaryRef)publicKey, &persistKey);
  333. if (persistKey != nil){
  334. CFRelease(persistKey);
  335. }
  336. if ((status != noErr) && (status != errSecDuplicateItem)) { return nil; }
  337. [publicKey removeObjectForKey:(__bridge id)kSecValueData];
  338. [publicKey removeObjectForKey:(__bridge id)kSecReturnPersistentRef];
  339. [publicKey setObject:[NSNumber numberWithBool:YES] forKey:(__bridge id)kSecReturnRef];
  340. [publicKey setObject:(__bridge id) kSecAttrKeyTypeRSA forKey:(__bridge id)kSecAttrKeyType];
  341. // Now fetch the SecKeyRef version of the key
  342. SecKeyRef keyRef = nil;
  343. status = SecItemCopyMatching((__bridge CFDictionaryRef)publicKey, (CFTypeRef *)&keyRef);
  344. if(status != noErr){
  345. return nil;
  346. }
  347. return keyRef;
  348. }
  349. - (BOOL)isVip {
  350. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isVip"];
  351. if (RQObjectIsNil(object)) {
  352. return NO;
  353. } else {
  354. BOOL isVip = [object boolValue];
  355. return isVip;
  356. }
  357. }
  358. - (void)setIsVip:(BOOL)isVip {
  359. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isVip] ForKey:@"isVip"];
  360. }
  361. - (BOOL)isADVip {
  362. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isADVip"];
  363. if (RQObjectIsNil(object)) {
  364. return NO;
  365. } else {
  366. BOOL isADVip = [object boolValue];
  367. return isADVip;
  368. }
  369. }
  370. - (void)setIsADVip:(BOOL)isADVip {
  371. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isADVip] ForKey:@"isADVip"];
  372. }
  373. - (BOOL)isSubject1Vip {
  374. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isSubject1Vip"];
  375. if (RQObjectIsNil(object)) {
  376. return NO;
  377. } else {
  378. BOOL isSubject1Vip = [object boolValue];
  379. return isSubject1Vip;
  380. }
  381. }
  382. - (void)setIsSubject1Vip:(BOOL)isSubject1Vip {
  383. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isSubject1Vip] ForKey:@"isSubject1Vip"];
  384. }
  385. - (BOOL)isSubject2Vip {
  386. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isSubject2Vip"];
  387. if (RQObjectIsNil(object)) {
  388. return NO;
  389. } else {
  390. BOOL isSubject2Vip = [object boolValue];
  391. return isSubject2Vip;
  392. }
  393. }
  394. - (void)setIsSubject2Vip:(BOOL)isSubject2Vip {
  395. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isSubject2Vip] ForKey:@"isSubject2Vip"];
  396. }
  397. - (BOOL)isSubject3Vip {
  398. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isSubject3Vip"];
  399. if (RQObjectIsNil(object)) {
  400. return NO;
  401. } else {
  402. BOOL isSubject3Vip = [object boolValue];
  403. return isSubject3Vip;
  404. }
  405. }
  406. - (void)setIsSubject3Vip:(BOOL)isSubject3Vip {
  407. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isSubject3Vip] ForKey:@"isSubject3Vip"];
  408. }
  409. - (BOOL)isSubject4Vip {
  410. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isSubject4Vip"];
  411. if (RQObjectIsNil(object)) {
  412. return NO;
  413. } else {
  414. BOOL isSubject4Vip = [object boolValue];
  415. return isSubject4Vip;
  416. }
  417. }
  418. - (void)setIsSubject4Vip:(BOOL)isSubject4Vip {
  419. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isSubject4Vip] ForKey:@"isSubject4Vip"];
  420. }
  421. - (BOOL)isSubjectAllVip {
  422. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"isSubjectAllVip"];
  423. if (RQObjectIsNil(object)) {
  424. return NO;
  425. } else {
  426. BOOL isSubjectAllVip = [object boolValue];
  427. return isSubjectAllVip;
  428. }
  429. }
  430. - (void)setIsSubjectAllVip:(BOOL)isSubjectAllVip {
  431. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:isSubjectAllVip] ForKey:@"isSubjectAllVip"];
  432. }
  433. - (NSUInteger)freeLookSimExamNum {
  434. id object = [RQ_COMMON_MANAGER getObjectWithKey:@"freeLookSimExamNum"];
  435. if (RQObjectIsNil(object)) {
  436. return NO;
  437. } else {
  438. NSInteger freeLookSimExamNum = [object integerValue];
  439. return freeLookSimExamNum;
  440. }
  441. }
  442. - (void)setFreeLookSimExamNum:(NSUInteger)freeLookSimExamNum {
  443. [RQ_COMMON_MANAGER saveObjectWithObject:[NSNumber numberWithInteger:freeLookSimExamNum] ForKey:@"freeLookSimExamNum"];
  444. }
  445. @end