RONG 2 éve
szülő
commit
67035b03c4
100 módosított fájl, 6204 hozzáadás és 0 törlés
  1. 21 0
      jiaPei/ADView.h
  2. 148 0
      jiaPei/ADView.m
  3. 17 0
      jiaPei/APPdelegateModularForCustomMethod.h
  4. 120 0
      jiaPei/APPdelegateModularForCustomMethod.m
  5. 17 0
      jiaPei/APPdelegateModularForData.h
  6. 55 0
      jiaPei/APPdelegateModularForData.m
  7. 17 0
      jiaPei/APPdelegateModularForPay.h
  8. 143 0
      jiaPei/APPdelegateModularForPay.m
  9. 17 0
      jiaPei/APPdelegateModularForPush.h
  10. 403 0
      jiaPei/APPdelegateModularForPush.m
  11. 17 0
      jiaPei/APPdelegateModularForQuestionData.h
  12. 27 0
      jiaPei/APPdelegateModularForQuestionData.m
  13. 18 0
      jiaPei/APPdelegateModularForRequest.h
  14. 180 0
      jiaPei/APPdelegateModularForRequest.m
  15. 16 0
      jiaPei/APPdelegateModularForSystemSetting.h
  16. 169 0
      jiaPei/APPdelegateModularForSystemSetting.m
  17. 17 0
      jiaPei/APPdelegateModularForTest.h
  18. 69 0
      jiaPei/APPdelegateModularForTest.m
  19. 17 0
      jiaPei/APPdelegateModularForVendor.h
  20. 297 0
      jiaPei/APPdelegateModularForVendor.m
  21. 32 0
      jiaPei/AdvertisingColumn.h
  22. 224 0
      jiaPei/AdvertisingColumn.m
  23. 13 0
      jiaPei/AllLightImagePickerController.h
  24. 42 0
      jiaPei/AllLightImagePickerController.m
  25. 17 0
      jiaPei/BackgroundTaskManager.h
  26. 109 0
      jiaPei/BackgroundTaskManager.m
  27. 16 0
      jiaPei/Category/MBProgressHUD/MBProgressHUD+Add.h
  28. 54 0
      jiaPei/Category/MBProgressHUD/MBProgressHUD+Add.m
  29. BIN
      jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/error.png
  30. BIN
      jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/error@2x.png
  31. BIN
      jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/success.png
  32. BIN
      jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/success@2x.png
  33. 15 0
      jiaPei/Category/NSError/NSError+RQExtension.h
  34. 46 0
      jiaPei/Category/NSError/NSError+RQExtension.m
  35. 18 0
      jiaPei/Category/NSMutableArray/NSMutableArray+RQSafe.h
  36. 69 0
      jiaPei/Category/NSMutableArray/NSMutableArray+RQSafe.m
  37. 29 0
      jiaPei/Category/NSMutableArray/NSMutableArray+proper.h
  38. 84 0
      jiaPei/Category/NSMutableArray/NSMutableArray+proper.m
  39. 19 0
      jiaPei/Category/NSObject/NSObject+RQSafe.h
  40. 31 0
      jiaPei/Category/NSObject/NSObject+RQSafe.m
  41. 15 0
      jiaPei/Category/NSString/NSString+Check.h
  42. 49 0
      jiaPei/Category/NSString/NSString+Check.m
  43. 64 0
      jiaPei/Category/NSString/NSString+ex.h
  44. 201 0
      jiaPei/Category/NSString/NSString+ex.m
  45. 46 0
      jiaPei/Category/RQCategory.h
  46. 16 0
      jiaPei/Category/UIAlertController/UIAlertController+RQExtennsion.h
  47. 19 0
      jiaPei/Category/UIAlertController/UIAlertController+RQExtennsion.m
  48. 31 0
      jiaPei/Category/UIButton/UIButton+formatter.h
  49. 106 0
      jiaPei/Category/UIButton/UIButton+formatter.m
  50. 42 0
      jiaPei/Category/UIColor/UIColor+RQExtension.h
  51. 99 0
      jiaPei/Category/UIColor/UIColor+RQExtension.m
  52. 128 0
      jiaPei/Category/UIFont/UIFont+RQExtension.h
  53. 149 0
      jiaPei/Category/UIFont/UIFont+RQExtension.m
  54. 20 0
      jiaPei/Category/UIImage/UIImage+resize.h
  55. 83 0
      jiaPei/Category/UIImage/UIImage+resize.m
  56. 17 0
      jiaPei/Category/UITableViewCell/UITableViewCell+RQExtension.h
  57. 30 0
      jiaPei/Category/UITableViewCell/UITableViewCell+RQExtension.m
  58. 16 0
      jiaPei/Category/UITextField/UITextField+RQExtension.h
  59. 35 0
      jiaPei/Category/UITextField/UITextField+RQExtension.m
  60. 64 0
      jiaPei/Category/UIView/UIView+Frame.h
  61. 174 0
      jiaPei/Category/UIView/UIView+Frame.m
  62. 13 0
      jiaPei/Category/UIView/UIView+gesture.h
  63. 77 0
      jiaPei/Category/UIView/UIView+gesture.m
  64. 17 0
      jiaPei/Category/UIViewController/UIViewController+ModalPresentationStyle.h
  65. 44 0
      jiaPei/Category/UIViewController/UIViewController+ModalPresentationStyle.m
  66. 17 0
      jiaPei/Category/XHLaunchAdButton/XHLaunchAdButton+RQExtension.h
  67. 97 0
      jiaPei/Category/XHLaunchAdButton/XHLaunchAdButton+RQExtension.m
  68. 17 0
      jiaPei/ChildSymbolVC.h
  69. 98 0
      jiaPei/ChildSymbolVC.m
  70. 6 0
      jiaPei/Colores.xcstickers.xcstickers/Contents.json
  71. 9 0
      jiaPei/Colores.xcstickers.xcstickers/Sticker Pack.stickerpack/Contents.json
  72. 77 0
      jiaPei/Colores.xcstickers.xcstickers/iMessages App Icon.stickersiconset/Contents.json
  73. 36 0
      jiaPei/Comment.h
  74. 66 0
      jiaPei/Comment.m
  75. 91 0
      jiaPei/CommentCell.h
  76. 262 0
      jiaPei/CommentCell.m
  77. 56 0
      jiaPei/DateView.h
  78. 176 0
      jiaPei/DateView.m
  79. 19 0
      jiaPei/DetailMarkCell.h
  80. 42 0
      jiaPei/DetailMarkCell.m
  81. 20 0
      jiaPei/DetailMarkVC.h
  82. 87 0
      jiaPei/DetailMarkVC.m
  83. 145 0
      jiaPei/ENUM.h
  84. 19 0
      jiaPei/EquipmentDetailVC.h
  85. 434 0
      jiaPei/EquipmentDetailVC.m
  86. 41 0
      jiaPei/Grade.h
  87. 22 0
      jiaPei/Grade.m
  88. 38 0
      jiaPei/HolderView.h
  89. 91 0
      jiaPei/HolderView.m
  90. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/App Store.png
  91. 80 0
      jiaPei/Images.xcassets/AppIcon.appiconset/Contents.json
  92. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 5,6.png
  93. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 5,6@2x.png
  94. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 7,12@2x.png
  95. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 7,12@3x.png
  96. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 5,6 & Settings.png
  97. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 5,6 & Settings@2x.png
  98. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 5,6 & Settings@3x.png
  99. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 7,12@2x.png
  100. BIN
      jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 7,12@3x.png

+ 21 - 0
jiaPei/ADView.h

@@ -0,0 +1,21 @@
+
+
+#import <UIKit/UIKit.h>
+
+@interface ADView : UIImageView
+
+/**
+ 每次程序重新活跃时,都会加载广告。并且定时切换
+ */
+
++(id)shareMainAD;
+
++(void)showADView;
+
++(void)removeADView;
+
+-(void)removeImidiate;
+
+@end
+
+

+ 148 - 0
jiaPei/ADView.m

@@ -0,0 +1,148 @@
+/**
+ */
+
+#import "ADView.h"
+
+/**并不是要保留ADView内存。
+ 而是。在系统进入后台后,要添加ADView。
+ 在becomeActive里面。计时1.5秒移除。
+ */
+ADView *mainAD = nil;
+
+UIButton *timeBtn = nil;
+
+@interface ADView()
+
+@property(nonatomic,strong) NSMutableArray* ivs;
+
+@end
+
+@implementation ADView
+
+//单例类 为了可以在其他页面 直接删除广告
++(id)shareMainAD
+{
+    @synchronized(self)
+    {
+        if (mainAD == nil)
+        {
+            mainAD = [[ADView alloc] initWithFrame:kFrame];
+        }
+    }
+    return mainAD;
+}
++(id)allocWithZone:(struct _NSZone *)zone
+{
+    @synchronized(self)
+    {
+        if (mainAD == nil)
+        {
+            mainAD = [super allocWithZone:zone];
+        }
+    }
+    return mainAD;
+}
+
++(void)showADView
+{
+    mainAD = [ADView shareMainAD];
+    [mainAD setUserInteractionEnabled:YES];
+    [mainAD setImage:[UIImage imageNamed:@"LaunchImage.png"]];
+    [mainAD setContentMode:UIViewContentModeScaleToFill];
+    UIWindow* window = [UIApplication sharedApplication].keyWindow;
+    
+    NSString* path;
+    if (!RQ_COMMON_MANAGER.adPaths || RQ_COMMON_MANAGER.adPaths.count <1) {
+    }else{
+        path = RQ_COMMON_MANAGER.adPaths[arc4random()%RQ_COMMON_MANAGER.adPaths.count];
+    }
+    
+    UIImageView* iv = [[UIImageView alloc] initWithFrame:kFrame];
+    //iv.height -= kSize.height*.25;
+    [iv setContentMode:UIViewContentModeScaleToFill];
+    
+    if (path.length == 0) {
+        //NSLog(@"本地默认广告");
+        [iv setImage:[UIImage imageNamed:@"firstAD"]];
+    }else{
+		[iv sd_setImageWithURL:[NSURL URLWithString:path] placeholderImage:[UIImage imageNamed:@"firstAD"]];
+    }
+//    [iv setUserInteractionEnabled:YES];
+//    UITapGestureRecognizer *tapGesture  = [[UITapGestureRecognizer alloc] initWithTarget:[UIApplication sharedApplication].keyWindow action:@selector(skipADLink)];
+//    [iv addGestureRecognizer:tapGesture];
+    
+    [mainAD addSubview:iv];
+	UIButton *skipBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+	skipBtn.frame = CGRectMake(kSize.width - 65, 30, 45, 45);
+    [skipBtn setTitle:@"5" textColor:[UIColor orangeColor] Font:FontLarger fotState:UIControlStateNormal];
+    skipBtn.layer.masksToBounds = YES;
+    skipBtn.layer.cornerRadius = 22.5;
+    skipBtn.layer.borderWidth = 1.5;
+    skipBtn.layer.borderColor = [UIColor orangeColor].CGColor;
+    //[skipBtn addTarget:[UIApplication sharedApplication].delegate action:@selector(clickInADView) forControlEvents:UIControlEventTouchUpInside];
+    [mainAD addSubview:skipBtn];
+    timeBtn = skipBtn;
+    
+    //主线程中调用 显示广告
+    dispatch_after(1, dispatch_get_main_queue(), ^{
+        [window addSubview:mainAD];
+        
+        [mainAD performSelector:@selector(setBtnTitleWithString:) withObject:@"4" afterDelay:1];
+        [mainAD performSelector:@selector(setBtnTitleWithString:) withObject:@"3" afterDelay:2];
+        [mainAD performSelector:@selector(setBtnTitleWithString:) withObject:@"2" afterDelay:3];
+        [mainAD performSelector:@selector(setBtnTitleWithString:) withObject:@"1" afterDelay:4];
+        [mainAD performSelector:@selector(removeImidiate) withObject:nil afterDelay:5];
+    });
+}
+
+- (void)setBtnTitleWithString:(NSString *)str {
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [timeBtn setTitle:str forState:UIControlStateNormal];
+    });
+}
+
+//dansonmark  先不用
+-(void)skipADLink
+{
+//    NSInteger index = gesture.view.tag;
+//    
+//    NSDictionary *dic = _imgArray[index];
+  //心塞  这个搞不定呀
+//    NSLog(@"条");
+}
+
++(void)removeADView
+{
+    if (!mainAD) {
+        return;
+    }
+    [mainAD performSelector:@selector(removeImidiate) withObject:nil afterDelay:3];
+}
+
+-(void)clickInADView
+{
+    NSLog(@"此方法永不会进入 代理是APPdelegate");
+}
+
+-(void)removeImidiate
+{
+    if (!mainAD) {
+        return;
+    }
+    if (self.superview) {
+        [UIView animateWithDuration:.5 animations:^{
+            self.alpha = 0;
+        } completion:^(BOOL finished) {
+            [self removeFromSuperview];
+        }];
+    }
+}
+
+/**下载工作可以在每次will进入后台时。调用?
+ 但其实这个东西不怎么耗时。真正耗时的是加载图片。
+ 已将广告下载放到ServiceHelper  所以不用这些操作了
+ */
+
+@end
+

+ 17 - 0
jiaPei/APPdelegateModularForCustomMethod.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForCustomMethod.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForCustomMethod : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 120 - 0
jiaPei/APPdelegateModularForCustomMethod.m

@@ -0,0 +1,120 @@
+//
+//  APPdelegateModularForCustomMethod.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForCustomMethod.h"
+#import "RQAppEventAnnotation.h"
+
+
+RQAppEventMod(APPdelegateModularForCustomMethod)
+
+@implementation APPdelegateModularForCustomMethod
+- (NSInteger)moduleLevel {
+	return 6;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+	///	启动页广告
+	if (!RQ_SHARE_FUNCTION.APP_AD && !myDelegate.adIsShow) {
+		[self initBeginAD];
+		myDelegate.adIsShow = YES;
+	}
+}
+
+#pragma mark - 启动页广告
+- (void)initBeginAD {
+	//初始化开屏广告
+	[self setupXHLaunchAd];
+}
+
+-(void)setupXHLaunchAd{
+	//******图片开屏广告 - 本地数据******
+	[self example];
+}
+
+#pragma mark - 图片开屏广告-本地数据-示例
+//图片开屏广告 - 本地数据
+- (void)example {
+	//设置你工程的启动页使用的是:LaunchImage 还是 LaunchScreen.storyboard(不设置默认:LaunchImage)
+	[XHLaunchAd setLaunchSourceType:SourceTypeLaunchScreen];
+	[XHLaunchAd setWaitDataDuration:0];
+	
+	//配置广告数据
+	XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration new];
+	//广告停留时间
+	imageAdconfiguration.duration = 5;
+	//广告frame
+	imageAdconfiguration.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
+	//广告图片URLString/或本地图片名(.jpg/.gif请带上后缀)
+	NSString *path = @"";
+	if (!defUser.adPaths || defUser.adPaths.count <1) {
+	}else{
+		path = defUser.adPaths[arc4random()%defUser.adPaths.count];
+	}
+	imageAdconfiguration.imageNameOrURLString = [path isEqualToString:@""]? @"firstAD.jpg" : path;
+	imageAdconfiguration.imageOption = XHLaunchAdImageCacheInBackground;
+	//图片填充模式
+	imageAdconfiguration.contentMode = UIViewContentModeScaleToFill;
+	//广告显示完成动画
+	imageAdconfiguration.showFinishAnimate = ShowFinishAnimateFadein;
+	//广告显示完成动画时间
+	imageAdconfiguration.showFinishAnimateTime = 0.8;
+	//跳过按钮类型
+	imageAdconfiguration.skipButtonType = SkipTypeRoundProgressTime;
+	//后台返回时,是否显示广告
+	imageAdconfiguration.showEnterForeground = NO;
+	//显示开屏广告
+	[XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:nil];
+}
+
+/// 应用处于后台,所有下载任务完成调用
+- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler {
+	AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+	appDelegate.backgroundSessionCompletionHandler = completionHandler;
+}
+
+/// 程序意外退出
+- (void)applicationWillTerminate:(UIApplication *)application {
+	//NSLog(@"程序退出");     程序退出要将登录状态置为未登录状态
+}
+
+/// 程序进入后台
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+	/// 实现如下代码,才能使程序处于后台时被杀死,调用applicationWillTerminate:方法
+	[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^(){}];
+}
+
+/// 程序进入前台
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+    /// 检查版本更新
+    if (defUser.qzgx == 1) {
+        [RQ_SHARE_FUNCTION checkVersion];
+    }
+}
+
+
+#pragma mark - 深色模式
+//- (void)initDarkModle API_AVAILABLE(ios(13.0)) {
+//	[RACObserve(RQ_SHARE_FUNCTION, currentUserInterfaceStyle) subscribeNext:^(id  _Nullable x) {
+//		if (@available(iOS 13.0, *)) {
+//			dispatch_async(dispatch_get_main_queue(), ^{
+//				[UIApplication sharedApplication].keyWindow.overrideUserInterfaceStyle = RQ_SHARE_FUNCTION.currentUserInterfaceStyle;
+//			});
+//		} else {
+//			// Fallback on earlier versions
+//		}
+//	}];
+//}
+
+
+@end

+ 17 - 0
jiaPei/APPdelegateModularForData.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForData.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForData : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 55 - 0
jiaPei/APPdelegateModularForData.m

@@ -0,0 +1,55 @@
+//
+//  APPdelegateModularForData.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForData.h"
+#import "RQAppEventAnnotation.h"
+
+RQAppEventMod(APPdelegateModularForData)
+
+@implementation APPdelegateModularForData
+- (NSInteger)moduleLevel {
+	return 1;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+	//同步本地数据
+	[UserInfo shareInfo];
+	
+	if (defUser.userDict) {
+		myDelegate.isLogin = YES;
+//		defUser.car_type = defUser.userDict[@"car_type"];
+	}
+	
+	//默认科目一
+	if (!myDelegate.subject) {
+		myDelegate.subject = @"1";
+	}
+	
+	//异步获取新的广告
+	[jiaPeiManager requestADImage];
+	
+	//判断跳转页面 这样每次更新版本 都会有导航页
+	NSString   *vesionNow = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
+	
+	if (![defUser.isWelcomed isEqualToString:vesionNow]) {
+		[[NSUserDefaults standardUserDefaults] setBool:NO forKey:BOOLFORKEY];
+		defUser.isWelcomed = vesionNow;
+		//如果更新了数据库 运行的时候要加上下面这句代码 提取旧库数据 移除旧的数据库 重新copy到document文件目录下
+		[DB_Que_Helper getDataFormLastDB];
+		myDelegate.isSyn   = YES;
+	} else {
+		
+	}
+}
+@end

+ 17 - 0
jiaPei/APPdelegateModularForPay.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForPay.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForPay : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 143 - 0
jiaPei/APPdelegateModularForPay.m

@@ -0,0 +1,143 @@
+//
+//  APPdelegateModularForPay.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForPay.h"
+#import "RQAppEventAnnotation.h"
+/// 微信SDK头文件
+#import <WXApi.h>
+#import <WXApiObject.h>
+
+/// 微信支付器
+#import "payRequsestHandler.h"
+/// 支付
+#import <AlipaySDK/AlipaySDK.h>
+
+
+RQAppEventMod(APPdelegateModularForPay)
+
+@interface APPdelegateModularForPay () <WXApiDelegate>
+
+@end
+
+@implementation APPdelegateModularForPay
+- (NSInteger)moduleLevel {
+	return 5;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+	/// 初始化微信支付
+	[self initWechatPay];
+}
+
+#pragma mark - 初始化微信支付
+- (void)initWechatPay {
+	/**微信支付
+	 1、导入微信支付SDK,注册微信支付
+	 2、设置微信appid为URL schemes
+	 3、发起支付,调用微信支付
+	 4、处理支付结果
+	 */
+	[WXApi registerApp:@"wx606fa102dbc4b8ab" universalLink:@"https://app.jppt.com.cn/JSJPStudent/"];
+}
+
+#pragma mark       WeChatPay
+- (void)onResp:(BaseResp *)resp {
+    if([resp isKindOfClass:[PayResp class]]){
+        //支付返回结果,实际支付结果需要去微信服务器端查询
+        NSString *strMsg,*strTitle = [NSString stringWithFormat:@"支付结果"];
+
+        switch (resp.errCode) {
+            case WXSuccess:
+                strMsg = @"支付结果:成功!";
+                //NSLog(@"支付成功-PaySuccess,retcode = %d", resp.errCode);
+                break;
+
+            default:
+                strMsg = [NSString stringWithFormat:@"支付结果:失败!retcode = %d, retstr = %@", resp.errCode,resp.errStr];
+                //NSLog(@"错误,retcode = %d, retstr = %@", resp.errCode,resp.errStr);
+                break;
+        }
+		[RQ_SHARE_FUNCTION showAlertWithTitle:strTitle message:strMsg alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"确定" otherButtonTitles:nil otherButtonStyles:nil showInWindow:NO completion:nil];
+    }
+	
+	if ([resp isKindOfClass:[WXLaunchMiniProgramResp class]]) {
+//			  NSString *string = resp.extMsg;
+			  // 对应JsApi navigateBackApplication中的extraData字段数据
+	}
+}
+
+
+
+
+//- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL * _Nonnull)url {
+//    //这里判断是否发起的请求为微信支付,如果是的话,用WXApi的方法调起微信客户端的支付页面(://pay 之前的那串字符串就是你的APPID,)
+//    if ([[NSString stringWithFormat:@"%@",url] rangeOfString:[NSString stringWithFormat:@"%@://pay",APP_ID]].location != NSNotFound) {
+//        return  [WXApi handleOpenURL:url delegate:self];
+//    }
+//
+//    return YES;
+//}
+//
+//#pragma mark       AliPay
+//- (BOOL)application:(UIApplication *)application
+//			openURL:(NSURL *)url
+//  sourceApplication:(NSString *)sourceApplication
+//		 annotation:(id)annotation {
+//	
+//	if ([url.host isEqualToString:@"safepay"]) {
+//		//跳转支付宝钱包进行支付,处理支付结果
+//		[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
+//			//NSLog(@"PaymentResult 支付结果11--><>%@",resultDic);
+//			if ([[resultDic objectForKey:@"resultStatus"] isEqual:@"9000"]) {
+//				//支付成功
+//				[[NSNotificationCenter defaultCenter] postNotificationName:ALI_PAY_RESULT object:ALIPAY_SUCCESSED];
+//			}else{
+//				[[NSNotificationCenter defaultCenter] postNotificationName:ALI_PAY_RESULT object:ALIPAY_FAILED];
+//			}
+//		}];
+//	}
+//	
+//	
+//	//这里判断是否发起的请求为微信支付,如果是的话,用WXApi的方法调起微信客户端的支付页面(://pay 之前的那串字符串就是你的APPID,)
+//	if ([[NSString stringWithFormat:@"%@",url] rangeOfString:[NSString stringWithFormat:@"%@://pay",APP_ID]].location != NSNotFound) {
+//		return  [WXApi handleOpenURL:url delegate:self];
+//	}
+//	return YES;
+//}
+
+// NOTE: 9.0以后使用新API接口
+- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
+{
+	if ([url.host isEqualToString:@"safepay"]) {
+		//跳转支付宝钱包进行支付,处理支付结果
+		[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
+			//NSLog(@"result 支付结果22--><>%@",resultDic);
+			if ([[resultDic objectForKey:@"resultStatus"] isEqual:@"9000"]) {
+				//支付成功
+				[[NSNotificationCenter defaultCenter] postNotificationName:ALI_PAY_RESULT object:ALIPAY_SUCCESSED];
+				
+			}else{
+				[[NSNotificationCenter defaultCenter] postNotificationName:ALI_PAY_RESULT object:ALIPAY_FAILED];
+			}
+		}];
+	}
+	//这里判断是否发起的请求为微信支付,如果是的话,用WXApi的方法调起微信客户端的支付页面(://pay 之前的那串字符串就是你的APPID,)
+	if ([[NSString stringWithFormat:@"%@",url] rangeOfString:[NSString stringWithFormat:@"%@://pay",APP_ID]].location != NSNotFound) {
+		return  [WXApi handleOpenURL:url delegate:self];
+	}
+	
+	return YES;
+}
+
+@end

+ 17 - 0
jiaPei/APPdelegateModularForPush.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForPush.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForPush : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 403 - 0
jiaPei/APPdelegateModularForPush.m

@@ -0,0 +1,403 @@
+//
+//  APPdelegateModularForPush.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForPush.h"
+#import "RQAppEventAnnotation.h"
+
+/// 个推
+#import <GTSDK/GeTuiSdk.h>
+/// iOS10 及以上需导入 UserNotifications.framework
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+#import <UserNotifications/UserNotifications.h>
+#endif
+/// 个推开发者网站中申请App时,注册的AppId、AppKey、AppSecret
+#define kGtAppId           @"gmSLqO5S6z9JfJ7hCDDYm1"
+#define kGtAppKey          @"gKp3U30Zvv8OkKtM9N4cW8"
+#define kGtAppSecret       @"JsWjt7BVSSARoLxF6jG7Q1"
+
+RQAppEventMod(APPdelegateModularForPush)
+
+@interface APPdelegateModularForPush () <GeTuiSdkDelegate, UNUserNotificationCenterDelegate> {
+	NSString *pushType;
+	NSString *pushID;
+}
+@end
+
+@implementation APPdelegateModularForPush
+- (NSInteger)moduleLevel {
+	return 3;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+	// 通过个推平台分配的appId、 appKey 、appSecret 启动SDK,注:该方法需要在主线程中调用
+	dispatch_async(dispatch_get_main_queue(), ^{
+		[GeTuiSdk startSdkWithAppId:kGtAppId appKey:kGtAppKey appSecret:kGtAppSecret delegate:self launchingOptions:nil];
+	});
+	// 注册 通知(本地/远程)
+	[self registerRemoteNotification];
+#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0
+	//这里即使不判断系统版本,后面也做了避免消息重复处理。didReceiveNotificationResponse 统一处理
+	//远程通知
+	if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey])
+	{
+		//关于这个方法远程和进程不一样 一个是userinfo字典。一个是本地通知
+		NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
+		
+		//这里不用判断重复消息
+		NSString *msgId = [userInfo[@"_gmid_"] componentsSeparatedByString:@":"][1];
+		NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+		[userDefaults setObject:msgId forKey:@"remoteNotifymsgId"];
+		[userDefaults synchronize];
+		
+		NSString *jsonStr = userInfo[@"payload"];
+		if ([jsonStr length] != 0) {
+			NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
+			if (data) {
+				NSDictionary * payloadDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
+				pushType = [NSString stringWithFormat:@"%@",payloadDic[@"code"]];
+				pushID = [NSString stringWithFormat:@"%@",payloadDic[@"id"]];
+				
+				//1 驾考头条推送 2 新闻类型  3 话题相关信息 4 系统信息 5 预约相关 教练列表
+				if ([pushType integerValue]>=1 && [pushType integerValue]<=5) {
+					[self gotoPush];
+				}else{
+					//其它信息
+					[self gotoLoad];
+					[self showMsgByArertWithTitle:payloadDic[@"title"] message:payloadDic[@"body"]];
+				}
+				return YES;
+			}
+		}
+		
+		
+	}
+	
+#endif
+}
+
+#pragma mark 推送注册
+/** 注册 APNs */
+- (void)registerRemoteNotification {
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
+	UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
+	center.delegate = self;
+	[center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCarPlay) completionHandler:^(BOOL granted, NSError *_Nullable error) {
+		if (!error) {
+			NSLog(@"request authorization succeeded!(iOS >= 10.0)");
+		}
+	}];
+	
+	[[UIApplication sharedApplication] registerForRemoteNotifications];
+#elif defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
+	UIUserNotificationType types = (UIUserNotificationTypeAlert | UIUserNotificationTypeSound | UIUserNotificationTypeBadge);
+	UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
+	[[UIApplication sharedApplication] registerForRemoteNotifications];
+	[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
+#else
+	UIRemoteNotificationType apn_type = (UIRemoteNotificationType)(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge);
+	[[UIApplication sharedApplication] registerForRemoteNotificationTypes:apn_type];
+#endif
+}
+
+/** 远程通知注册成功委托 */
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+	
+	NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
+	token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
+	NSLog(@"\n>>>[DeviceToken Success]:%@\n\n", token);
+	
+	// 向个推服务器注册deviceToken
+	[GeTuiSdk registerDeviceToken:token];
+}
+
+/** 远程通知注册失败委托 */
+- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
+	
+	//    NSLog(@"FailToRegisterForRemoteNotificationsWithError:%@",error);
+}
+
+//iOS7.0 以后支持 APP 后台刷新数据,会回调 performFetchWithCompletionHandler 接口。为保证个推SDK的数据刷新,需在该回调接口中调用[GeTuiSdk resume]方法帮助个推 SDK 刷新数据。
+- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
+	/// Background Fetch 恢复SDK 运行
+	[GeTuiSdk resume];
+	completionHandler(UIBackgroundFetchResultNewData);
+}
+
+#pragma mark - iOS < 10
+//处理 APNs 通知点击事件,统计有效用户点击数- (App运行在后台/App运行在前台) and apns静默推送消息处理
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
+	
+	NSLog(@"didReceiveRemoteNotification and iOS<10");
+	if ([application isKindOfClass:[NSDictionary class]]) {
+		// 将收到的APNs信息传给个推统计
+		[GeTuiSdk handleRemoteNotification:(NSDictionary *)application];
+		completionHandler(UIBackgroundFetchResultNewData);
+		[self remoteNotificationDealWithDic:(NSDictionary *)application];
+	} else {
+		// 将收到的APNs信息传给个推统计
+		[GeTuiSdk handleRemoteNotification:userInfo];
+		completionHandler(UIBackgroundFetchResultNewData);
+		[self remoteNotificationDealWithDic:userInfo];
+	}
+	
+	
+	
+}
+
+#pragma mark iOS > 10
+//对于iOS 10 及以后版本,为处理 APNs 通知点击,统计有效用户点击数,需先添加 UNUserNotificationCenterDelegate
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+
+//  iOS 10: App在前台获取到通知
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
+	
+	NSLog(@"willPresentNotification and iOS>10前台获取到通知:%@", notification.request.content.userInfo);
+	
+	// 根据APP需要,判断是否要提示用户Badge、Sound、Alert
+	completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
+}
+
+//  iOS 10: 点击通知进入App时触发,在该方法内统计有效用户点击数
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
+	
+	NSLog(@"didReceiveNotification and iOS>10后台获取到通知:%@", response.notification.request.content.userInfo);
+	
+	// [ GTSdk ]:将收到的APNs信息传给个推统计
+	[GeTuiSdk handleRemoteNotification:response.notification.request.content.userInfo];
+	
+	completionHandler();
+	
+	//此处表述程序由远程通知启动打开(不是点击桌面icon)
+	NSDictionary* userInfo = response.notification.request.content.userInfo;
+	[self remoteNotificationDealWithDic:userInfo];
+}
+
+#endif
+
+#pragma mark - 个推相关方法
+
+/** SDK启动成功返回cid 在这里将cid给自己的服务器 */
+- (void)GeTuiSdkDidRegisterClient:(NSString *)clientId {
+	//个推SDK已注册,返回clientId
+	//NSLog(@"\n>>>[GeTuiSdk RegisterClient]:%@\n\n", clientId);
+	//NSLog(@"获取推送token执行");
+	myDelegate.token = clientId;
+	NSString *tokenPass = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:@"apnsToken.plist"];
+	if (![myDelegate.token writeToFile:tokenPass atomically:YES encoding:NSUTF8StringEncoding error:nil]) {
+		NSLog(@"保存失败");
+	}
+	//注册成功,将deviceToken保存到应用服务器数据库中
+	
+	//    [[[[deviceToken description] stringByReplacingOccurrencesOfString:@"<"withString:@""]
+	//      stringByReplacingOccurrencesOfString:@">" withString:@""]
+	//     stringByReplacingOccurrencesOfString:@" " withString:@""]
+}
+
+/** SDK遇到错误回调 */
+- (void)GeTuiSdkDidOccurError:(NSError *)error {
+	//个推错误报告,集成步骤发生的任何错误都在这里通知,如果集成后,无法正常收到消息,查看这里的通知。
+	//    NSLog(@"\n>>>[GexinSdk error]:%@\n\n", [error localizedDescription]);
+}
+
+/** SDK收到透传消息回调 *//*(个推-客户端)*/
+//只要你不是点通知窗口进来的,and发消息的时候有选择离线的情况,都会进这里---by@lee
+- (void)GeTuiSdkDidReceivePayloadData:(NSData *)payloadData andTaskId:(NSString *)taskId andMsgId:(NSString *)msgId andOffLine:(BOOL)offLine fromGtAppId:(NSString *)appId {
+	
+	//收到个推消息
+	if (payloadData) {
+		NSString * payloadMsg = [[NSString alloc] initWithBytes:payloadData.bytes length:payloadData.length encoding:NSUTF8StringEncoding];
+		NSLog(@"GeTuiSdkDidReceivepayloadMsg:%@",payloadMsg);
+		
+		//判断是否被处理过[即发送离线消息的时候,会走apns+个推sdk(有效期内)]
+		//ps:这里处理之后不做存档操作,保证点击通知栏的时候可以”再处理一次“
+		NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+		NSString *oldmsgId = [userDefaults objectForKey:@"remoteNotifymsgId"];
+		if ([oldmsgId isEqualToString:msgId]) {
+			return;
+		}
+		
+		NSDictionary * payloadDic = [NSJSONSerialization JSONObjectWithData:payloadData options:NSJSONReadingMutableContainers error:nil];
+		if (payloadDic.count == 0) {
+			return;
+		}
+		
+		pushType = [NSString stringWithFormat:@"%@",payloadDic[@"code"]];
+		pushID = [NSString stringWithFormat:@"%@",payloadDic[@"id"]];
+		if ([pushType integerValue]>=1 && [pushType integerValue]<=5) {
+			
+			UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:payloadDic[@"title"] message:payloadDic[@"body"] preferredStyle:UIAlertControllerStyleAlert];
+			
+			[alertFind addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+				
+			}]];
+			[alertFind addAction:[UIAlertAction actionWithTitle:@"前往" style:UIAlertActionStyleDefault handler:^(UIAlertAction *  action) {
+				
+				[self gotoPush];
+			}]];
+			[self.window.rootViewController presentViewController:alertFind animated:true completion:nil];
+			
+		}else{
+			//其它信息
+			[self showMsgByArertWithTitle:payloadDic[@"title"] message:payloadDic[@"body"]];
+		}
+		
+	}
+}
+
+#pragma mark 远程通知的数据处理
+-(void)remoteNotificationDealWithDic:(NSDictionary *)userInfo{
+	
+	/*
+	 {
+	 "_ge_" = 1;
+	 "_gmid_" = "OSL-0818_bJ6zVRy8cC6JsflZOYPXO9:965f14a1051748c4a48f9db2437362e5:d48422d462d2bcf0b9d962f150b235b9";
+	 "_gurl_" = "sdk.open.extension.getui.com:8123";
+	 aps =     {
+	 alert =         {
+	 body = "\U60a8\U9a7e\U6821\U6709\U8f66\U8f86\U7ec8\U7aef\U62a5\U8b66\U9700\U89e3\U9664\Uff0c\U8bf7\U67e5\U770b\U5e76\U5904\U7406";
+	 title = "\U544a\U8b66\U6d88\U606f";
+	 };
+	 badge = 2;
+	 category = "button\U663e\U793a";
+	 "content-available" = 1;
+	 "mutable-content" = 1;
+	 sound = default;
+	 };
+	 payload = "{\"title\":\"\U544a\U8b66\U6d88\U606f\",\"code\":\"1\",\"body\":\"\U60a8\U9a7e\U6821\U6709\U8f66\U8f86\U7ec8\U7aef\U62a5\U8b66\U9700\U89e3\U9664\Uff0c\U8bf7\U67e5\U770b\U5e76\U5904\U7406\,\"id\":\"2\"}";
+	 }
+	 */
+	
+	
+	// _gmid_对应-- taskId msgId clientID
+	//这里使用msgid判断是否被处理【不过似乎应该用taskid?@lee,幻想着一个任务多条消息]
+	NSString *msgId = [userInfo[@"_gmid_"] componentsSeparatedByString:@":"][1];
+	NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+	NSString *oldMsgId = [userDefaults objectForKey:@"remoteNotifymsgId"];
+	
+	if ([msgId isEqualToString:oldMsgId]) {
+		return;
+	}
+	
+	//开始处理
+	[userDefaults setObject:msgId forKey:@"remoteNotifymsgId"];
+	[userDefaults synchronize];
+	
+	NSString *jsonStr = userInfo[@"payload"];
+	if ([jsonStr length] == 0) {
+		return;
+	}
+	
+	NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
+	NSDictionary * payloadDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
+	if (payloadDic) {
+		pushType = [NSString stringWithFormat:@"%@",payloadDic[@"code"]];
+		pushID = [NSString stringWithFormat:@"%@",payloadDic[@"id"]];
+		
+		//1 驾考头条推送 2 新闻类型  3 话题相关信息 4 系统信息 5 预约相关 教练列表
+		if ([pushType integerValue]>=1 && [pushType integerValue]<=6) {
+			[self gotoPush];
+		}else{
+			//其它信息
+			[self showMsgByArertWithTitle:payloadDic[@"title"] message:payloadDic[@"body"]];
+		}
+	}else {
+    }
+	
+}
+
+-(void)showMsgByArertWithTitle:(NSString *)title message:(NSString *)message{
+	
+	if (message.length == 0) {
+		return;
+	}
+	
+	//其它信息
+	UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
+	
+	[alertFind addAction:[UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+		
+	}]];
+	[self.window.rootViewController presentViewController:alertFind animated:true completion:nil];
+}
+
+
+#pragma mark 推送相关跳转
+- (void)gotoPush {
+	//1 驾考头条推送 2 新闻类型  3 话题相关信息 4 系统信息 5 预约相关 教练列表
+	//新闻和驾考头条是一样的
+	switch ([pushType integerValue]) {
+		case 1:
+			[self goToJKTT];
+			break;
+		case 2:
+			[self goToJKTT];
+			break;
+		case 3:
+			[self goToTopic];
+			break;
+		case 4:
+			[self goToSystemNews];
+			break;
+		case 5:
+			[self goToAppoint];
+			break;
+		case 6:
+			[self gotoMyMessage];
+			break;
+		default:
+			[self goToNews];
+			break;
+	}
+}
+
+- (void)goToJKTT {
+
+}
+
+- (void)goToSystemNews {
+	
+}
+
+- (void)goToNews {
+	
+}
+
+- (void)goToTopic {
+	
+}
+
+- (void)goToAppoint {
+}
+
+- (void)gotoMyMessage {
+	
+}
+
+
+#pragma mark -  监测程序状态
+//程序复原
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+	//删除程序小红点
+	[GeTuiSdk resetBadge]; //重置角标计数
+	[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; // APP 清空角标
+	
+	if (myDelegate.timer) {
+		[myDelegate.timer setFireDate:[NSDate distantPast]];
+	}
+	
+	myDelegate.isBackgroundTask = NO;
+}
+
+@end
+

+ 17 - 0
jiaPei/APPdelegateModularForQuestionData.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForQuestionData.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2022/7/13.
+//  Copyright © 2022 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForQuestionData : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 27 - 0
jiaPei/APPdelegateModularForQuestionData.m

@@ -0,0 +1,27 @@
+//
+//  APPdelegateModularForQuestionData.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2022/7/13.
+//  Copyright © 2022 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForQuestionData.h"
+#import "RQAppEventAnnotation.h"
+
+RQAppEventMod(APPdelegateModularForQuestionData)
+@implementation APPdelegateModularForQuestionData
+- (NSInteger)moduleLevel {
+    return 4;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    [self initMudule];
+//    [self destroyModule];
+    return YES;
+}
+
+- (void)initMudule {
+    [RQ_BD_Question_Module queryQuestionWithQueryStr:@"SELECT * FROM t_question"];
+}
+@end

+ 18 - 0
jiaPei/APPdelegateModularForRequest.h

@@ -0,0 +1,18 @@
+//
+//  APPdelegateModularForRequest.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2021/4/12.
+//  Copyright © 2021 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+@interface APPdelegateModularForRequest : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 180 - 0
jiaPei/APPdelegateModularForRequest.m

@@ -0,0 +1,180 @@
+//
+//  APPdelegateModularForRequest.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2021/4/12.
+//  Copyright © 2021 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForRequest.h"
+#import "RQAppEventAnnotation.h"
+
+RQAppEventMod(APPdelegateModularForRequest)
+
+@implementation APPdelegateModularForRequest
+- (NSInteger)moduleLevel {
+	return 1;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+	/// 获取广告相关
+	[self getAppParam];
+    /// 视频接口相关
+    [self getVideoTypeList];
+    /// 同步本地数据
+    [UserInfo shareInfo];
+    
+    [self getConfigKey];
+    
+    if (RQ_USER_MANAGER.currentUser) {
+        myDelegate.isLogin = YES;
+    }
+    
+    //默认科目一
+    if (!myDelegate.subject) {
+        myDelegate.subject = @"1";
+        RQ_YDTQuestion_Module.subject = RQHomePageSubjectType_SubjectOne;
+    }
+    
+    //异步获取新的广告
+    [jiaPeiManager requestADImage];
+    
+    //判断跳转页面 这样每次更新版本 都会有导航页
+    NSString   *vesionNow = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
+    
+//    if (![RQ_COMMON_MANAGER.isWelcomed isEqualToString:vesionNow]) {
+//        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:BOOLFORKEY];
+//        RQ_COMMON_MANAGER.isWelcomed = vesionNow;
+//        //如果更新了数据库 运行的时候要加上下面这句代码 提取旧库数据 移除旧的数据库 重新copy到document文件目录下
+//        [DB_Que_Helper getDataFormLastDB];
+//        myDelegate.isSyn   = YES;
+//    } else {
+//        
+//    }
+}
+
+- (void)getAppParam {
+	NSMutableArray *arr = [NSMutableArray array];
+	[arr addPro:@"dqbh"     Value:[NSString stringWithFormat:@"%@",RQ_USER_MANAGER.currentUser.city? : ([RQ_USER_MANAGER.currentUser.city isEqualToString:@"(null)"]? @"" : @"")]];
+
+	NSString *method= @"getAppParam";
+	
+	[jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
+		if ([dict[@"code"] isEqualToString:@"0"]) {
+			if ([dict [@"body"] isKindOfClass:[NSArray class]]) {
+				NSArray *array = dict [@"body"];
+				[array.rac_sequence.signal subscribeNext:^(NSDictionary *dic) {
+					[RQ_SHARE_FUNCTION saveObjectWithObject:dic[@"VALUE"] ForKey:dic[@"KEY"]];
+				}];
+			}
+		}
+	}];
+}
+
+- (void)getVideoTypeList {
+    [[RQ_HTTP_Service getTreeList] subscribeNext:^(NSArray <RQTreeListModel *> * dataArr) {
+        if (!RQObjectIsNil(dataArr)) {
+            RQ_COMMON_MANAGER.treeListArr = dataArr;
+        }
+    }];
+    
+    [[RQ_HTTP_Service getDspListWithPageNum:1 pageSize:10] subscribeNext:^(NSArray <VideosItem *> * videosItemArr) {
+        if (!RQObjectIsNil(videosItemArr)) {
+            RQ_COMMON_MANAGER.dspListArr = videosItemArr;
+        }
+    }];
+    
+    
+}
+
+- (void)getAppStoreVersionWithComplete:(VoidBlock_integer)complete {
+    NSString *URL = @"http://itunes.apple.com/cn/lookup?id=1214200225";
+    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:URL] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10];
+    [request setHTTPMethod:@"POST"];
+    NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
+        dispatch_async_on_main_queue(^{
+            //这个导致部分手机网络不好时候出现闪退情况
+            if (!data) {
+                complete(0);
+                return;
+            }
+            //如果data等于nil的时候 再去解析 会发生崩溃
+            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
+            
+            if (!dic) {
+                complete(0);
+                return;
+            }
+            NSArray *infoArray = [dic objectForKey:@"results"];
+            if ([infoArray count]) {
+                NSDictionary *releaseInfo = [infoArray objectAtIndex:0];
+                NSString *netVersion = [releaseInfo objectForKey:@"version"];
+                // 线上版本号
+                NSInteger netInt = [[netVersion stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue];
+                complete(netInt);
+            } else {
+                complete(0);
+            }
+        });
+    }];
+    
+    [task resume];
+}
+
+- (void)getConfigKey {
+    NSInteger localVersion = [[RQ_APP_VERSION stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue];
+    [[RQ_HTTP_Service getJsjpSet] subscribeNext:^(NSArray *setArr) {
+        [setArr.rac_sequence.signal subscribeNext:^(RQDictInfoModel *dictInfoModel) {
+            if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_AD_OPEN"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_AD_OPEN = [[NSString stringWithFormat:@"%@",dictInfoModel.dictValue] isEqualToString:@"1"]? YES : NO;
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_AD_CYCLE"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_AD_CYCLE = [dictInfoModel.dictValue integerValue];
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_Is_Online_Media_Image"]) {
+                RQ_COMMON_MANAGER.JSJP_Is_Online_Media_Image = [dictInfoModel.dictValue boolValue];
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_Is_Online_Media_Video"]) {
+                RQ_COMMON_MANAGER.JSJP_Is_Online_Media_Video = [dictInfoModel.dictValue boolValue];
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_Online_Version"]) {
+                NSInteger customOnlineVersion = [[[NSString stringWithFormat:@"%@",dictInfoModel.dictValue] stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue];
+                RQ_COMMON_MANAGER.APP_SWITCH = (localVersion >= customOnlineVersion);
+                RQ_COMMON_MANAGER.APP_SWITCH = NO;
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_ICON_NEED_CHANGE"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_ICON_NEED_CHANGE = [dictInfoModel.dictValue boolValue];
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_AD_RATE"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_AD_RATE = [dictInfoModel.dictValue integerValue];
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_PTSC_FBL"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_PTSC_FBL = dictInfoModel.dictValue;
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_DOMIAN_NAME_IS_OLD"]) {
+                RQ_COMMON_MANAGER.JSJP_DOMIAN_NAME_IS_OLD = [dictInfoModel.dictValue boolValue];
+            } else if ([dictInfoModel.dictLabel isEqualToString:@"JSJP_APP_KAOCHANG_OPEN_ARR"]) {
+                RQ_COMMON_MANAGER.JSJP_APP_KAOCHANG_OPEN_ARR = [dictInfoModel.remark componentsSeparatedByString:@","];
+            }
+        }];
+    }];
+    [[RQ_HTTP_Service getChapterList] subscribeNext:^(id  _Nullable x) {
+        
+    }];
+    
+    //    [[RQ_HTTP_Service getConfigKeyWithDictType:@"Online_Version"] subscribeNext:^(id  _Nullable x) {
+    //        NSInteger customOnlineVersion = [[[NSString stringWithFormat:@"%@",x] stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue];
+    //        /// 本地版本大于等于内部版本(审核的时候本地版本一定等于内部版本,上线后本地版本一定小余内部版本)
+    //        RQ_COMMON_MANAGER.APP_SWITCH = localVersion >= customOnlineVersion;
+    //    } error:^(NSError * _Nullable error) {
+    //        [self getAppStoreVersionWithComplete:^(NSInteger onlineVersion) {
+    //            if (onlineVersion != 0) {
+    //                /// 本地版本大于线上版本(审核的时候本地版本一定大于线上版本,上线后本地版本一定等于线上版本(有延迟...所以作为备选方案))
+    //                RQ_COMMON_MANAGER.APP_SWITCH = localVersion > onlineVersion;
+    //            } else {
+    //                RQ_COMMON_MANAGER.APP_SWITCH = NO;
+    //            }
+    //        }];
+    //    }];
+    
+}
+
+@end

+ 16 - 0
jiaPei/APPdelegateModularForSystemSetting.h

@@ -0,0 +1,16 @@
+//
+//  APPdelegateModularForSystemSetting.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForSystemSetting : RQBaseAppEventModule
+@end
+
+NS_ASSUME_NONNULL_END

+ 169 - 0
jiaPei/APPdelegateModularForSystemSetting.m

@@ -0,0 +1,169 @@
+//
+//  APPdelegateModularForSystemSetting.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForSystemSetting.h"
+#import "RQAppEventAnnotation.h"
+#import <CoreTelephony/CTCellularData.h>
+#if defined(__IPHONE_14_0)
+#import <AppTrackingTransparency/AppTrackingTransparency.h>//适配iOS14
+#endif
+RQAppEventMod(APPdelegateModularForSystemSetting)
+
+
+
+@interface APPdelegateModularForSystemSetting ()
+@property (nonatomic, readwrite, assign) BOOL isShowNetWorkAuth;
+@property (nonatomic, readwrite, assign) UIBackgroundTaskIdentifier backgroundTaskInvalid;
+@end
+
+@implementation APPdelegateModularForSystemSetting
+- (NSInteger)moduleLevel {
+	return 0;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+
+	return YES;
+}
+
+- (void)initMudule {
+	NSString *version = [UIDevice currentDevice].systemVersion;
+	if ([version isEqualToString:@"12.1.0"]) {
+		// 针对 12.1 的iOS系统进行处理
+		[[UITabBar appearance] setTranslucent:NO];
+	}
+    if (@available(iOS 15.0, *)) {
+        [UITableView appearance].sectionHeaderTopPadding = 0;
+    }
+}
+
+/// 程序挂起
+- (void)applicationWillResignActive:(UIApplication *)application {
+	
+	[EAGLContext setCurrentContext:nil];
+}
+
+/// 程序进入后台
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+	if (!myDelegate.scPeriodVC) {
+		if (myDelegate.timer) {
+			[myDelegate.timer setFireDate:[NSDate distantFuture]];
+		}
+	}else {
+		if (!myDelegate.scPeriodVC.haveBlueTooth && myDelegate.timer) {
+			[myDelegate.timer setFireDate:[NSDate distantFuture]];
+		}
+	}
+	
+	myDelegate.isBackgroundTask = YES;
+	
+	[EAGLContext setCurrentContext:nil];
+	
+	// 实现如下代码,才能使程序处于后台时被杀死,调用applicationWillTerminate:方法
+	[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^(){}];
+}
+
+/// 应用处于后台,所有下载任务完成调用
+- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler {
+    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    appDelegate.backgroundSessionCompletionHandler = completionHandler;
+}
+
+/// 程序意外退出
+- (void)applicationWillTerminate:(UIApplication *)application {
+    //NSLog(@"程序退出");     程序退出要将登录状态置为未登录状态
+}
+
+
+
+#pragma mark - Network auth status
+- (void)networkAuthStatus {
+	CTCellularData *cellularData = [[CTCellularData alloc]init];
+	cellularData.cellularDataRestrictionDidUpdateNotifier = ^(CTCellularDataRestrictedState state) {
+		if (state == kCTCellularDataRestricted) {
+			//拒绝
+			[self networkSettingAlert];
+		} else if (state == kCTCellularDataNotRestricted) {
+			//允许
+		} else {
+			//未知
+			[self unknownNetwork];
+		}
+	};
+}
+
+- (void)networkSettingAlert {
+	dispatch_async(dispatch_get_main_queue(), ^{
+		NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
+		
+		NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
+
+		UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:[NSString stringWithFormat:@"您尚未授权“%@”访问网络的权限,请前往设置开启网络授权", app_Name] preferredStyle:UIAlertControllerStyleAlert];
+		
+		[alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
+			_isShowNetWorkAuth = NO;
+		}]];
+		
+		[alertController addAction:[UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+			_isShowNetWorkAuth = NO;
+			[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
+		}]];
+		
+		if (!_isShowNetWorkAuth) {
+			_isShowNetWorkAuth = YES;
+			[RQ_SHARE_FUNCTION.topViewController presentViewController:alertController animated:YES completion:nil];
+		}
+	});
+}
+
+- (void)unknownNetwork {
+	dispatch_async(dispatch_get_main_queue(), ^{
+		UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"未知网络" preferredStyle:UIAlertControllerStyleAlert];
+		
+		[alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+		}]];
+		
+		[RQ_SHARE_FUNCTION.topViewController presentViewController:alertController animated:YES completion:nil];
+	});
+}
+
+
+// app启动或者app从后台进入前台都会调用这个方法
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+    if (@available(iOS 14, *)) {
+        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
+        }];
+    }
+    
+    /// 检查版本更新
+    if (RQ_USER_MANAGER.currentUser) {
+        if (RQ_USER_MANAGER.qzgx == 1) {
+            [RQ_SHARE_FUNCTION checkVersion];
+        }
+    } else {
+        [RQ_SHARE_FUNCTION checkVersion];
+    }
+    
+    
+    
+}
+
+// app从后台进入前台都会调用这个方法
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+    
+}
+
+- (void)dealloc {
+    
+}
+
+
+
+@end

+ 17 - 0
jiaPei/APPdelegateModularForTest.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForTest.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/11/23.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForTest : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 69 - 0
jiaPei/APPdelegateModularForTest.m

@@ -0,0 +1,69 @@
+//
+//  APPdelegateModularForTest.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/11/23.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForTest.h"
+#import "RQAppEventAnnotation.h"
+
+RQAppEventMod(APPdelegateModularForTest)
+
+@implementation APPdelegateModularForTest
+- (NSInteger)moduleLevel {
+	return 5;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+#if DEBUG
+    [self test];
+    [self test2];
+#endif
+}
+
+
+- (void)test {
+	///		 36252719790810003X 110753
+	///		* 获取转校状态
+	///		* URL=http://192.168.1.6:8082/student/getStudentChangeSchool?ts={timestamp}&sign={sign_str}&user={cert_sn}
+	///		* HTTP方法:POST
+	///		* 报文格式:{'stuOutId':'3502004042','dqbh':'3502'}
+	///		* SCS_IN_SCHOOL_AUDIT   0-学员待确认(待接收)  1-驾校同意  2-驾校不接收  3-学员同意  4-学员拒绝
+	///		* SCS_AUDIT_VIEW 管理部门审核情况:0-待审核 1-通过 2-退回
+	
+	NSMutableArray *arr = [NSMutableArray array];
+	[arr addObject:[NSDictionary dictionaryWithObjectsAndKeys:RQ_USER_MANAGER.currentUser.outId,@"stuOutId", nil]];
+	[arr addObject:[NSDictionary dictionaryWithObjectsAndKeys:RQ_USER_MANAGER.currentUser.city,@"dqbh", nil]];
+	
+	NSString *method= @"getStudentChangeSchool";
+	
+	[jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
+		RemoveHUD();
+		if ([dict[@"code"] isEqualToString:@"0"]) {
+			/// 3同意 4拒绝
+//			[self testWithAudit:@"3"];
+		}
+	}];
+	
+	
+}
+
+
+
+- (void)test2 {
+    [LOCATION_MANAGER updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nullable location, BMKLocation * _Nullable bmkLocation) {
+        
+    }];
+}
+
+
+
+@end

+ 17 - 0
jiaPei/APPdelegateModularForVendor.h

@@ -0,0 +1,17 @@
+//
+//  APPdelegateModularForVendor.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "RQBaseAppEventModule.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface APPdelegateModularForVendor : RQBaseAppEventModule
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 297 - 0
jiaPei/APPdelegateModularForVendor.m

@@ -0,0 +1,297 @@
+//
+//  APPdelegateModularForVendor.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/3/26.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "APPdelegateModularForVendor.h"
+#import "RQAppEventAnnotation.h"
+/// bugly腾讯bug统计
+#import <Bugly/Bugly.h>
+/// 百度地图
+#import <BaiduMapAPI_Base/BMKMapManager.h>
+#import <BMKLocationkit/BMKLocationComponent.h>
+/// SMS短信验证
+//#import <SMS_SDK/SMSSDK.h>
+/// 分享
+//#import <ShareSDK/ShareSDK.h>
+//#import <ShareSDKConnector/ShareSDKConnector.h>
+/// 腾讯开放平台(对应QQ和QQ空间)SDK头文件
+//#import <TencentOpenAPI/TencentOAuth.h>
+//#import <TencentOpenAPI/QQApiInterface.h>
+/// 微信SDK头文件
+#import "WXApi.h"
+
+#import "DOUAudioStreamer+Options.h"
+
+/// 百度人脸识别
+#import <IDLFaceSDK/IDLFaceSDK.h>
+#import "FaceParameterConfig.h"
+#import "BDFaceAdjustParamsTool.h"
+#import "BDFaceLivingConfigModel.h"
+
+
+/// bugly
+#define BUGLY_APP_ID       @"a2bb8e84bc"
+
+
+RQAppEventMod(APPdelegateModularForVendor)
+
+@interface APPdelegateModularForVendor () <BMKGeneralDelegate, BMKLocationAuthDelegate,WXApiDelegate>
+@end
+
+@implementation APPdelegateModularForVendor
+- (NSInteger)moduleLevel {
+	return 2;
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+	[self initMudule];
+//	[self destroyModule];
+	return YES;
+}
+
+- (void)initMudule {
+	/// 初始化Bugly
+	[self initBugly];
+	/// 初始化百度地图
+	[self initBaiduMap];
+	/// 初始化ShareSDK
+//	[self initShareSDK];
+	/// 初始化百度人脸识别SDK
+	[self initDBFaceSDK];
+    /// 初始化YYCache
+    [self initYYCache];
+    /// 初始化SDImageWebPCoder
+    [self initSDImageWebPCoder];
+    ///  配置流音乐播放
+//    [self initDOUAudioStreamer];
+    /// 启动页
+//    if (!RQ_COMMON_MANAGER.JSJP_APP_AD_OPEN && !myDelegate.adIsShow) {
+//        [self initBeginAD];
+//        myDelegate.adIsShow = YES;
+//    }
+}
+
+
+
+#pragma mark - 初始化Bugly
+- (void)initBugly {
+	//异常统计
+#ifdef DEBUG
+	//do sth1.
+    [Bugly startWithAppId:BUGLY_APP_ID];
+#else
+	[Bugly startWithAppId:BUGLY_APP_ID];
+#endif
+}
+
+
+#pragma mark - 初始化百度地图
+- (void)initBaiduMap {
+	[LOCATION_MANAGER updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) {
+		
+	}];
+//    dispatch_async_on_main_queue(^{
+//        //初始化地图
+//        BMKMapManager *mapManager = [[BMKMapManager alloc]init];
+//        // 如果要关注网络及授权验证事件,请设定     generalDelegate参数
+//        BOOL ret = [mapManager start:BaiDuMapAK  generalDelegate:self];
+//        if (!ret) {
+//            //NSLog(@"%d",ret);
+//            NSLog(@"manager start failed!");
+//        }
+//        //百度地图定位
+//        [[BMKLocationAuth sharedInstance] checkPermisionWithKey:BaiDuMapAK authDelegate:self];
+//        // ‼️重要:设置用户是否同意SDK隐私协议,请务必在BMKLocationManager和BMKGeoFenceManager实例化之前调用,否则实例化失败
+//        [[BMKLocationAuth sharedInstance] setAgreePrivacy:YES];
+//    });
+}
+
+
+#pragma mark - 百度地图的代理
+- (void)onGetNetworkState:(int)iError {
+	if (0 == iError) {
+		NSLog(@"联网成功");
+	}
+	else {
+		NSLog(@"联网失败");
+	}
+	
+}
+
+- (void)onGetPermissionState:(int)iError {
+	if (0 == iError) {
+		NSLog(@"授权成功");
+	}
+	else {
+		NSLog(@"授权失败");
+	}
+}
+
+
+#pragma mark - 初始化ShareSDK
+- (void)initShareSDK {
+	//注册分享
+//	[ShareSDK registPlatforms:^(SSDKRegister *platformsRegister) {
+//		//QQ
+////		[platformsRegister setupQQWithAppId:@"1105901490" appkey:@"DAqzov5RGSBXFWAT" enableUniversalLink:false universalLink:nil];
+//
+//		//更新到4.3.3或者以上版本,微信初始化需要使用以下初始化
+//		[platformsRegister setupWeChatWithAppId:RQ_WECHAT_MANAGER.appID appSecret:RQ_WECHAT_MANAGER.appSecret universalLink:RQ_WECHAT_MANAGER.universalLink];
+//
+//	}];
+}
+
+#pragma mark - initDBFaceSDK
+- (void)initDBFaceSDK {
+	[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:@"SoundMode"];
+	[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:@"LiveMode"];
+	[[NSUserDefaults standardUserDefaults] setObject:@(NO) forKey:@"ByOrder"];
+	[[NSUserDefaults standardUserDefaults] setObject:@(NO) forKey:@"checkAgreeBtn"];
+	
+	NSString* licensePath = [NSString stringWithFormat:@"%@.%@", FACE_LICENSE_NAME, FACE_LICENSE_SUFFIX ];
+	[[FaceSDKManager sharedInstance] setLicenseID:FACE_LICENSE_ID andLocalLicenceFile:licensePath andRemoteAuthorize:false];
+	NSLog(@"canWork = %d",[[FaceSDKManager sharedInstance] canWork]);
+	NSLog(@"version = %@",[[FaceSDKManager sharedInstance] getVersion]);
+	[self initSDK];
+	[self initLivenesswithList];
+}
+
+- (void)initSDK {
+	
+	if (![[FaceSDKManager sharedInstance] canWork]){
+		NSLog(@"授权失败,请检测ID 和 授权文件是否可用");
+		return;
+	}
+	
+	// 初始化SDK配置参数,可使用默认配置
+	// 设置最小检测人脸阈值
+	[[FaceSDKManager sharedInstance] setMinFaceSize:200];
+	// 设置截取人脸图片高
+	[[FaceSDKManager sharedInstance] setCropFaceSizeWidth:480];
+	// 设置截取人脸图片宽
+	[[FaceSDKManager sharedInstance] setCropFaceSizeHeight:640];
+	// 设置人脸遮挡阀值
+	[[FaceSDKManager sharedInstance] setOccluThreshold:0.5];
+	// 设置亮度阀值
+	[[FaceSDKManager sharedInstance] setMinIllumThreshold:40];
+	[[FaceSDKManager sharedInstance] setMaxIllumThreshold:240];
+	// 设置图像模糊阀值
+	[[FaceSDKManager sharedInstance] setBlurThreshold:0.3];
+	// 设置头部姿态角度
+	[[FaceSDKManager sharedInstance] setEulurAngleThrPitch:10 yaw:10 roll:10];
+	// 设置人脸检测精度阀值
+	[[FaceSDKManager sharedInstance] setNotFaceThreshold:0.6];
+	// 设置抠图的缩放倍数
+	[[FaceSDKManager sharedInstance] setCropEnlargeRatio:2.5];
+	// 设置照片采集张数
+	[[FaceSDKManager sharedInstance] setMaxCropImageNum:3];
+	// 设置超时时间
+	[[FaceSDKManager sharedInstance] setConditionTimeout:15];
+	// 设置开启口罩检测,非动作活体检测可以采集戴口罩图片
+	[[FaceSDKManager sharedInstance] setIsCheckMouthMask:true];
+	// 设置开启口罩检测情况下,非动作活体检测口罩过滤阈值,默认0.8 不需要修改
+	[[FaceSDKManager sharedInstance] setMouthMaskThreshold:0.8f];
+	// 设置原始图缩放比例
+	[[FaceSDKManager sharedInstance] setImageWithScale:0.8f];
+	// 设置图片加密类型,type=0 基于base64 加密;type=1 基于百度安全算法加密
+	[[FaceSDKManager sharedInstance] setImageEncrypteType:0];
+	// 初始化SDK功能函数
+	[[FaceSDKManager sharedInstance] initCollect];
+	// 设置人脸过远框比例
+	[[FaceSDKManager sharedInstance] setMinRect:0.4];
+	
+    /// 设置用户设置的配置参数
+	[BDFaceAdjustParamsTool setDefaultConfig];
+}
+
+- (void)initLivenesswithList {
+	// 默认活体检测打开,顺序执行
+	/*
+	 添加当前默认的动作,是否需要按照顺序,动作活体的数量(设置页面会根据这个numOfLiveness来判断选择了几个动作)
+	 */
+	[BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveEye)];
+	[BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveMouth)];
+	[BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveYawRight)];
+    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveYawLeft)];
+    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLivePitchUp)];
+    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLivePitchDown)];
+//    [BDFaceLivingConfigModel.sharedInstance.liveActionArray addObject:@(FaceLivenessActionTypeLiveYaw)];
+	BDFaceLivingConfigModel.sharedInstance.isByOrder = NO;
+	BDFaceLivingConfigModel.sharedInstance.numOfLiveness = 3;
+}
+
+- (void) destorySDK {
+	// 销毁SDK功能函数
+	[[FaceSDKManager sharedInstance] uninitCollect];
+}
+
+#pragma mark - 初始化YYCache
+- (void)initYYCache {
+    YYCache *cache = [[YYCache alloc] initWithName:@"getTeachingVideoByTypeId"];
+    [cache removeAllObjects];
+}
+
+#pragma mark - 初始化SDImageWebPCoder
+- (void)initSDImageWebPCoder {
+    SDImageWebPCoder *webPCoder = [SDImageWebPCoder sharedCoder];
+    [[SDImageCodersManager sharedManager] addCoder:webPCoder];
+}
+
+#pragma mark - 初始化配置流音乐播放
+- (void)initDOUAudioStreamer {
+    [DOUAudioStreamer setOptions:[DOUAudioStreamer options] | DOUAudioStreamerRequireSHA256];
+}
+
+
+#pragma mark - 启动页广告
+- (void)initBeginAD {
+    //初始化开屏广告
+    [self setupXHLaunchAd];
+}
+
+- (void)setupXHLaunchAd{
+    [self example];
+}
+
+/// 图片开屏广告-本地数据-示例
+/// 图片开屏广告 - 本地数据
+- (void)example {
+    //设置你工程的启动页使用的是:LaunchImage 还是 LaunchScreen.storyboard(不设置默认:LaunchImage)
+    [XHLaunchAd setLaunchSourceType:SourceTypeLaunchScreen];
+    [XHLaunchAd setWaitDataDuration:0];
+    
+    //配置广告数据
+    XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration new];
+    //广告停留时间
+    imageAdconfiguration.duration = 5;
+    //广告frame
+    imageAdconfiguration.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
+    //广告图片URLString/或本地图片名(.jpg/.gif请带上后缀)
+    NSString *path = @"";
+    if (!RQ_COMMON_MANAGER.adPaths || RQ_COMMON_MANAGER.adPaths.count <1) {
+    }else{
+        path = RQ_COMMON_MANAGER.adPaths[arc4random()%RQ_COMMON_MANAGER.adPaths.count];
+    }
+    imageAdconfiguration.imageNameOrURLString = [path isEqualToString:@""]? @"firstAD.jpg" : path;
+    imageAdconfiguration.imageOption = XHLaunchAdImageCacheInBackground;
+    //图片填充模式
+    imageAdconfiguration.contentMode = UIViewContentModeScaleToFill;
+    //广告显示完成动画
+    imageAdconfiguration.showFinishAnimate = ShowFinishAnimateFadein;
+    //广告显示完成动画时间
+    imageAdconfiguration.showFinishAnimateTime = 0.8;
+    //跳过按钮类型
+    imageAdconfiguration.skipButtonType = SkipTypeRoundProgressTime;
+    //后台返回时,是否显示广告
+    imageAdconfiguration.showEnterForeground = NO;
+    //显示开屏广告
+    [XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:nil];
+}
+
+
+
+@end

+ 32 - 0
jiaPei/AdvertisingColumn.h

@@ -0,0 +1,32 @@
+//
+//  AdvertisingColumn.h
+//  CustomTabBar
+///Users/apple/Desktop/jiaPei/jiaPei/AdvertisingColumn.h
+//  Created by shikee_app05 on 14-12-30.
+//  Copyright (c) 2014年 chan kaching. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AdvertisingColumn : UIView<UIScrollViewDelegate>{
+    
+    NSTimer *_timer;
+}
+
+//广告栏
+@property (nonatomic,strong) UIScrollView *scrollView;
+@property (nonatomic,strong) UIPageControl *pageControl;
+@property (nonatomic,strong) UILabel *imageNum;
+@property (nonatomic,retain) NSArray *imgArray;
+@property (nonatomic,retain) UIViewController *supVC;
+@property (nonatomic) NSInteger totalNum;
+
+
+
+- (void)setImgArray:(NSArray *)imgArray;
+- (void)openTimer;
+- (void)closeTimer;
+
+
+@end
+

+ 224 - 0
jiaPei/AdvertisingColumn.m

@@ -0,0 +1,224 @@
+//
+//  AdvertisingColumn.m
+//  CustomTabBar
+//
+//  Created by shikee_app05 on 14-12-30.
+//  Copyright (c) 2014年 chan kaching. All rights reserved.
+//
+
+#import "AdvertisingColumn.h"
+#import "RQCustomWebViewViewController.h"
+#import "WXApiRequestHandler.h"
+#import "WXApiManager.h"
+#import "WechatAuthSDK.h"
+
+@interface AdvertisingColumn  () <WXApiManagerDelegate, WechatAuthAPIDelegate>
+@end
+
+@implementation AdvertisingColumn
+
+- (id)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        _scrollView = [[UIScrollView alloc]initWithFrame:frame];
+        _scrollView.delegate = self;//设置代理UIscrollViewDelegate
+        _scrollView.showsVerticalScrollIndicator = NO;//是否显示竖向滚动条
+        _scrollView.showsHorizontalScrollIndicator = NO;//是否显示横向滚动条
+        _scrollView.pagingEnabled = YES;//是否设置分页
+        _scrollView.bounces = NO;
+        
+        [self addSubview:_scrollView];
+
+        /*
+         ***容器,装载
+         */
+        UIView *containerView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetHeight(self.frame)-20, CGRectGetWidth(self.frame), 20)];
+        containerView.backgroundColor = [UIColor clearColor];
+        [self addSubview:containerView];
+        UIView *alphaView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(containerView.frame), CGRectGetHeight(containerView.frame))];
+        alphaView.alpha = 0.7;
+        [containerView addSubview:alphaView];
+        
+        //分页控制
+        _pageControl = [[UIPageControl alloc]initWithFrame:CGRectMake(kSize.width*0.5 - 15, 0, kSize.width, 20)];
+        _pageControl.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
+        _pageControl.currentPage = 0; //初始页码为0
+        [containerView addSubview:_pageControl];
+        
+        //图片张数
+        _imageNum = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, CGRectGetWidth(containerView.frame)-20, 20)];
+        _imageNum.font = [UIFont scaleSize:15];
+        _imageNum.backgroundColor = [UIColor clearColor];
+        _imageNum.textColor = [UIColor whiteColor];
+        _imageNum.textAlignment = NSTextAlignmentRight;
+//        [containerView addSubview:_imageNum];
+        
+        /*
+         ***配置定时器,自动滚动广告栏
+         */
+        _timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(timerAction:) userInfo:nil repeats:YES];
+        [[NSRunLoop  currentRunLoop] addTimer:_timer forMode:NSDefaultRunLoopMode];
+        //[_timer setFireDate:[NSDate distantFuture]];//关闭定时器
+    }
+    self.backgroundColor = [UIColor orangeColor];
+    [WXApiManager sharedManager].delegate = self;
+    return self;
+}
+//---------------------------------------------------------------------------------
+
+-(void)timerAction:(NSTimer *)timer{
+    if (_totalNum>1) {
+        CGPoint newOffset = _scrollView.contentOffset;
+        newOffset.x = newOffset.x + CGRectGetWidth(_scrollView.frame);
+        //    NSLog(@"newOffset.x = %f",newOffset.x);
+        if (newOffset.x > (CGRectGetWidth(_scrollView.frame) * (_totalNum-1))) {
+            newOffset.x = 0 ;
+        }
+        int index = newOffset.x / CGRectGetWidth(_scrollView.frame);   //当前是第几个视图
+        newOffset.x = index * CGRectGetWidth(_scrollView.frame);
+        _imageNum.text = [NSString stringWithFormat:@"%d / %d",index+1,(int)_totalNum];
+        [_scrollView setContentOffset:newOffset animated:YES];
+    }else{
+        [_timer setFireDate:[NSDate distantFuture]];//关闭定时器
+    }
+}
+
+#pragma mark- PageControl绑定ScrollView
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
+    //滚动就执行--手动滑动后,定时器要重新计时dansonmark
+    if ([scrollView isMemberOfClass:[UITableView class]]) {
+        
+    }else {
+        int index = fabs(scrollView.contentOffset.x) / scrollView.frame.size.width;   //当前是第几个视图
+        _pageControl.currentPage = index;
+        for (UIView *view in scrollView.subviews) {
+            if(view.tag == index){
+                
+            }else{
+                
+            }
+        }
+    }
+}
+
+
+- (void)setImgArray:(NSArray *)imgArray{
+    
+    _imgArray = imgArray;
+    _totalNum = [imgArray count];
+    //NSLog(@"广告位图片imgArray---->%@",imgArray);
+    if (_totalNum > 0) {
+        for (int i = 0; i<_totalNum; i++) {
+            
+            NSDictionary *dic = imgArray[i];
+            
+            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(i*CGRectGetWidth(_scrollView.frame), 0, CGRectGetWidth(_scrollView.frame), CGRectGetHeight(_scrollView.frame))];
+            img.contentMode = UIViewContentModeScaleAspectFill;
+            //img.image = [UIImage imageNamed:imgArray[i]];
+            [img setClipsToBounds:YES];
+            NSString *path = dic[@"IMG"];
+            if (path && ![path hasPrefix:@"http"] && ![path hasPrefix:@"https"]){
+                path = [imgPreFix stringByAppendingString:path];
+            }
+            
+//            [img sd_setImageWithURL:[NSURL URLWithString:path] placeholderImage:[UIImage imageNamed:@"subject_main_banner.png"]];
+			[img sd_setImageWithURL:[NSURL URLWithString:path] placeholderImage:[UIImage imageNamed:@"subject_main_banner.png"] options:SDWebImageAllowInvalidSSLCertificates];
+
+            [img setTag:i];
+            
+            //把手势添加到指定视图上
+            [img setUserInteractionEnabled:YES];
+            UITapGestureRecognizer *tapGesture  = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(skipToADLink:)];
+            [img addGestureRecognizer:tapGesture];
+            
+            [_scrollView addSubview:img];
+        }
+        _imageNum.text = [NSString stringWithFormat:@"%d / %d",(int)_pageControl.currentPage+1,(int)_totalNum];
+        _pageControl.numberOfPages = _totalNum; //设置页数 //滚动范围 600=300*2,分2页
+        CGRect frame;
+        frame = _pageControl.frame;
+        frame.size.width = 15*_totalNum;
+        _pageControl.frame = frame;
+        
+        _scrollView.contentSize = CGSizeMake(CGRectGetWidth(_scrollView.frame)*_totalNum,CGRectGetHeight(_scrollView.frame));//滚动范围 600=300*2,分2页
+    }else{
+        UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(_scrollView.frame), CGRectGetHeight(_scrollView.frame))];
+        [img setImage:[UIImage imageNamed:@"subject_main_banner.png"]];
+        img.userInteractionEnabled = YES;
+//		[img setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
+//			[self miniwithUserName:@"gh_a994fd2f498e"];
+//		}];
+        [_scrollView addSubview:img];
+        //_imageNum.text = @"提示:滚动栏无数据。";
+        
+        _scrollView.contentSize = CGSizeMake(CGRectGetWidth(_scrollView.frame),CGRectGetHeight(_scrollView.frame));
+    }
+}
+
+//程序内跳转
+- (void)skipToADLink:(UITapGestureRecognizer *)gesture {
+    NSInteger index = gesture.view.tag;
+    
+    NSDictionary *dic = _imgArray[index];
+    [RQ_SHARE_FUNCTION saveObjectWithObject:dic ForKey:@"currentSelectDic"];
+    
+    NSString *skipType = dic[@"OPENTYPE"];
+    
+//	skipType = @"1";
+//	NSString *url = @"https://mobile.yangkeduo.com/duo_transfer_channel.html?resourceType=39997&pid=1642187_203462988&cpsSign=CE_210421_1642187_203462988_d9346faa8446cc110bb7c100859c9691&duoduo_type=2";
+    if ([skipType isEqualToString:@"1"]) {        
+        [RQ_SHARE_FUNCTION gotoWebViewWithUrlStr:dic[@"URL"]];
+    }else{
+		if ([dic[@"ADTYPE"] isEqualToString:@"2"]) {
+            [RQ_SHARE_FUNCTION miniwithUserName:dic[@"URL"] path:dic[@"AI_XCX_URL"]? : @""];
+		} else if ([dic[@"ADTYPE"] isEqualToString:@"1"]) {
+			[[UIApplication sharedApplication] openURL:[NSURL URLWithString:dic[@"URL"]] options:nil completionHandler:^(BOOL success) {
+				
+			}];
+        } else if ([dic[@"ADTYPE"] isEqualToString:@"3"]) {
+            WXSubscribeMsgReq *req = [[WXSubscribeMsgReq alloc] init];
+            req.scene = 1;
+            req.templateId = @"1iZwYeI2QtSXZ3rTRkQ42wgRkd7NSINzem8R-LvtHYw";
+            req.reserved = @"";
+            [WXApi sendReq:req completion:nil];
+        }
+    }
+}
+
+- (void)managerDidRecvSubscribeMsgResponse:(WXSubscribeMsgResp *)response {
+    NSDictionary *currentSelectDic = [RQ_SHARE_FUNCTION getObjectWithKey:@"currentSelectDic"];
+    [jiaPeiManager requestGetAnythingWithURL:[NSString stringWithFormat:@"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%@&secret=%@",RQ_WECHAT_MANAGER.appID, RQ_WECHAT_MANAGER.appSecret] completion:^(NSDictionary *dic) {
+        if (dic[@"access_token"]) {
+            [jiaPeiManager requestAnythingWithURL:[NSString stringWithFormat:@"https://api.weixin.qq.com/cgi-bin/message/template/subscribe?access_token=%@",dic[@"access_token"]] array:@[
+             @{@"touser" : response.openId},
+             @{@"template_id" : response.templateId},
+             @{@"url" : currentSelectDic[@"URL"]? : @"https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzk0MTI1ODAyMA==#wechat_redirect"},
+             @{@"scene" : [NSNumber numberWithInt:response.scene]},
+             @{@"title" : currentSelectDic[@"TITLE"]? : @"消息"},
+             @{@"data" : @{@"content":@{@"color":@"#173177",@"value":currentSelectDic[@"AI_CONTENT"]? : @"点击关注公众号"}}}
+            ].mutableCopy data:nil completion:^(NSDictionary *dict) {
+                if ([dict[@"errcode"] integerValue] == 0) {
+                    dispatch_async(dispatch_get_main_queue(), ^{
+                        ShowMsg(@"成功");
+                    });
+                } else {
+                    ShowMsg(@"失败");
+                }
+            }];
+        } else {
+            ShowMsg(@"获取token失败");
+        }
+    }];
+
+}
+
+- (void)openTimer{
+    [_timer setFireDate:[NSDate distantPast]];//开启定时器
+}
+- (void)closeTimer{
+    [_timer setFireDate:[NSDate distantFuture]];//关闭定时器
+}
+
+
+@end

+ 13 - 0
jiaPei/AllLightImagePickerController.h

@@ -0,0 +1,13 @@
+//
+//  AllLightImagePickerController.h
+//  jiaPei
+//
+//  Created by apple on 2017/3/2.
+//  Copyright © 2017年 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AllLightImagePickerController : UIImagePickerController
+
+@end

+ 42 - 0
jiaPei/AllLightImagePickerController.m

@@ -0,0 +1,42 @@
+//
+//  AllLightImagePickerController.m
+//  jiaPei
+//
+//  Created by apple on 2017/3/2.
+//  Copyright © 2017年 JCZ. All rights reserved.
+//
+
+#import "AllLightImagePickerController.h"
+
+@interface AllLightImagePickerController ()
+
+@end
+
+@implementation AllLightImagePickerController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+-(void)dealloc
+{
+    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];//屏幕常亮
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 17 - 0
jiaPei/BackgroundTaskManager.h

@@ -0,0 +1,17 @@
+//
+//  BackgroundTaskManager.h
+//
+//  Created by Puru Shukla on 20/02/13.
+//  Copyright (c) 2013 Puru Shukla. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface BackgroundTaskManager : NSObject
+
++(instancetype)sharedBackgroundTaskManager;
+
+-(UIBackgroundTaskIdentifier)beginNewBackgroundTask;
+-(void)endAllBackgroundTasks;
+
+@end

+ 109 - 0
jiaPei/BackgroundTaskManager.m

@@ -0,0 +1,109 @@
+//
+//  BackgroundTaskManager.m
+//
+//  Created by Puru Shukla on 20/02/13.
+//  Copyright (c) 2013 Puru Shukla. All rights reserved.
+//
+
+#import "BackgroundTaskManager.h"
+
+@interface BackgroundTaskManager()
+@property (nonatomic, strong)NSMutableArray* bgTaskIdList;
+@property (assign) UIBackgroundTaskIdentifier masterTaskId;
+@end
+
+@implementation BackgroundTaskManager
+
++(instancetype)sharedBackgroundTaskManager{
+    static BackgroundTaskManager* sharedBGTaskManager;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        sharedBGTaskManager = [[BackgroundTaskManager alloc] init];
+    });
+    
+    return sharedBGTaskManager;
+}
+
+-(id)init{
+    self = [super init];
+    if(self){
+        _bgTaskIdList = [NSMutableArray array];
+        _masterTaskId = UIBackgroundTaskInvalid;
+    }
+    
+    return self;
+}
+
+-(UIBackgroundTaskIdentifier)beginNewBackgroundTask
+{
+    UIApplication* application = [UIApplication sharedApplication];
+    
+    __block UIBackgroundTaskIdentifier bgTaskId = UIBackgroundTaskInvalid;
+    if([application respondsToSelector:@selector(beginBackgroundTaskWithExpirationHandler:)]){
+        bgTaskId = [application beginBackgroundTaskWithExpirationHandler:^{
+            //NSLog(@"background task %lu expired", (unsigned long)bgTaskId);
+            
+            [self.bgTaskIdList removeObject:@(bgTaskId)];
+            [application endBackgroundTask:bgTaskId];
+            bgTaskId = UIBackgroundTaskInvalid;
+            
+        }];
+        if ( self.masterTaskId == UIBackgroundTaskInvalid )
+        {
+            self.masterTaskId = bgTaskId;
+            //NSLog(@"started master task %lu", (unsigned long)self.masterTaskId);
+        }
+        else
+        {
+            //add this id to our list
+            //NSLog(@"started background task %lu", (unsigned long)bgTaskId);
+            [self.bgTaskIdList addObject:@(bgTaskId)];
+            [self endBackgroundTasks];
+        }
+    }
+    
+    return bgTaskId;
+}
+
+-(void)endBackgroundTasks
+{
+    [self drainBGTaskList:NO];
+}
+
+-(void)endAllBackgroundTasks
+{
+    [self drainBGTaskList:YES];
+}
+
+-(void)drainBGTaskList:(BOOL)all
+{
+    //mark end of each of our background task
+    UIApplication* application = [UIApplication sharedApplication];
+    if([application respondsToSelector:@selector(endBackgroundTask:)]){
+        NSUInteger count=self.bgTaskIdList.count;
+        for ( NSUInteger i=(all?0:1); i<count; i++ )
+        {
+            UIBackgroundTaskIdentifier bgTaskId = [[self.bgTaskIdList objectAtIndex:0] integerValue];
+            //NSLog(@"ending background task with id -%lu", (unsigned long)bgTaskId);
+            [application endBackgroundTask:bgTaskId];
+            [self.bgTaskIdList removeObjectAtIndex:0];
+        }
+        if ( self.bgTaskIdList.count > 0 )
+        {
+            //NSLog(@"kept background task id %@", [self.bgTaskIdList objectAtIndex:0]);
+        }
+        if ( all )
+        {
+            //NSLog(@"no more background tasks running");
+            [application endBackgroundTask:self.masterTaskId];
+            self.masterTaskId = UIBackgroundTaskInvalid;
+        }
+        else
+        {
+            //NSLog(@"kept master background task id %lu", (unsigned long)self.masterTaskId);
+        }
+    }
+}
+
+
+@end

+ 16 - 0
jiaPei/Category/MBProgressHUD/MBProgressHUD+Add.h

@@ -0,0 +1,16 @@
+//
+//  MBProgressHUD+Add.h
+//  视频客户端
+//
+//  Created by mj on 13-4-18.
+//  Copyright (c) 2013年 itcast. All rights reserved.
+//
+
+#import "MBProgressHUD.h"
+
+@interface MBProgressHUD (Add)
++ (void)showError:(NSString *)error toView:(UIView *)view;
++ (void)showSuccess:(NSString *)success toView:(UIView *)view;
+
++ (MBProgressHUD *)showMessag:(NSString *)message toView:(UIView *)view;
+@end

+ 54 - 0
jiaPei/Category/MBProgressHUD/MBProgressHUD+Add.m

@@ -0,0 +1,54 @@
+//
+//  MBProgressHUD+Add.m
+//  视频客户端
+//
+//  Created by mj on 13-4-18.
+//  Copyright (c) 2013年 itcast. All rights reserved.
+//
+
+#import "MBProgressHUD+Add.h"
+
+@implementation MBProgressHUD (Add)
+
+#pragma mark 显示信息
++ (void)show:(NSString *)text icon:(NSString *)icon view:(UIView *)view
+{
+    if (view == nil) view = [UIApplication sharedApplication].keyWindow;
+    // 快速显示一个提示信息
+    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
+	hud.label.text = text;
+    // 设置图片
+    hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle/%@", icon]]];
+    // 再设置模式
+    hud.mode = MBProgressHUDModeCustomView;
+    
+    // 隐藏时候从父控件中移除
+    hud.removeFromSuperViewOnHide = YES;
+    
+    // 1秒之后再消失
+	[hud hideAnimated:YES afterDelay:0.7];
+}
+
+#pragma mark 显示错误信息
++ (void)showError:(NSString *)error toView:(UIView *)view{
+    [self show:error icon:@"error.png" view:view];
+}
+
++ (void)showSuccess:(NSString *)success toView:(UIView *)view
+{
+    [self show:success icon:@"success.png" view:view];
+}
+
+#pragma mark 显示一些信息
++ (MBProgressHUD *)showMessag:(NSString *)message toView:(UIView *)view {
+    if (view == nil) view = [UIApplication sharedApplication].keyWindow;
+    // 快速显示一个提示信息
+    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
+	hud.label.text = message;
+    // 隐藏时候从父控件中移除
+    hud.removeFromSuperViewOnHide = YES;
+    // YES代表需要蒙版效果
+//    hud.dimBackground = YES;
+    return hud;
+}
+@end

BIN
jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/error.png


BIN
jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/error@2x.png


BIN
jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/success.png


BIN
jiaPei/Category/MBProgressHUD/MBProgressHUD.bundle/success@2x.png


+ 15 - 0
jiaPei/Category/NSError/NSError+RQExtension.h

@@ -0,0 +1,15 @@
+//
+//  NSError+RQExtension.h
+//  RQCommon
+//
+//  Created by 张嵘 on 2018/11/23.
+//  Copyright © 2018 张嵘. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface NSError (RQExtension)
++ (instancetype)rq_modelErrorWithException:(NSException *)exception;
+
++ (NSString *)rq_tipsFromError:(NSError *)error;
+@end

+ 46 - 0
jiaPei/Category/NSError/NSError+RQExtension.m

@@ -0,0 +1,46 @@
+//
+//  NSError+RQExtension.m
+//  RQCommon
+//
+//  Created by 张嵘 on 2018/11/23.
+//  Copyright © 2018 张嵘. All rights reserved.
+//
+
+#import "NSError+RQExtension.h"
+
+// The domain for errors originating from RQModel.
+static NSString * const RQModelErrorDomain = @"RQModelErrorDomain";
+
+// An exception was thrown and caught.
+static const NSInteger RQModelErrorExceptionThrown = 1;
+
+// Associated with the NSException that was caught.
+static NSString * const RQModelThrownExceptionErrorKey = @"RQModelThrownException";
+
+@implementation NSError (RQExtension)
+
++ (instancetype)rq_modelErrorWithException:(NSException *)exception {
+	NSParameterAssert(exception != nil);
+	
+	NSDictionary *userInfo = @{
+							   NSLocalizedDescriptionKey: exception.description,
+							   NSLocalizedFailureReasonErrorKey: exception.reason,
+							   RQModelThrownExceptionErrorKey: exception
+							   };
+	
+	return [NSError errorWithDomain:RQModelErrorDomain code:RQModelErrorExceptionThrown userInfo:userInfo];
+}
+
++ (NSString *)rq_tipsFromError:(NSError *)error{
+	if (!error) return nil;
+	NSString *tipStr = nil;
+	/// 这里需要处理HTTP请求的错误
+	if (error.domain) {
+		tipStr = error.localizedFailureReason;
+	} else {
+		tipStr = error.localizedDescription;
+	}
+	return tipStr;
+}
+
+@end

+ 18 - 0
jiaPei/Category/NSMutableArray/NSMutableArray+RQSafe.h

@@ -0,0 +1,18 @@
+//
+//  NSMutableArray+RQSafe.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/4/2.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "NSObject+RQSafe.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSMutableArray (RQSafe)
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 69 - 0
jiaPei/Category/NSMutableArray/NSMutableArray+RQSafe.m

@@ -0,0 +1,69 @@
+
+//
+//  NSMutableArray+RQSafe.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/4/2.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "NSMutableArray+RQSafe.h"
+
+@implementation NSMutableArray (RQSafe)
+static char const *name = "__NSArrayM";
++ (void)load {
+	static dispatch_once_t onceToken;
+	dispatch_once(&onceToken, ^{
+		[objc_getClass(name) methodSwizzlingWithOriginalSelector:@selector(addObject:) bySwizzledSelector:@selector(safeAddObject:)];
+		[objc_getClass(name) methodSwizzlingWithOriginalSelector:@selector(removeObject:) bySwizzledSelector:@selector(safeRemoveObject:)];
+		[objc_getClass(name) methodSwizzlingWithOriginalSelector:@selector(removeObjectAtIndex:) bySwizzledSelector:@selector(safeRemoveObjectAtIndex:)];
+		[objc_getClass(name) methodSwizzlingWithOriginalSelector:@selector(insertObject:atIndex:) bySwizzledSelector:@selector(safeInsertObject:atIndex:)];
+		[objc_getClass(name) methodSwizzlingWithOriginalSelector:@selector(objectAtIndex:) bySwizzledSelector:@selector(safeObjectAtIndex:)];
+	});
+}
+- (void)safeAddObject:(id)obj {
+	if (obj == nil) {
+		NSLog(@"%s can add nil object into NSMutableArray", __FUNCTION__);
+		return;
+	}
+	[self safeAddObject:obj];
+}
+- (void)safeRemoveObject:(id)obj {
+	if (obj == nil) {
+		NSLog(@"%s call -removeObject:, but argument obj is nil", __FUNCTION__);
+		return;
+	}
+	[self safeRemoveObject:obj];
+}
+- (void)safeRemoveObjectAtIndex:(NSUInteger)index {
+	if (self.count <= 0) {
+		NSLog(@"%s can't get any object from an empty array", __FUNCTION__);
+	} else if (index >= self.count) {
+		NSLog(@"%s index out of bound", __FUNCTION__);
+	} else {
+		[self safeRemoveObjectAtIndex:index];
+	}
+}
+- (void)safeInsertObject:(id)anObject atIndex:(NSUInteger)index {
+	if (anObject == nil) {
+		NSLog(@"%s can't insert nil into NSMutableArray", __FUNCTION__);
+	} else if (index > self.count) {
+		NSLog(@"%s: index is invalid", __FUNCTION__);
+	} else {
+		[self safeInsertObject:anObject atIndex:index];
+	}
+}
+- (id)safeObjectAtIndex:(NSUInteger)index {
+	if (self.count == 0) {
+		NSLog(@"%s can't get any object from an empty array", __FUNCTION__);
+		return nil;
+	} else if (index > self.count  - 1) {
+		// [__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]
+		NSLog(@"%s: index %ld beyond bounds [0..%ld]", __FUNCTION__, index, self.count);
+		return nil;
+	} else {
+		return [self safeObjectAtIndex:index];
+	}
+}
+
+@end

+ 29 - 0
jiaPei/Category/NSMutableArray/NSMutableArray+proper.h

@@ -0,0 +1,29 @@
+//
+//  NSMutableArray+proper.h
+//  jiaPei
+//
+//  Created by apple on 15/11/18.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface NSMutableArray(proper)
+-(void)property:(id)obj forKey:(NSString*)key;
+
+-(void)addPro:(NSString*)name Value:(NSString*)value;
+-(void)addPro2:(NSString*)name Value:(id)value;
+@end
+
+
+@interface NSArray(proper)
+
+-(id)objAtPath:(NSIndexPath*)path;
+
+@end
+
+
+
+
+
+

+ 84 - 0
jiaPei/Category/NSMutableArray/NSMutableArray+proper.m

@@ -0,0 +1,84 @@
+//
+//  NSMutableArray+proper.m
+//  jiaPei
+//
+//  Created by apple on 15/11/18.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import "NSMutableArray+proper.h"
+
+@implementation NSMutableArray(proper)
+
+-(void)property:(id)obj forKey:(NSString*)key
+{
+    if (self)
+    {
+        if (!obj) {
+            obj = @"";
+        }
+        if (!key) {
+            key = @"";
+        }
+        NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:obj,key, nil];
+        [self addObject:dict];
+    }
+}
+
+-(void)addPro:(NSString*)name Value:(NSString*)value
+{
+    [self property:value forKey:name];
+}
+
+-(void)addPro2:(NSString*)name Value:(id)value
+{
+    [self property:value forKey:name];
+}
+
+@end
+
+
+@implementation NSArray(proper)
+
+-(id)objAtPath:(NSIndexPath*)path
+{
+    if (path.section < self.count ) {
+        NSArray* subObj = self[path.section];
+        if([subObj isKindOfClass:[NSArray class]] ||
+           [subObj isKindOfClass:[NSMutableArray class]])
+        {
+            if (path.row < subObj.count) {
+                return [self[path.section] objectAtIndex:path.row];
+            }
+        }
+    }
+    
+    return nil;
+}
+
+
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 19 - 0
jiaPei/Category/NSObject/NSObject+RQSafe.h

@@ -0,0 +1,19 @@
+//
+//  NSObject+RQSafe.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/4/2.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <objc/runtime.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSObject (RQSafe)
++ (void)methodSwizzlingWithOriginalSelector:(SEL)originalSelector
+						 bySwizzledSelector:(SEL)swizzledSelector;
+@end
+
+NS_ASSUME_NONNULL_END

+ 31 - 0
jiaPei/Category/NSObject/NSObject+RQSafe.m

@@ -0,0 +1,31 @@
+//
+//  NSObject+RQSafe.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2019/4/2.
+//  Copyright © 2019 JCZ. All rights reserved.
+//
+
+#import "NSObject+RQSafe.h"
+
+@implementation NSObject (RQSafe)
++ (void)methodSwizzlingWithOriginalSelector:(SEL)originalSelector bySwizzledSelector:(SEL)swizzledSelector{
+	Class class = [self class];
+	//原有方法
+	Method originalMethod = class_getInstanceMethod(class, originalSelector);
+	//替换原有方法的新方法
+	Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
+	//先尝试給源SEL添加IMP,这里是为了避免源SEL没有实现IMP的情况
+	BOOL didAddMethod = class_addMethod(class,originalSelector,
+										method_getImplementation(swizzledMethod),
+										method_getTypeEncoding(swizzledMethod));
+	if (didAddMethod) {//添加成功:说明源SEL没有实现IMP,将源SEL的IMP替换到交换SEL的IMP
+		class_replaceMethod(class,swizzledSelector,
+							method_getImplementation(originalMethod),
+							method_getTypeEncoding(originalMethod));
+	} else {//添加失败:说明源SEL已经有IMP,直接将两个SEL的IMP交换即可
+		method_exchangeImplementations(originalMethod, swizzledMethod);
+	}
+}
+
+@end

+ 15 - 0
jiaPei/Category/NSString/NSString+Check.h

@@ -0,0 +1,15 @@
+//
+//  NSString+Check.h
+//  jiaPei
+//
+//  Created by apple on 16/8/15.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface NSString (Check)
+
+-(BOOL)checkPhoneNumInput;
+
+@end

+ 49 - 0
jiaPei/Category/NSString/NSString+Check.m

@@ -0,0 +1,49 @@
+//
+//  NSString+Check.m
+//  jiaPei
+//
+//  Created by apple on 16/8/15.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import "NSString+Check.h"
+
+@implementation NSString (Check)
+
+-(BOOL)checkPhoneNumInput{
+    
+    NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9]|70|77)\\d{8}$";
+    
+    NSString * CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$";
+    
+    NSString * CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$";
+    
+    NSString * CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$";
+    
+    // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$";
+    
+    NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];
+    
+    NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM];
+    
+    NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU];
+    
+    NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT];
+    
+    BOOL res1 = [regextestmobile evaluateWithObject:self];
+    
+    BOOL res2 = [regextestcm evaluateWithObject:self];
+    
+    BOOL res3 = [regextestcu evaluateWithObject:self];
+    
+    BOOL res4 = [regextestct evaluateWithObject:self];
+    
+    
+    if (res1 || res2 || res3 || res4 ){
+        return YES;
+    }else{
+        return NO;
+    }
+}
+
+@end

+ 64 - 0
jiaPei/Category/NSString/NSString+ex.h

@@ -0,0 +1,64 @@
+/**可用于字符串加密。
+ xml解析。
+ */
+
+#import <Foundation/Foundation.h>
+
+#import <CommonCrypto/CommonDigest.h>
+
+@interface NSString (ex)
+/**@"<ns:return>" @"</ns:return>"之间的结果
+ */
+-(NSString* )getXlmRet;
+
+-(NSString*)getCode;
+
+/**返回一个json字典
+ */
+-(id)jsonObject;
+
+- (NSString *)md5Encrypt;
+
+-(NSString *)toHighterWithLower:(NSString *)str;
+
+/**固定宽度,和字体大小。返回label高度
+ */
+-(CGFloat)heightForWid:(CGFloat)wid Font:(CGFloat)fontSize;
+
+-(CGSize)sizeForFont:(CGFloat)fontSize;
+
+-(NSString*)base64;
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 201 - 0
jiaPei/Category/NSString/NSString+ex.m

@@ -0,0 +1,201 @@
+//
+//  NSString+ex.m
+//  test1107
+//
+//  Created by apple on 15/11/7./Users/apple/Desktop/jiaPei/jiaPei/NSString+ex.m
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import "NSString+ex.h"
+#define xmlRetError @"ERROR:not found <ns:return></ns:return>"
+
+@implementation NSString(ex)
+
+
+-(NSString* )getXlmRet
+{
+    NSMutableString* mstr = [NSMutableString stringWithString:self];
+    
+    NSRange substr = [mstr rangeOfString:@"<ns:return>"];
+    NSRange substr2 = [mstr rangeOfString:@"</ns:return>"];
+    if (substr.location == NSNotFound || substr2.location == NSNotFound) {
+        return xmlRetError;
+    }
+    NSString *result = [mstr substringWithRange:NSMakeRange(substr.location + substr.length, substr2.location - substr.location - substr.length)];
+    
+    return result;
+}
+
+-(NSString*)getCode{
+    if (![self getXlmRet]) {
+        return nil;
+    }
+    NSDictionary* root = [self jsonObject];
+    return root[@"code"];
+}
+
+-(id)jsonObject
+{
+    NSString* ret = [self getXlmRet];
+    if (!ret)
+    {
+        return nil;
+    }
+    //options  --dansonpro
+    NSData* jsonData = [ret dataUsingEncoding:NSUTF8StringEncoding];
+    NSDictionary* json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
+    return json;
+}
+
+
+- (NSString *)md5Encrypt
+{
+    const char *cStr = [self UTF8String];
+    unsigned char result[16];
+    CC_MD5( cStr, (unsigned int)strlen(cStr), result );
+    NSString*  str = [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
+                      result[0], result[1], result[2], result[3],
+                      result[4], result[5], result[6], result[7],
+                      result[8], result[9], result[10], result[11],
+                      result[12], result[13], result[14], result[15]
+                      ];
+    str = [self toLower:str];
+    return str;
+}
+
+-(NSString *)toLower:(NSString *)str
+{
+    for (NSInteger i=0; i<str.length; i++) {
+        if ([str characterAtIndex:i]>='A'&[str characterAtIndex:i]<='Z') {
+            //A对应ASCII码的65  a对应ASCII码的97
+            //大写换小写 ASCII编码 --Danson
+            char  temp=[str characterAtIndex:i]+32;
+            NSRange range=NSMakeRange(i, 1);
+            str=[str stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",temp]];
+        }
+    }
+    return str;
+}
+
+-(NSString *)toHighterWithLower:(NSString *)str
+{
+    for (NSInteger i=0; i<str.length; i++) {
+        if ([str characterAtIndex:i]>='a'&[str characterAtIndex:i]<='z') {
+            //A对应ASCII码的65  a对应ASCII码的97
+            //小写换大写 ASCII编码 --Danson
+            char  temp=[str characterAtIndex:i]-32;
+            NSRange range=NSMakeRange(i, 1);
+            str=[str stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",temp]];
+        }
+    }
+    return str;
+}
+
+-(CGFloat)heightForWid:(CGFloat)wid Font:(CGFloat)fontSize
+{
+    if (self.length < 1) {
+        return 20.0;
+    }
+    return  [self boundingRectWithSize:CGSizeMake(wid, MAXFLOAT)  options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: [UIFont rq_fontForPingFangSC_RegularFontOfSize:fontSize]} context:nil].size.height;
+}
+-(CGSize)sizeForFont:(CGFloat)fontSize
+{
+    if (self.length < 1) {
+        return CGSizeMake(20, 20);
+    }
+    
+    return  [self boundingRectWithSize:CGSizeMake(MAXFLOAT, 20)  options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: [UIFont scaleSize:fontSize]} context:nil].size;
+}
+
+-(NSString*)base64
+{
+    NSString* path = [[NSBundle mainBundle] pathForResource:self ofType:nil];
+    
+    UIImage *_originImage = [UIImage imageNamed:path];
+    NSData *_data = UIImagePNGRepresentation(_originImage);
+    NSString *_encodedImageStr = [_data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
+    return _encodedImageStr;
+}
+/**
+ Base64字符串转UIImage图片:、
+ //UIImage图片转成Base64字符串:
+ UIImage *originImage = [UIImage imageNamed:@"originImage.png"];
+ NSData *data = UIImageJPEGRepresentation(originImage, 1.0f);
+ NSString *encodedImageStr = [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
+ 
+ //Base64字符串转UIImage图片:
+ NSData *decodedImageData = [[NSData alloc]
+ initWithBase64EncodedString:encodedImageStr options:NSDataBase64DecodingIgnoreUnknownCharacters];
+ UIImage *decodedImage = [UIImage imageWithData:decodedImageData];
+ */
+
+@end
+
+
+
+@implementation NSDictionary (Log)
+- (NSString *)descriptionWithLocale:(id)locale
+{
+    NSMutableString *str = [NSMutableString string];
+    
+    [str appendString:@"{\n"];
+    
+    //遍历字典的所有键值对
+    [self enumerateKeysAndObjectsUsingBlock:^(id key,id obj, BOOL *stop) {
+		if (!key) {
+			key = @"";
+		}
+		if (!obj) {
+			obj = @"";
+		}
+        [str appendFormat:@"\t%@ = %@,\n", key, obj];
+    }];
+    
+    [str appendString:@"}"];
+    
+    //查出最后一个,的范围
+    NSRange range = [str rangeOfString:@","options:NSBackwardsSearch];
+    if (range.length) {
+        // 删掉最后一个,
+        [str deleteCharactersInRange:range];
+    }
+    
+    return str;
+}
+@end
+
+@implementation NSArray (Log)
+- (NSString *)descriptionWithLocale:(id)locale
+{
+    NSMutableString *str = [NSMutableString string];
+    
+    [str appendString:@"[\n"];
+    
+    //遍历数组的所有元素
+    [self enumerateObjectsUsingBlock:^(id obj,NSUInteger idx, BOOL *stop) {
+        [str appendFormat:@"%@,\n", obj];
+    }];
+    
+    [str appendString:@"]"];
+    
+    //查出最后一个,的范围
+    NSRange range = [str rangeOfString:@","options:NSBackwardsSearch];
+    if (range.length) {
+        // 删掉最后一个,
+        [str deleteCharactersInRange:range];
+    }
+    
+    return str;
+}
+
+
+@end
+
+
+
+
+
+
+
+
+

+ 46 - 0
jiaPei/Category/RQCategory.h

@@ -0,0 +1,46 @@
+//
+//  RQCategory.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/4/9.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#ifndef RQCategory_h
+#define RQCategory_h
+
+
+#pragma mark - NSObject
+#import "NSObject+RQSafe.h"
+#pragma mark - NSString
+#import "NSString+Check.h"
+#import "NSString+ex.h"
+#pragma mark - NSMutableArray
+#import "NSMutableArray+proper.h"
+#import "NSMutableArray+RQSafe.h"
+#pragma mark - NSError
+#import "NSError+RQExtension.h"
+#pragma mark - UIView
+#import "UIView+gesture.h"
+#import "UIView+Frame.h"
+#pragma mark - UIViewController
+#import "UIViewController+ModalPresentationStyle.h"
+#pragma mark - UITextField
+#import "UITextField+RQExtension.h"
+#pragma mark - UIImage
+#import "UIImage+resize.h"
+#pragma mark - UIButton
+#import "UIButton+formatter.h"
+#pragma mark - UIAlertController
+#import "UIAlertController+RQExtennsion.h"
+#pragma mark - UIColor
+#import "UIColor+RQExtension.h"
+#pragma mark - UIFont
+#import "UIFont+RQExtension.h"
+#pragma mark - UITableViewCell
+#import "UITableViewCell+RQExtension.h"
+#pragma mark - XHLaunchAdButton
+#import "XHLaunchAdButton+RQExtension.h" /// XHLaunchAd 倒计时去掉S
+
+
+#endif /* RQCategory_h */

+ 16 - 0
jiaPei/Category/UIAlertController/UIAlertController+RQExtennsion.h

@@ -0,0 +1,16 @@
+//
+//  UIAlertController+RQExtennsion.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2018/11/20.
+//  Copyright © 2018 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface UIAlertController (RQExtennsion)
+@end
+
+NS_ASSUME_NONNULL_END

+ 19 - 0
jiaPei/Category/UIAlertController/UIAlertController+RQExtennsion.m

@@ -0,0 +1,19 @@
+//
+//  UIAlertController+RQExtennsion.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2018/11/20.
+//  Copyright © 2018 JCZ. All rights reserved.
+//
+
+#import "UIAlertController+RQExtennsion.h"
+
+@implementation UIAlertController (RQExtennsion)
+- (BOOL)shouldAutorotate {
+	return NO;
+}
+
+- (NSUInteger)supportedInterfaceOrientations {
+	return UIInterfaceOrientationMaskPortrait;
+}
+@end

+ 31 - 0
jiaPei/Category/UIButton/UIButton+formatter.h

@@ -0,0 +1,31 @@
+//
+//  UIButtom+formatter.h
+//  jiaPei
+//
+//  Created by apple on 15/11/16.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+
+@interface UIButton(formatter)
+
+/**默认的字体大小
+ */
+- (void)setImage:(UIImage *)image withTitle:(NSString *)title forState:(UIControlState)stateType;
+- (void)setImage:(UIImage *)image withTitle:(NSString *)title Font:(CGFloat)font forState:(UIControlState)stateType;
+
+- (void)setTitle:(NSString*)title textColor:(UIColor*)color Font:(CGFloat)font fotState:(UIControlState)stateType;
+- (void)setImage:(UIImage *)image withTitle:(NSString*)title textColor:(UIColor*)color Font:(CGFloat)font fotState:(UIControlState)stateType;
+
+/**简化按钮事件添加。要求一定要实现btnClick;
+ */
+-(void)target:(id)obj;
+-(void)target:(id)obj tag:(NSInteger)tag;
+
+-(void)setTitleNormal:(NSString*)title;
+-(void)setTitleSelect:(NSString*)title;
+
+@end

+ 106 - 0
jiaPei/Category/UIButton/UIButton+formatter.m

@@ -0,0 +1,106 @@
+//
+//  UIButtom+formatter.m
+//  jiaPei
+//
+//  Created by apple on 15/11/16.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import "UIButton+formatter.h"
+
+@implementation UIButton(formatter)
+
+
+- (void) setImage:(UIImage *)image withTitle:(NSString *)title forState:(UIControlState)stateType {
+    [self setImage:image withTitle:title Font:10 forState:stateType];
+}
+
+- (void) setImage:(UIImage *)image withTitle:(NSString *)title Font:(CGFloat)font forState:(UIControlState)stateType{
+    [self.titleLabel setContentMode:UIViewContentModeCenter];
+    [self.titleLabel setBackgroundColor:[UIColor clearColor]];
+    [self setTitleColor:kTitleColor forState:stateType];
+//    [self setTitleColor:kTitleColor forState:stateType];
+    [self setTitle:title forState:stateType];
+    [self.titleLabel setFont:[UIFont scaleSize:font]];
+    
+    [self setImage:image forState:stateType];
+    [self.imageView setContentMode:UIViewContentModeScaleAspectFit];
+}
+
+
+-(void) setTitle:(NSString*)title textColor:(UIColor*)color Font:(CGFloat)font fotState:(UIControlState)stateType
+{
+    [self setTitle:title forState:stateType];
+    [self setTitleColor:color forState:stateType];
+    [self.titleLabel setFont:[UIFont scaleSize:font]];
+}
+
+- (void)setImage:(UIImage *)image withTitle:(NSString*)title textColor:(UIColor*)color Font:(CGFloat)font fotState:(UIControlState)stateType {
+	[self.titleLabel setContentMode:UIViewContentModeCenter];
+	[self.titleLabel setBackgroundColor:[UIColor clearColor]];
+	[self setTitleColor:color forState:stateType];
+	[self setTitle:title forState:stateType];
+	[self.titleLabel setFont:[UIFont scaleSize:font]];
+	[self setImage:image forState:stateType];
+	[self.imageView setContentMode:UIViewContentModeScaleAspectFit];
+}
+
+
+-(void)setTitleNormal:(NSString*)title
+{
+    [self setTitle:title forState:UIControlStateNormal];
+}
+-(void)setTitleSelect:(NSString*)title
+{
+    [self setTitle:title forState:UIControlStateSelected];
+}
+
+
+-(void)target:(id)obj
+{
+    [self addTarget:obj action:NSSelectorFromString(@"btnClick:") forControlEvents:UIControlEventTouchUpInside];
+}
+
+-(void)target:(id)obj tag:(NSInteger)tag
+{
+    self.tag = tag;
+    [self target:obj];
+}
+
+
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 42 - 0
jiaPei/Category/UIColor/UIColor+RQExtension.h

@@ -0,0 +1,42 @@
+//
+//  UIColor+RQExtension.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/4/20.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface UIColor (RQExtension)
+/// 十六进制字符串获取颜色
+/// @param color 16进制色值  支持@“#123456”、 @“0X123456”、 @“123456”三种格式
++ (UIColor *)colorWithHexString:(NSString *)color;
+
+/// 十六进制字符串获取颜色
+/// @param color 16进制色值  支持@“#123456”、 @“0X123456”、 @“123456”三种格式
+/// @param alpha 透明度
++ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha;
+
+/// 适配暗黑模式颜色   传入的UIColor对象
+/// @param lightColor 普通模式颜色
+/// @param darkColor 暗黑模式颜色
++ (UIColor *)colorWithLightColor:(UIColor *)lightColor DarkColor:(UIColor *)darkColor;
+
+/// 适配暗黑模式颜色   颜色传入的是16进制字符串
+/// @param lightColor 普通模式颜色
+/// @param darkColor 暗黑模式颜色
++ (UIColor *)colorWithLightColorStr:(NSString *)lightColor DarkColor:(NSString *)darkColor;
+
+/// 适配暗黑模式颜色   颜色传入的是16进制字符串 还有颜色的透明度
+/// @param lightColor 普通模式颜色
+/// @param lightAlpha 普通模式颜色透明度
+/// @param darkColor 暗黑模式颜色透明度
+/// @param darkAlpha 暗黑模式颜色
++ (UIColor *)colorWithLightColorStr:(NSString *)lightColor WithLightColorAlpha:(CGFloat)lightAlpha DarkColor:(NSString *)darkColor WithDarkColorAlpha:(CGFloat)darkAlpha;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 99 - 0
jiaPei/Category/UIColor/UIColor+RQExtension.m

@@ -0,0 +1,99 @@
+//
+//  UIColor+RQExtension.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/4/20.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "UIColor+RQExtension.h"
+
+@implementation UIColor (RQExtension)
+///十六进制字符串获取颜色
+/// @param color 16进制色值  支持@“#123456”、 @“0X123456”、 @“123456”三种格式
++ (UIColor *)colorWithHexString:(NSString *)color{
+    return [self colorWithHexString:color alpha:1.0f];
+}
+
+
+/// 十六进制字符串获取颜色
+/// @param color 16进制色值  支持@“#123456”、 @“0X123456”、 @“123456”三种格式
+/// @param alpha 透明度
++ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha{
+    //删除字符串中的空格
+    NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
+    // String should be 6 or 8 characters
+    if ([cString length] < 6){
+        return [UIColor clearColor];
+    }
+    // strip 0X if it appears
+    //如果是0x开头的,那么截取字符串,字符串从索引为2的位置开始,一直到末尾
+    if ([cString hasPrefix:@"0X"]){
+        cString = [cString substringFromIndex:2];
+    }
+    //如果是#开头的,那么截取字符串,字符串从索引为1的位置开始,一直到末尾
+    if ([cString hasPrefix:@"#"]){
+        cString = [cString substringFromIndex:1];
+    }
+    if ([cString length] != 6){
+        return [UIColor clearColor];
+    }
+    
+    // Separate into r, g, b substrings
+    NSRange range;
+    range.location = 0;
+    range.length = 2;
+    //r
+    NSString *rString = [cString substringWithRange:range];
+    //g
+    range.location = 2;
+    NSString *gString = [cString substringWithRange:range];
+    //b
+    range.location = 4;
+    NSString *bString = [cString substringWithRange:range];
+    
+    // Scan values
+    unsigned int r, g, b;
+    [[NSScanner scannerWithString:rString] scanHexInt:&r];
+    [[NSScanner scannerWithString:gString] scanHexInt:&g];
+    [[NSScanner scannerWithString:bString] scanHexInt:&b];
+    return [UIColor colorWithRed:((float)r / 255.0f) green:((float)g / 255.0f) blue:((float)b / 255.0f) alpha:alpha];
+}
+
+
+/// 适配暗黑模式颜色   传入的UIColor对象
+/// @param lightColor 普通模式颜色
+/// @param darkColor 暗黑模式颜色
++ (UIColor *)colorWithLightColor:(UIColor *)lightColor DarkColor:(UIColor *)darkColor {
+    if (@available(iOS 13.0, *)) {
+        return [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull trainCollection) {
+            if ([trainCollection userInterfaceStyle] == UIUserInterfaceStyleLight) {
+                return lightColor;
+            } else {
+                return darkColor;
+            }
+        }];
+    } else {
+        return lightColor ? lightColor : (darkColor ? darkColor : [UIColor clearColor]);
+    }
+}
+
+/// 适配暗黑模式颜色   颜色传入的是16进制字符串
+/// @param lightColor 普通模式颜色
+/// @param darkColor 暗黑模式颜色
++ (UIColor *)colorWithLightColorStr:(NSString *)lightColor DarkColor:(NSString *)darkColor{
+    return [UIColor colorWithLightColor:[UIColor colorWithHexString:lightColor] DarkColor:[UIColor colorWithHexString:darkColor]];
+}
+
+
+/// 适配暗黑模式颜色   颜色传入的是16进制字符串 还有颜色的透明度
+/// @param lightColor 普通模式颜色
+/// @param lightAlpha 普通模式颜色透明度
+/// @param darkColor 暗黑模式颜色透明度
+/// @param darkAlpha 暗黑模式颜色
++ (UIColor *)colorWithLightColorStr:(NSString *)lightColor WithLightColorAlpha:(CGFloat)lightAlpha DarkColor:(NSString *)darkColor WithDarkColorAlpha:(CGFloat)darkAlpha{
+    return [UIColor colorWithLightColor:[UIColor colorWithHexString:lightColor alpha:lightAlpha] DarkColor:[UIColor colorWithHexString:darkColor alpha:darkAlpha]];
+}
+
+
+@end

+ 128 - 0
jiaPei/Category/UIFont/UIFont+RQExtension.h

@@ -0,0 +1,128 @@
+//
+//  UIFont+RQExtension.h
+//  RQCommon
+//
+//  Created by 张嵘 on 2018/11/16.
+//  Copyright © 2018 张嵘. All rights reserved.
+//
+
+/**
+ *  但是苹方字体 iOS9.0+出现  需要做适配
+ *  这个分类主要用来 字体...
+ (
+ "PingFangSC-Ultralight",
+ "PingFangSC-Regular",
+ "PingFangSC-Semibold",
+ "PingFangSC-Thin",
+ "PingFangSC-Light",
+ "PingFangSC-Medium"
+ )
+ */
+
+// IOS版本
+#define RQIOSVersion ([[[UIDevice currentDevice] systemVersion] floatValue])
+
+
+/// 设置系统的字体大小(YES:粗体 NO:常规)
+#define RQFont(__size__,__bold__) ((__bold__)?([UIFont boldSystemFontOfSize:__size__]):([UIFont systemFontOfSize:__size__]))
+
+/// 极细体
+#define RQUltralightFont(__size__) ((RQIOSVersion<9.0)?RQFont(__size__ , YES):[UIFont rq_fontForPingFangSC_UltralightFontOfSize:__size__])
+
+/// 纤细体
+#define RQThinFont(__size__)       ((RQIOSVersion<9.0)?RQFont(__size__ , YES):[UIFont rq_fontForPingFangSC_ThinFontOfSize:__size__])
+
+/// 细体
+#define RQLightFont(__size__)      ((RQIOSVersion<9.0)?RQFont(__size__ , YES):[UIFont rq_fontForPingFangSC_LightFontOfSize:__size__])
+
+// 中等
+#define RQMediumFont(__size__)     ((RQIOSVersion<9.0)?RQFont(__size__ , YES):[UIFont rq_fontForPingFangSC_MediumFontOfSize:__size__])
+
+// 常规
+#define RQRegularFont(__size__)    ((RQIOSVersion<9.0)?RQFont(__size__ , NO):[UIFont rq_fontForPingFangSC_RegularFontOfSize:__size__])
+
+/** 中粗体 */
+#define RQSemiboldFont(__size__)   ((RQIOSVersion<9.0)?RQFont(__size__ , YES):[UIFont rq_fontForPingFangSC_SemiboldFontOfSize:__size__])
+
+
+
+/// 苹方常规字体 10
+#define RQRegularFont_10 RQRegularFont(10.0f)
+/// 苹方常规字体 11
+#define RQRegularFont_11 RQRegularFont(11.0f)
+/// 苹方常规字体 12
+#define RQRegularFont_12 RQRegularFont(12.0f)
+/// 苹方常规字体 13
+#define RQRegularFont_13 RQRegularFont(13.0f)
+/** 苹方常规字体 14 */
+#define RQRegularFont_14 RQRegularFont(14.0f)
+/// 苹方常规字体 15
+#define RQRegularFont_15 RQRegularFont(15.0f)
+/// 苹方常规字体 16
+#define RQRegularFont_16 RQRegularFont(16.0f)
+/// 苹方常规字体 17
+#define RQRegularFont_17 RQRegularFont(17.0f)
+/// 苹方常规字体 18
+#define RQRegularFont_18 RQRegularFont(18.0f)
+/// 苹方常规字体 19
+#define RQRegularFont_19 RQRegularFont(19.0f)
+/// 苹方常规字体 20
+#define RQRegularFont_20 RQRegularFont(20.0f)
+
+
+#import <UIKit/UIKit.h>
+
+@interface UIFont (RQExtension)
+
+/**
+ *  苹方极细体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_UltralightFontOfSize:(CGFloat)fontSize;
+
+/**
+ *  苹方常规体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_RegularFontOfSize:(CGFloat)fontSize;
+
+/**
+ *  苹方中粗体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_SemiboldFontOfSize:(CGFloat)fontSize;
+
+/**
+ *  苹方纤细体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_ThinFontOfSize:(CGFloat)fontSize;
+
+/**
+ *  苹方细体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_LightFontOfSize:(CGFloat)fontSize;
+
+/**
+ *  苹方中黑体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_MediumFontOfSize:(CGFloat)fontSize;
+
+
+
+@end
+

+ 149 - 0
jiaPei/Category/UIFont/UIFont+RQExtension.m

@@ -0,0 +1,149 @@
+//
+//  UIFont+RQExtension.m
+//  RQCommon
+//
+//  Created by 张嵘 on 2018/11/16.
+//  Copyright © 2018 张嵘. All rights reserved.
+//
+
+/**
+ *
+ (
+ "PingFangSC-Ultralight",
+ "PingFangSC-Regular",
+ "PingFangSC-Semibold",
+ "PingFangSC-Thin",
+ "PingFangSC-Light",
+ "PingFangSC-Medium"
+ )
+ */
+/**
+ *  极细体
+ */
+static NSString *const RQPingFangSC_Ultralight = @"PingFangSC-Ultralight";
+/**
+ *  常规体
+ */
+static NSString *const RQPingFangSC_Regular = @"PingFangSC-Regular";
+/**
+ *  中粗体
+ */
+static NSString *const RQPingFangSC_Semibold = @"PingFangSC-Semibold";
+/**
+ *  纤细体
+ */
+static NSString *const RQPingFangSC_Thin = @"PingFangSC-Thin";
+/**
+ *  细体
+ */
+static NSString *const RQPingFangSC_Light = @"PingFangSC-Light";
+/**
+ *  中黑体
+ */
+static NSString *const RQPingFangSC_Medium = @"PingFangSC-Medium";
+
+
+#import "UIFont+RQExtension.h"
+
+@implementation UIFont (RQExtension)
+/**
+ *  苹方极细体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_UltralightFontOfSize:(CGFloat)fontSize {
+	return [UIFont fontWithName:RQPingFangSC_Ultralight size:fontSize];
+}
+
+/**
+ *  苹方常规体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_RegularFontOfSize:(CGFloat)fontSize {
+	return [UIFont fontWithName:RQPingFangSC_Regular size:fontSize];
+}
+
+/**
+ *  苹方中粗体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_SemiboldFontOfSize:(CGFloat)fontSize {
+	return [UIFont fontWithName:RQPingFangSC_Semibold size:fontSize];
+}
+
+/**
+ *  苹方纤细体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_ThinFontOfSize:(CGFloat)fontSize {
+	return [UIFont fontWithName:RQPingFangSC_Thin size:fontSize];
+}
+
+/**
+ *  苹方细体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_LightFontOfSize:(CGFloat)fontSize {
+	return [UIFont fontWithName:RQPingFangSC_Light size:fontSize];
+}
+
+/**
+ *  苹方中黑体
+ *
+ *  @param fontSize 字体大小
+ *
+ */
++ (instancetype)rq_fontForPingFangSC_MediumFontOfSize:(CGFloat)fontSize {
+	return [UIFont fontWithName:RQPingFangSC_Medium size:fontSize];
+}
+
++(void)load {
+	//获取替换后的类方法
+	Method newMethod0 = class_getClassMethod([self class], @selector(adjustFont:));
+	//获取替换前的类方法
+	Method method0 = class_getClassMethod([self class], @selector(systemFontOfSize:));
+	//然后交换类方法
+	method_exchangeImplementations(newMethod0, method0);
+	
+	//获取替换后的类方法
+	Method newMethod1 = class_getClassMethod([self class], @selector(adjustFontWithName:size:));
+	//获取替换前的类方法
+	Method method1 = class_getClassMethod([self class], @selector(fontWithName:size:));
+	//然后交换类方法
+	method_exchangeImplementations(newMethod1, method1);
+	
+	
+}
+
++ (UIFont *)adjustFont:(CGFloat)fontSize{
+	
+	UIFont *newFont = nil;
+	if (kiPhone6Plus || IS_IPHONE_IPhoneX_All){
+		newFont = [UIFont adjustFont:fontSize + 2];
+	}else{
+		newFont = [UIFont adjustFont:fontSize];
+	}
+	return newFont;
+}
+
++ (UIFont *)adjustFontWithName:(NSString *)name size:(CGFloat)fontSize {
+	UIFont *newFont = nil;
+	if (kiPhone6Plus || IS_IPHONE_IPhoneX_All){
+		newFont = [UIFont adjustFontWithName:name size:fontSize + 2];
+	}else{
+		newFont = [UIFont adjustFontWithName:name size:fontSize];
+	}
+	return newFont;
+}
+
+
+@end

+ 20 - 0
jiaPei/Category/UIImage/UIImage+resize.h

@@ -0,0 +1,20 @@
+//
+//  UIImage+resize.h
+//  test23
+//
+//  Created by apple on 15/12/1.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+@interface UIImage(resize)
+
+/**生成新尺寸 不裁剪图片
+ */
+- (UIImage *)scaledToSize:(CGSize)newSize;
+
+/**生成新尺寸 裁剪图片
+ */
+- (UIImage *)scaledAndCutToSize:(CGSize)newSize;
+
+@end

+ 83 - 0
jiaPei/Category/UIImage/UIImage+resize.m

@@ -0,0 +1,83 @@
+//
+//  UIImage+resize.m
+//  test23
+//
+//  Created by apple on 15/12/1.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import "UIImage+resize.h"
+
+@implementation UIImage(resize)
+
+//将JPEG格式转换为PNG
+-(UIImage *)reduceImage:(UIImage *)image percent:(float)percent
+{
+    NSData *imageData = UIImageJPEGRepresentation(image, percent);
+    UIImage *newImage = [UIImage imageWithData:imageData];
+    return newImage;
+}
+//压缩图片尺寸
+- (UIImage *)scaledToSize:(CGSize)newSize
+{
+    //首先要找到缩放比 按长的适配 不足的部分空白
+    CGFloat rate =newSize.width*1.0/ self.size.width ;
+    if (self.size.height* rate > newSize.height) {
+        //过长了。
+        rate =newSize.height*1.0/ self.size.height ;
+    }
+    CGSize size = CGSizeMake(self.size.width*rate, self.size.height*rate);
+    
+    // Create a graphics image context
+    UIGraphicsBeginImageContext(size);
+    // new size
+    [self drawInRect:CGRectMake(0,0,size.width,size.height)];
+    // Get the new image from the context
+    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
+    
+    // End the context
+    UIGraphicsEndImageContext();
+    // Return the new image.
+    return newImage;
+}
+
+- (UIImage *)scaledAndCutToSize:(CGSize)newSize{
+    
+    //首先要找到缩放比 按短的适配 长的部分裁减掉
+    CGFloat rate =newSize.width*1.0/ self.size.width ;
+    if (self.size.height* rate < newSize.height) {
+        //过长了。
+        rate =newSize.height*1.0/ self.size.height ;
+    }
+    CGSize size = CGSizeMake(self.size.width*rate, self.size.height*rate);
+    
+    UIGraphicsBeginImageContext(size);
+    
+    [self drawInRect:CGRectMake(0,0,size.width,size.height)];
+    // Get the new image from the context
+    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
+    
+    // End the context
+    UIGraphicsEndImageContext();
+    // Return the new image.
+    return newImage;
+}
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 17 - 0
jiaPei/Category/UITableViewCell/UITableViewCell+RQExtension.h

@@ -0,0 +1,17 @@
+//
+//  UITableViewCell+RQExtension.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/6/19.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface UITableViewCell (RQExtension)
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 30 - 0
jiaPei/Category/UITableViewCell/UITableViewCell+RQExtension.m

@@ -0,0 +1,30 @@
+//
+//  UITableViewCell+RQExtension.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/6/19.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "UITableViewCell+RQExtension.h"
+
+@implementation UITableViewCell (RQExtension)
+- (void)drawRect:(CGRect)rect {
+    [super drawRect:rect];
+	UITableView *superView = (UITableView *)self.superview;
+	if (![superView isKindOfClass:[UITableView class]]) {
+		superView = (UITableView *)self.superview.superview;
+	}
+	
+	if ([superView isKindOfClass:[UITableView class]]) {
+		NSIndexPath *indexPath = [superView indexPathForCell:self];
+		NSInteger rows = [superView numberOfRowsInSection:indexPath.section];
+		self.separatorInset = UIEdgeInsetsMake(0, 15, 0, 0);
+		if(indexPath.row == rows -1) {
+			self.separatorInset = UIEdgeInsetsMake(0, 0, 0, KScreenwidth);
+		} else {
+			self.separatorInset=UIEdgeInsetsMake(0, 15, 0, 0);
+		}
+	}
+}
+@end

+ 16 - 0
jiaPei/Category/UITextField/UITextField+RQExtension.h

@@ -0,0 +1,16 @@
+//
+//  UITextField+RQExtension.h
+//  RQCommon
+//
+//  Created by 张嵘 on 2018/11/23.
+//  Copyright © 2018 张嵘. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <objc/runtime.h>
+
+
+@interface UITextField (RQExtension)
+/// 限制最大长度
+- (void)rq_limitMaxLength:(NSInteger)maxLength;
+@end

+ 35 - 0
jiaPei/Category/UITextField/UITextField+RQExtension.m

@@ -0,0 +1,35 @@
+//
+//  UITextField+RQExtension.m
+//  RQCommon
+//
+//  Created by 张嵘 on 2018/11/23.
+//  Copyright © 2018 张嵘. All rights reserved.
+//
+
+#import "UITextField+RQExtension.h"
+
+@implementation UITextField (RQExtension)
+
+- (void)rq_limitMaxLength:(NSInteger)maxLength {
+	/// 修改昵称
+	@weakify(self);
+	[[[RACSignal merge:@[RACObserve(self, text),self.rac_textSignal]] skip:0] subscribeNext:^(NSString * text) {
+		@strongify(self);
+		UITextRange *selectedRange = [self markedTextRange];
+		UITextPosition *position = [self positionFromPosition:selectedRange.start offset:0];
+		
+		// 没有高亮选择的字,则对已输入的文字进行字数统计和限制,防止中文被截断
+		if (position) return ;
+		if (text.length <= maxLength) return;
+		
+		//中文和emoj表情存在问题,需要对此进行处理
+		NSRange range;
+		NSUInteger inputLength = 0;
+		for(int i =0 ; i < text.length && inputLength <= maxLength; i += range.length){
+			range = [self.text rangeOfComposedCharacterSequenceAtIndex:i];
+			inputLength += [text substringWithRange:range].length;
+			if (inputLength > maxLength) self.text = [text substringWithRange:NSMakeRange(0, range.location)];
+		}
+	}];
+}
+@end

+ 64 - 0
jiaPei/Category/UIView/UIView+Frame.h

@@ -0,0 +1,64 @@
+//
+//  UIView+Frame.h
+//  WZLCodeLibrary
+//
+//  Created by wzl on 15/3/23.
+//  Copyright (c) 2015年 Weng-Zilin. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIView (Frame)
+
+@property (nonatomic, assign) CGFloat x;
+@property (nonatomic, assign) CGFloat y;
+@property (nonatomic, assign) CGFloat width;
+@property (nonatomic, assign) CGFloat height;
+@property (nonatomic, assign) CGPoint origin;
+@property (nonatomic, assign) CGSize  size;
+/**maxY*/
+@property (nonatomic, assign) CGFloat bottom;
+/**maxX*/
+@property (nonatomic, assign) CGFloat tail;
+
+@property (nonatomic, assign) CGFloat middleX;
+@property (nonatomic, assign) CGFloat middleY;
+
+-(void)borderColor:(UIColor*)color width:(CGFloat)wid cornorRadios:(CGFloat)cornor;
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 174 - 0
jiaPei/Category/UIView/UIView+Frame.m

@@ -0,0 +1,174 @@
+//
+//  UIView+Frame.m
+//  WZLCodeLibrary
+//
+//  Created by wzl on 15/3/23.
+//  Copyright (c) 2015年 Weng-Zilin. All rights reserved.
+//
+
+#import "UIView+Frame.h"
+
+@implementation UIView (Frame)
+
+- (void)setX:(CGFloat)x
+{
+    CGRect frame = self.frame;
+    frame.origin.x = x;
+    self.frame = frame;
+}
+
+- (CGFloat)x
+{
+    return self.frame.origin.x;
+}
+
+- (void)setY:(CGFloat)y
+{
+    CGRect frame = self.frame;
+    frame.origin.y = y;
+    self.frame = frame;
+}
+
+- (CGFloat)y
+{
+    return self.frame.origin.y;
+}
+
+- (void)setOrigin:(CGPoint)origin
+{
+    CGRect frame = self.frame;
+    frame.origin = origin;
+    self.frame = frame;
+}
+
+- (CGPoint)origin
+{
+    return self.frame.origin;
+}
+
+- (void)setWidth:(CGFloat)width
+{
+    CGRect frame = self.frame;
+    frame.size.width = width;
+    self.frame = frame;
+}
+
+- (CGFloat)width
+{
+    return self.frame.size.width;
+}
+
+- (void)setHeight:(CGFloat)height
+{
+    CGRect frame = self.frame;
+    frame.size.height = height;
+    self.frame = frame;
+}
+
+- (CGFloat)height
+{
+    return self.frame.size.height;
+}
+
+- (void)setSize:(CGSize)size
+{
+    CGRect frame = self.frame;
+    frame.size = size;
+    self.frame = frame;
+}
+
+- (CGSize)size
+{
+    return self.frame.size;
+}
+
+- (void)setBottom:(CGFloat)bottom
+{
+    CGRect frame = self.frame;
+    frame.origin.y = bottom - frame.size.height;
+    self.frame = frame;
+}
+
+- (CGFloat)bottom
+{
+    return CGRectGetMaxY(self.frame);
+}
+
+- (CGFloat)tail
+{
+    return CGRectGetMaxX(self.frame);
+}
+
+- (void)setTail:(CGFloat)tail
+{
+    CGRect frame = self.frame;
+    frame.origin.x = tail - frame.size.width;
+    self.frame = frame;
+}
+
+- (void)setMiddleX:(CGFloat)middleX
+{
+    CGRect frame = self.frame;
+    frame.origin.x = middleX - frame.size.width / 2;
+    self.frame = frame;
+}
+
+- (CGFloat)middleX
+{
+    return CGRectGetMidX(self.frame);
+}
+
+- (void)setMiddleY:(CGFloat)middleY
+{
+    CGRect frame = self.frame;
+    frame.origin.y = middleY - frame.size.height / 2 ;
+    self.frame = frame;
+}
+
+- (CGFloat)middleY
+{
+    return CGRectGetMidY(self.frame);
+}
+
+#pragma mark -
+
+-(void)borderColor:(UIColor *)color width:(CGFloat)wid cornorRadios:(CGFloat)cornor
+{
+    self.layer.masksToBounds = YES;
+    self.layer.borderWidth = wid;
+    self.layer.cornerRadius = cornor;
+    self.layer.borderColor = color.CGColor;
+}
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 13 - 0
jiaPei/Category/UIView/UIView+gesture.h

@@ -0,0 +1,13 @@
+//
+//  UIView+gesture.h
+//
+//  Created by CHD on 2018/5/8.
+//  Copyright © 2018年 chd. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIView (gesture)
+- (void)setTapActionWithBlock:(void (^)(UITapGestureRecognizer*tap))block;
+- (void)setLongPressActionWithBlock:(void (^)(UILongPressGestureRecognizer*longP))block;
+@end

+ 77 - 0
jiaPei/Category/UIView/UIView+gesture.m

@@ -0,0 +1,77 @@
+//
+//  UIView+gesture.m
+//
+//  Created by CHD on 2018/5/8.
+//  Copyright © 2018年 chd. All rights reserved.
+//
+
+
+#import "UIView+gesture.h"
+#import <objc/runtime.h>
+
+static char kDTActionHandlerTapBlockKey;
+static char kDTActionHandlerTapGestureKey;
+static char kDTActionHandlerLongPressBlockKey;
+static char kDTActionHandlerLongPressGestureKey;
+
+@implementation UIView (gesture)
+
+- (void)setTapActionWithBlock:(void (^)(UITapGestureRecognizer*tap))block
+{
+    self.userInteractionEnabled = YES;
+    UITapGestureRecognizer *gesture = objc_getAssociatedObject(self, &kDTActionHandlerTapGestureKey);
+    
+    if (!gesture)
+    {
+        gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(__handleActionForTapGesture:)];
+        [self addGestureRecognizer:gesture];
+        objc_setAssociatedObject(self, &kDTActionHandlerTapGestureKey, gesture, OBJC_ASSOCIATION_RETAIN);
+    }
+    
+    objc_setAssociatedObject(self, &kDTActionHandlerTapBlockKey, block, OBJC_ASSOCIATION_COPY);
+}
+
+- (void)__handleActionForTapGesture:(UITapGestureRecognizer *)gesture
+{
+    
+    if (gesture.state == UIGestureRecognizerStateRecognized)
+    {
+        void(^action)(UITapGestureRecognizer*tap) = objc_getAssociatedObject(self, &kDTActionHandlerTapBlockKey);
+        
+        if (action)
+        {
+            action(gesture);
+        }
+    }
+}
+
+- (void)setLongPressActionWithBlock:(void (^)(UILongPressGestureRecognizer*longP))block
+{
+    self.userInteractionEnabled = YES;
+    UILongPressGestureRecognizer *gesture = objc_getAssociatedObject(self, &kDTActionHandlerLongPressGestureKey);
+    
+    if (!gesture)
+    {
+        gesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(__handleActionForLongPressGesture:)];
+        [self addGestureRecognizer:gesture];
+        objc_setAssociatedObject(self, &kDTActionHandlerLongPressGestureKey, gesture, OBJC_ASSOCIATION_RETAIN);
+    }
+    
+    objc_setAssociatedObject(self, &kDTActionHandlerLongPressBlockKey, block, OBJC_ASSOCIATION_COPY);
+}
+
+- (void)__handleActionForLongPressGesture:(UITapGestureRecognizer *)gesture
+{
+    if (gesture.state == UIGestureRecognizerStateBegan)
+    {
+        void(^action)(UILongPressGestureRecognizer*longP) = objc_getAssociatedObject(self, &kDTActionHandlerLongPressBlockKey);
+        
+        if (action)
+        {
+            action((UILongPressGestureRecognizer*)gesture);
+        }
+    }
+}
+
+@end
+

+ 17 - 0
jiaPei/Category/UIViewController/UIViewController+ModalPresentationStyle.h

@@ -0,0 +1,17 @@
+//
+//  UIViewController+ModalPresentationStyle.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/3/14.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface UIViewController (ModalPresentationStyle)
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 44 - 0
jiaPei/Category/UIViewController/UIViewController+ModalPresentationStyle.m

@@ -0,0 +1,44 @@
+//
+//  UIViewController+ModalPresentationStyle.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/3/14.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "UIViewController+ModalPresentationStyle.h"
+#import <objc/runtime.h>
+
+
+@implementation UIViewController (ModalPresentationStyle)
++ (void)load {
+    // 方法交换,为的是当系统调用viewDidLoad时候,调用的是我们的my_viewDidLoad方法
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        Class class = [self class];
+        SEL originalSelector = @selector(viewDidLoad);
+        SEL swizzledSelector = @selector(my_viewDidLoad);
+        Method originalMethod = class_getInstanceMethod(class, originalSelector);
+        Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
+        BOOL success = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
+        if (success) {
+            class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
+        } else {
+            method_exchangeImplementations(originalMethod, swizzledMethod);
+        }
+    });
+}
+ 
+- (void)my_viewDidLoad {
+    
+    [self my_viewDidLoad]; // 由于方法交换,实际上调用的是系统的viewDidLoad
+    
+    NSArray *viewcontrollers=self.navigationController.viewControllers;
+    if (viewcontrollers.count > 1) {
+        
+    } else {
+        //present方式
+        self.modalPresentationStyle = UIModalPresentationFullScreen;  // 修改默认值
+    }
+}
+@end

+ 17 - 0
jiaPei/Category/XHLaunchAdButton/XHLaunchAdButton+RQExtension.h

@@ -0,0 +1,17 @@
+//
+//  XHLaunchAdButton+RQExtension.h
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/4/9.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "XHLaunchAdButton.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface XHLaunchAdButton (RQExtension)
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 97 - 0
jiaPei/Category/XHLaunchAdButton/XHLaunchAdButton+RQExtension.m

@@ -0,0 +1,97 @@
+//
+//  XHLaunchAdButton+RQExtension.m
+//  jiaPei
+//
+//  Created by 张嵘 on 2020/4/9.
+//  Copyright © 2020 JCZ. All rights reserved.
+//
+
+#import "XHLaunchAdButton+RQExtension.h"
+#import <objc/runtime.h>
+
+/** Progress颜色 */
+#define RoundProgressColor  [UIColor whiteColor]
+/** 背景色 */
+#define BackgroundColor [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4]
+/** 字体颜色 */
+#define FontColor  [UIColor whiteColor]
+
+#define SkipTitle @"跳过"
+/** 倒计时单位 */
+#define DurationUnit @""
+
+
+@interface XHLaunchAdButton (RQExtennsion)
+@property(nonatomic,strong)UILabel *timeLab;
+@end
+
+@implementation XHLaunchAdButton (RQExtension)
+
++ (void)load {
+    // 方法交换,为的是当XHLaunchAdButton调用setTitleWithSkipType时候,调用的是我们的my_setTitleWithSkipType方法
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        Class class = [self class];
+		SEL originalSelector = @selector(setTitleWithSkipType:duration:);
+        SEL swizzledSelector = @selector(my_setTitleWithSkipType:duration:);
+        Method originalMethod = class_getInstanceMethod(class, originalSelector);
+        Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
+        BOOL success = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
+        if (success) {
+            class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
+        } else {
+            method_exchangeImplementations(originalMethod, swizzledMethod);
+        }
+    });
+}
+
+- (void)my_setTitleWithSkipType:(SkipType)skipType duration:(NSInteger)duration{
+	[self my_setTitleWithSkipType:skipType duration:duration]; // 由于方法交换,实际上调用的是XHLaunchAdButton的setTitleWithSkipType
+	/// 禁止跳过
+	self.userInteractionEnabled = NO;
+    switch (skipType) {
+        case SkipTypeNone:{
+            self.hidden = YES;
+        }
+            break;
+        case SkipTypeTime:{
+            self.hidden = NO;
+            self.timeLab.text = [NSString stringWithFormat:@"%ld %@",duration,DurationUnit];
+        }
+            break;
+        case SkipTypeText:{
+            self.hidden = NO;
+            self.timeLab.text = SkipTitle;
+        }
+            break;
+        case SkipTypeTimeText:{
+            self.hidden = NO;
+            self.timeLab.text = [NSString stringWithFormat:@"%ld %@",duration,SkipTitle];
+        }
+            break;
+        case SkipTypeRoundTime:{
+            self.hidden = NO;
+            self.timeLab.text = [NSString stringWithFormat:@"%ld %@",duration,DurationUnit];
+        }
+            break;
+        case SkipTypeRoundText:{
+            self.hidden = NO;
+            self.timeLab.text = SkipTitle;
+        }
+            break;
+        case SkipTypeRoundProgressTime:{
+            self.hidden = NO;
+            self.timeLab.text = [NSString stringWithFormat:@"%ld %@",duration,DurationUnit];
+        }
+            break;
+        case SkipTypeRoundProgressText:{
+            self.hidden = NO;
+            self.timeLab.text = SkipTitle;
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+@end

+ 17 - 0
jiaPei/ChildSymbolVC.h

@@ -0,0 +1,17 @@
+//
+//  ChildSymbolVC.h
+//  jiaPei
+//
+//  Created by apple on 16/1/5.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface ChildSymbolVC : UIViewController
+
+@property (nonatomic, assign) NSInteger rowTag;
+@property (nonatomic, copy) NSString *MI_TYPE;
+@property (nonatomic, copy) NSString *MI_GROUP;
+
+@end

+ 98 - 0
jiaPei/ChildSymbolVC.m

@@ -0,0 +1,98 @@
+//
+//  ChildSymbolVC.m
+//  jiaPei
+//
+//  Created by apple on 16/1/5.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import "ChildSymbolVC.h"
+#import "symbolCollectionCell.h"
+#import "markInfo.h"
+#import "DB_Que_Helper.h"
+#import "DetailMarkVC.h"
+
+@interface ChildSymbolVC ()<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
+{
+    NSArray *marksArray;
+}
+@end
+
+@implementation ChildSymbolVC
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    self.view.backgroundColor = backGroundColor;
+    [self configNavigationBar];
+    NSArray *titleArray = @[@"禁令标志",@"警告标志",@"指示标志",@"指路标志",@"道路施工安全标志",@"旅游区标志",@"辅助标志",@"禁止标线",@"警告标线",@"指示标线",@"道路安全设施设置",@"汽车仪表盘指示灯",@"新版交警手势",@"车内功能按键",@"交通事故责任认定图解",@"色盲测试图集",];
+    self.title = titleArray[_rowTag];
+    
+    marksArray = [[NSArray alloc] init];
+    marksArray = [DB_Que_Helper queryDetailMark:[NSString stringWithFormat:@"MI_GTOUP = %@ and MI_TYPE = %@",_MI_GROUP,_MI_TYPE]];
+        
+    [self myInit];
+}
+
+-(void)myInit
+{
+    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
+    [layout setScrollDirection:UICollectionViewScrollDirectionVertical];
+    layout.itemSize = SGSizeMake(150, 150);
+    layout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
+    UICollectionView *collection = [[UICollectionView alloc] initWithFrame:kFrame collectionViewLayout:layout];
+    collection.height -= kNavOffSet;
+    collection.dataSource = self;
+    collection.delegate = self;
+    collection.backgroundColor = backGroundColor;
+    
+    
+    [self.view addSubview:collection];
+    
+    [collection registerClass:[symbolCollectionCell class] forCellWithReuseIdentifier:@"cell"];
+}
+
+#pragma mark      collction delegate
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
+{
+    return marksArray.count;
+}
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+    symbolCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
+    markInfo *info = marksArray[indexPath.row];
+    //如果图片名字不对 可以在这里处理
+    if ([info.imageName rangeOfString:@" 1-1-"].location != NSNotFound)
+    {
+        info.imageName = [info.imageName substringFromIndex:1];
+    }
+    cell.image.image = [UIImage imageNamed:info.imageName];
+    cell.nameLabel.text = info.title;
+    return cell;
+}
+-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
+{
+    DetailMarkVC *detail = [[DetailMarkVC alloc] init];
+    detail.dataArray = marksArray;
+    detail.markTag = indexPath.row;
+    [self navPushHideTabbarToVC:detail];
+}
+
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 6 - 0
jiaPei/Colores.xcstickers.xcstickers/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 9 - 0
jiaPei/Colores.xcstickers.xcstickers/Sticker Pack.stickerpack/Contents.json

@@ -0,0 +1,9 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  },
+  "properties" : {
+    "grid-size" : "regular"
+  }
+}

+ 77 - 0
jiaPei/Colores.xcstickers.xcstickers/iMessages App Icon.stickersiconset/Contents.json

@@ -0,0 +1,77 @@
+{
+  "images" : [
+    {
+      "size" : "32x24",
+      "idiom" : "universal",
+      "scale" : "1x",
+      "platform" : "ios"
+    },
+    {
+      "size" : "32x24",
+      "idiom" : "universal",
+      "scale" : "2x",
+      "platform" : "ios"
+    },
+    {
+      "size" : "32x24",
+      "idiom" : "universal",
+      "scale" : "3x",
+      "platform" : "ios"
+    },
+    {
+      "size" : "1024x768",
+      "idiom" : "ios-marketing",
+      "scale" : "1x",
+      "platform" : "ios"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "29x29",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "29x29",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "60x45",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "60x45",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "29x29",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "29x29",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "67x50",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "67x50",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "74x55",
+      "scale" : "2x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 36 - 0
jiaPei/Comment.h

@@ -0,0 +1,36 @@
+/**
+ 它都3种用途。
+ 题目分析。驾校点评。教练点评。
+ 
+ delete
+ 
+ */
+
+#import <Foundation/Foundation.h>
+
+
+@interface Comment : NSObject
+
+/**姓名
+ */
+@property(nonatomic,copy)NSString* comName;
+@property(nonatomic,copy)NSString* comDesc;
+@property(nonatomic,copy)NSString* comDate;
+@property(nonatomic,copy)NSString* comUpNum;
+@property(nonatomic,copy)NSString* comId;
+
++(id)commentWithDict:(NSDictionary*)dict;
+
+@property(assign)CGFloat cellHeight;
+
+@end
+
+
+
+
+
+
+
+
+
+

+ 66 - 0
jiaPei/Comment.m

@@ -0,0 +1,66 @@
+
+
+
+
+
+#import "Comment.h"
+
+#ifndef kSize
+#define kSize [[UIScreen mainScreen]bounds].size
+#endif
+
+@implementation Comment
+
++(id)commentWithDict:(NSDictionary*)dict
+{
+    Comment* com = [[Comment alloc] init];
+    if (com) {
+        
+        /*题目分析    剩下两个找不到(你晚上看看)
+         PHOTO = "";
+         "QC_CRDATE" = "2017-01-23 16:08:44";
+         "QC_DESC" = gdfgfd;
+         "QC_DOWN_NUM" = 0;
+         "QC_ID" = 61;
+         "QC_QID" = 1;
+         "QC_TYPE" = 1;
+         "QC_UP_NUM" = 0;
+         "QC_USER_ID" = 1;
+         */
+        [com setComName:dict[@"QC_NAME"]];
+        [com setComDesc:dict[@"desc"]];
+        [com setComDate:[dict[@"date"] substringToIndex:10]];
+        [com setComUpNum:dict[@"upNum"]];
+        [com setComId:dict[@"id"]];
+        
+        com.cellHeight = 105 + [com.comDesc heightForWid:(kSize.width - 80) Font:15];
+    }
+    return com;
+}
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 91 - 0
jiaPei/CommentCell.h

@@ -0,0 +1,91 @@
+/**
+ 做cell也有一个流程。
+ 先写一个简单的view,填假数据,显示。
+ 创建model,只写一个属性。加载model,并传给cell。显示这个真数据。
+ 接下来,就简单了。
+ 
+ */
+
+#import <UIKit/UIKit.h>
+//#import "Comment.h"
+#import "RDImageView.h"
+
+typedef enum{
+    /**试题分析,没有星星
+     */
+    CommentCellStyleQuestion,
+    /**驾校/教练点评,有星星
+     */
+    CommentCellStyleSchool
+}CommentCellStyle;
+
+@protocol CommentCellDelegate;
+@interface CommentCell : UITableViewCell
+{
+    UIImageView* honorIv;
+    
+    UILabel* celDateLbl;
+    
+    RDImageView* rdImgV;
+    
+    CommentCellStyle cellStyle;
+}
+
+
+@property (nonatomic, copy) NSString *VCName;
+
+/**暂时只有对驾校的评论。教练的是空的。
+ */
+@property(nonatomic,strong)NSDictionary* dict;
+
+/**cell的model
+ */
+//@property(nonatomic,strong)Comment* model;
+
+
+/**
+ 试题评论页面用
+ */
+@property (nonatomic, strong) NSDictionary *commentDic;
+
+
+/**点赞按钮
+ */
+@property(nonatomic,strong)UIButton* upBtn;
+
+@property(assign)id <CommentCellDelegate>delegate2;
+
++(CommentCell*)cellForTableView:(UITableView*)tableView Style:(CommentCellStyle )style;
+
+
+@end
+
+@protocol CommentCellDelegate <NSObject>
+
+-(void)approveComId:(NSString*)comId;
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 262 - 0
jiaPei/CommentCell.m

@@ -0,0 +1,262 @@
+//
+//  CommentCell.m
+//  test12
+//
+//  Created by apple on 15/11/22.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+#import "CommentCell.h"
+#import "UIImageView+WebCache.h"
+
+CommentCellStyle cellStyle;
+
+@implementation CommentCell
+
+- (void)awakeFromNib
+{
+    [super awakeFromNib];
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated
+{
+    [super setSelected:NO animated:animated];
+}
+
+
+-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+    if ([reuseIdentifier isEqualToString:@"school"])
+    {
+        cellStyle = CommentCellStyleSchool;
+    }
+    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+    if (self) {
+        
+        self.imageView.layer.masksToBounds = YES;
+		self.backgroundColor = backGroundColor;
+        UIButton* btn = [[UIButton alloc] init];
+        
+        [btn setImage:[UIImage imageNamed:@"question_approve_checked_icon.png"] forState:UIControlStateSelected];
+        [btn setImage:[UIImage imageNamed:@"question_approve_icon.png"] forState:UIControlStateNormal];
+        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
+        [self.contentView addSubview:btn];
+        [btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
+        _upBtn = btn;
+        [btn.imageView setContentMode:UIViewContentModeScaleAspectFit];
+        
+        UIImageView* iv = [[UIImageView alloc] init];
+        [iv setContentMode:UIViewContentModeScaleAspectFit];
+        [self.contentView addSubview:iv];
+        honorIv = iv;
+        
+        UILabel* lb = [[UILabel alloc] init];
+        [self.contentView addSubview:lb];
+        [lb setTextColor:contentTextColor];
+        celDateLbl = lb;
+        
+        [celDateLbl setFont:[UIFont scaleSize:12]];
+        [self.textLabel setTextColor:kTitleColor];
+        [self.detailTextLabel setTextColor:subTitleColor];
+        
+    }
+    
+    [self setSelectionStyle:UITableViewCellSelectionStyleNone];
+    return self;
+}
+
++(CommentCell*)cellForTableView:(UITableView*)tableView Style:(CommentCellStyle )style
+{
+    cellStyle = style;
+    NSString* cellid;
+    /**如果2个风格的cell,需要区分,可以在这设置
+     */
+    if (CommentCellStyleQuestion == style) {
+        cellid= @"CommentCellIdentifier";
+    }else{
+        cellid= @"CommentCellIdentifier";
+    }
+    
+    CommentCell* cell = [tableView dequeueReusableCellWithIdentifier:cellid];
+    if (!cell) {
+        cell = [[CommentCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellid];
+        [cell setBackgroundColor:backGroundColor];
+    }
+    return cell;
+}
+
+-(void)setCommentDic:(NSDictionary *)commentDic
+{
+    _commentDic = commentDic;
+    
+    [self.imageView sd_setImageWithURL:[NSURL URLWithString:commentDic[@"PHOTO"]] placeholderImage:randomPortrait()];
+    [self.textLabel setText:commentDic[@"QC_NAME"]];
+    [self.detailTextLabel setText:commentDic[@"QC_DESC"]];
+    [_upBtn setTitle:commentDic[@"QC_UP_NUM"] forState:UIControlStateNormal];
+    [_upBtn setSelected:NO];
+    
+    NSString* str = commentDic[@"QC_CRDATE"];
+    if (str && str.length >16) {
+        [celDateLbl setText:[str substringToIndex:16]];
+    }else{
+        [celDateLbl setText:str];
+    }
+}
+
+-(void)setDict:(NSDictionary *)dict
+{
+    _dict = dict;
+    [_upBtn setTitle:dict[@"POINTNUM"] forState:UIControlStateNormal];
+    [_upBtn setSelected:NO];
+    self.imageView.contentMode    = UIViewContentModeScaleAspectFit;
+    self.imageView.clipsToBounds  = YES;
+    if (![dict[@"NAME"] isEqualToString:@""] && ![dict[@"NAME"] isEqualToString:@"暂无相关点评~"])
+    {
+        _upBtn.hidden = NO;
+        NSString *path = [Tools imageStringWithPhotoString:dict[@"PHOTO"] HeadImgString:dict[@"HEADIMG"] Type:2];
+        if (path.length < 1) {
+            path = nil;
+        }
+        
+        [self.imageView sd_setImageWithURL:[NSURL URLWithString:path] placeholderImage:[UIImage imageNamed:[NSString stringWithFormat:@"portrait%d.png",arc4random()%10 + 1]]];
+    }else{
+        _upBtn.hidden = YES;
+    }
+    [self.textLabel setText:dict[@"NAME"]];
+	[self.detailTextLabel setText:[dict[@"PJCONTENT"] isEqualToString:@""]? @"点评内容为空" : dict[@"PJCONTENT"] ];
+    
+    NSString* str = dict[@"PJSJ"];
+    if (str && str.length >11) {
+        [celDateLbl setText:[str substringToIndex:11]];
+    }else{
+        [celDateLbl setText:str];
+    }
+}
+
+/**每次cell重用时,这里都会调用一次。
+ 切记不要再这里创建视图。
+ */
+-(void)layoutSubviews
+{
+    [super layoutSubviews];
+    
+    CGFloat font =  15;
+    [self.detailTextLabel setNumberOfLines:0];
+    [self.detailTextLabel setFont:[UIFont scaleSize:font]];
+    
+    CGFloat aWid = self.width;
+    CGFloat x,w,h,y,bd;
+    x = 5;
+    w = h = 55;
+    y = bd = 10;
+    [self.imageView setFrame:CGRectMake(x, y, w, h)];
+    self.imageView.layer.cornerRadius = h/2.0;
+    
+    if (cellStyle == CommentCellStyleQuestion)
+    {
+        y += bd;
+        x = x + w + bd;
+        h = 25;
+        [self.textLabel setFrame:CGRectMake(x, y, 260, h)];
+        
+        y = y + h + bd;
+        w = aWid - x - bd;
+        h = [self.detailTextLabel.text heightForWid:w Font:font];
+        //现在主要是根据desc的内容动态设置宽高了
+        [self.detailTextLabel setFrame:CGRectMake(x, y, w, h)];
+        
+        y = y+h+bd;
+        h = 30;
+        [celDateLbl setFrame:CGRectMake(x, y, 260, h)];
+        [_upBtn setFrame:CGRectMake(aWid - 100, y, 100, h)];
+        [honorIv setFrame:CGRectMake(aWid - 55, 5, 55, 55)];
+    }else{
+        y += bd;
+        x = x + w + bd;
+        h = 25;
+        [self.textLabel setFrame:CGRectMake(x, y, 180, h)];
+        
+        y = y + h + bd;
+        w = aWid - x - bd;
+        h = [self.detailTextLabel.text heightForWid:w Font:font];
+        if (h < 40)
+        {
+            h = 40;
+        }
+        //现在主要是根据desc的内容动态设置宽高了
+        [self.detailTextLabel setFrame:CGRectMake(x, y, w, h)];
+        
+        y = y+h+bd;
+        h = 30;
+        [celDateLbl setFrame:CGRectMake(x, y, 260, h)];
+        [_upBtn setFrame:CGRectMake(aWid - 100, y, 100, h)];
+        [honorIv setFrame:CGRectMake(aWid - 55, 5, 55, 55)];
+    }
+}
+
+-(void)btnClick:(UIButton*)sender
+{
+    if ([_VCName isEqualToString:@"SearchComment"]) {
+        //代表是驾校的页面
+        return;
+    }
+    [self UpLoadApproveComId];
+}
+
+
+- (void)UpLoadApproveComId
+{
+    if (![Util connectedToNetWork]) {
+        showMsgUnconnect();
+        return;
+    }
+    
+    NSMutableArray *arr=[NSMutableArray array];
+    NSString *comId = _commentDic ? _commentDic[@"QC_ID"] : _dict[@"ID"];
+    
+    [arr property:comId forKey:@"cid"];
+    [arr property:@"1" forKey:@"type"];
+    if (myDelegate.isLogin) {
+        [arr property:RQ_USER_MANAGER.currentUser._id forKey:@"userId"];
+    }else{
+        [arr property:@"匿名用户" forKey:@"userId"];
+    }
+    NSString* method = @"updateQuestionUpOrDown";
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
+        
+        RemoveHUD();
+        if (!dict) {
+            ShowMsg(@"操作失败");
+            return;
+        }
+        if ( [dict[@"code"] isEqualToString:@"1"]) {
+            ShowMsg(dict[@"body"]);
+            [_upBtn setSelected:YES];
+            return;
+        }
+        if ( [dict[@"code"] isEqualToString:@"0"]) {
+            [LoadingView showMsg:@"点赞成功" Style:1];
+        }
+        
+        NSString *comUpNum = _commentDic ? _commentDic[@"QC_UP_NUM"] : _dict[@"POINTNUM"];
+        
+        comUpNum = [NSString stringWithFormat:@"%d",comUpNum.intValue+1];
+        [_upBtn setTitle:comUpNum forState:UIControlStateNormal];
+        [_upBtn setSelected:YES];
+    }];
+}
+
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+

+ 56 - 0
jiaPei/DateView.h

@@ -0,0 +1,56 @@
+//
+//  DateView.h
+//  jiaPeiC
+//
+//  Created by apple on 15/12/20.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//  danson
+
+#import <UIKit/UIKit.h>
+
+
+@interface DateView : UIView
+{
+    UIDatePicker* picker;
+    MyBlockType complete;
+    
+    NSDate* max,*min;
+}
+
+/**Require
+ 0选择日期。
+ 1选择时间。
+ */
+@property(nonatomic,assign)int style;
+
+-(void)showWithComplete:(MyBlockType) comp;
+
+/**
+ */
+-(void)setMaxDate:(NSDate*)max MinDate:(NSDate*)min;
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 176 - 0
jiaPei/DateView.m

@@ -0,0 +1,176 @@
+
+
+#import "DateView.h"
+
+@implementation DateView
+
+-(instancetype)init
+{
+    self = [super initWithFrame:kFrame];
+    if (self) {
+        [self setBackgroundColor:[UIColor colorWithWhite:.01 alpha:.3]];
+        CGFloat x,y,w,h,bd;
+        
+        x = bd = 10;
+        y = 0;
+        w = kSize.width - bd*2;
+        h = 300;
+        
+        UIView* aView;
+        aView = [[UIView alloc] initWithFrame:CGRectMake(x, y, w, h)];
+        [aView setBackgroundColor:backGroundColor];
+        aView.center = CGPointMake(kSize.width/2.0, kSize.height/2.0);
+        [self addSubview:aView];
+        
+        UILabel* label;
+        x = bd;
+        h = 40;
+        w = aView.width - bd*2;
+        label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w , h)];
+        [label setText:@"请选择时间"];
+        [label setTextAlignment:NSTextAlignmentCenter];
+        [aView addSubview:label];
+        
+        UIView* line;
+        y += h;
+        h = 3;
+        x = bd;
+        line = [[UIView alloc] initWithFrame:CGRectMake(x, y, w, h)];
+        [aView addSubview:line];
+        [line setBackgroundColor:RQ_MAIN_COLOR];
+        
+        y += h;
+        h = 200;
+        picker = [[UIDatePicker alloc] initWithFrame:CGRectMake(x, y, w , h)];
+        [picker setDatePickerMode:UIDatePickerModeDate];
+		if (@available(iOS 13.4, *)) {
+			picker.preferredDatePickerStyle = UIDatePickerStyleWheels;
+		} else {
+			// Fallback on earlier versions
+		}
+        [aView addSubview:picker];
+        
+        
+        x = 60;
+        y += h + bd;
+        w = (kSize.width- bd*2 - 60*3)/2.0;
+        h = aView.height - y - bd;
+        
+        UIButton* btn;
+        btn = [[UIButton alloc] initWithFrame:CGRectMake(x, y, w, h)];
+        [btn setTitle:@"取消" forState:UIControlStateNormal];
+        [btn setBackgroundColor:RQ_MAIN_COLOR];
+        [btn addTarget:self action:@selector(removeFromSuperview) forControlEvents:UIControlEventTouchUpInside];
+        [aView addSubview:btn];
+        btn.layer.cornerRadius = btn.height*.5;
+        btn.layer.masksToBounds = YES;
+        
+        x += w+60;
+        btn = [[UIButton alloc] initWithFrame:CGRectMake(x, y, w, h)];
+        [btn setTitle:@"确定" forState:UIControlStateNormal];
+        [btn addTarget:self action:@selector(yesClick) forControlEvents:UIControlEventTouchUpInside];
+        [btn setBackgroundColor:RQ_MAIN_COLOR];
+        [aView addSubview:btn];
+        btn.layer.cornerRadius = btn.height*.5;
+        btn.layer.masksToBounds = YES;
+    }
+    return self;
+}
+
+-(void)setStyle:(int)style
+{
+    _style = style;
+    NSDateFormatter  * formatter = [[ NSDateFormatter   alloc ] init ];
+    NSString  * mindateStr ;
+    NSString  * maxdateStr;
+    if (0 == _style || 2 == _style) {
+        [picker setDatePickerMode:UIDatePickerModeDate];
+        [formatter  setDateFormat : @"yyyy"];
+        int year = [formatter stringFromDate:[NSDate date]].intValue;
+        [formatter  setDateFormat : @"yyyy-MM-dd"];
+        mindateStr =  [NSString stringWithFormat:@"%d-01-01",year];
+        maxdateStr =  [NSString stringWithFormat:@"%d-12-31",year + 2];
+    }
+    if (1 == _style) {
+        [picker setDatePickerMode:UIDatePickerModeTime];
+    }
+    
+    if (3 == _style) {
+        [picker setDatePickerMode:UIDatePickerModeTime];
+        //这个是设置分钟轮上面时间间隔的
+        picker.minuteInterval = 30;
+    }
+    
+    NSDate  * minDate = [formatter  dateFromString :mindateStr];
+    NSDate  * maxDate = [formatter  dateFromString :maxdateStr];
+    
+    if (maxDate) {
+        picker.minimumDate = min;
+        picker.maximumDate = max;
+    }else{
+        picker.minimumDate = minDate;
+        picker.maximumDate = maxDate;
+    }
+}
+
+-(void)setMaxDate:(NSDate *)maxDate MinDate:(NSDate *)minDate
+{
+    max = maxDate;
+    min = minDate;
+}
+
+-(void)yesClick
+{
+    if (complete) {
+        NSDateFormatter* fm = [NSDateFormatter new];
+        fm.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
+        if (0 == _style) {
+            [fm setDateFormat:@"yyyy-MM-dd"];
+        }else if (1 == _style || 3 == _style){
+            [fm setDateFormat:@"HH:mm"];
+        }else if (2 == _style) {
+            [fm setDateFormat:@"EEE yyyy-MM-dd"];
+        }
+        complete([fm stringFromDate:picker.date]);
+        [self removeFromSuperview];
+    }
+}
+
+-(void)showWithComplete:(MyBlockType)comp
+{
+    complete = comp;
+    [[UIApplication sharedApplication].keyWindow addSubview:self];
+}
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 19 - 0
jiaPei/DetailMarkCell.h

@@ -0,0 +1,19 @@
+//
+//  DetailMarkCell.h
+//  jiaPei
+//
+//  Created by apple on 16/1/13.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface DetailMarkCell : UICollectionViewCell
+
+@property (nonatomic, retain) UIImageView *imgView;
+@property (nonatomic, retain) UILabel *titleLabel;
+@property (nonatomic, retain) UILabel *detailLabel;
+
+-(instancetype)initWithFrame:(CGRect)frame;
+
+@end

+ 42 - 0
jiaPei/DetailMarkCell.m

@@ -0,0 +1,42 @@
+//
+//  DetailMarkCell.m
+//  jiaPei
+//
+//  Created by apple on 16/1/13.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import "DetailMarkCell.h"
+
+@implementation DetailMarkCell
+
+-(instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self)
+    {
+        self.backgroundColor = backGroundColor;
+        
+        CGFloat width = self.frame.size.width;
+        CGFloat hight = self.frame.size.height/2.0;
+        
+        _imgView = [[UIImageView alloc] initWithFrame:CGRectMake((width - hight + 30)/2, 30, hight - 30, hight - 30)];
+        [self addSubview:_imgView];
+        
+        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, hight + 20, width, 30)];
+        [_titleLabel setTextAlignment:NSTextAlignmentCenter];
+        [_titleLabel setFont: [UIFont scaleSize:20]];
+        [_titleLabel setNumberOfLines:0];
+        [self addSubview:_titleLabel];
+        
+        _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, hight + 50, width - 20, hight - 50)];
+        [_detailLabel setFont:[UIFont scaleSize:14]];
+        [_detailLabel setNumberOfLines:0];
+        [self addSubview:_detailLabel];
+        
+        
+    }
+    return self;
+}
+
+@end

+ 20 - 0
jiaPei/DetailMarkVC.h

@@ -0,0 +1,20 @@
+//
+//  DetailMarkVC.h
+//  jiaPei
+//
+//  Created by apple on 16/1/13.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+/**是滑动collectionView 展示标志详情 不过有一个问题 就是不能直接到想看的页面 想想怎么解决(已解决)
+ */
+
+@interface DetailMarkVC : UIViewController
+
+@property (nonatomic, retain) NSArray *dataArray;
+
+@property (nonatomic, assign) NSInteger markTag;
+
+@end

+ 87 - 0
jiaPei/DetailMarkVC.m

@@ -0,0 +1,87 @@
+//
+//  DetailMarkVC.m
+//  jiaPei
+//
+//  Created by apple on 16/1/13.
+//  Copyright © 2016年 JCZ. All rights reserved.
+//
+
+#import "DetailMarkVC.h"
+#import "markInfo.h"
+#import "RGCardViewLayout.h"
+#import "DetailMarkCell.h"
+
+@interface DetailMarkVC ()<UICollectionViewDataSource,UICollectionViewDelegate>
+{
+    NSArray *marksArray;
+    UICollectionView *collection;
+    RGCardViewLayout *layout;
+}
+@end
+
+@implementation DetailMarkVC
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    self.view.backgroundColor = backGroundColor;
+    [self configNavigationBar];
+    self.title = @"标志详情";
+    marksArray = [NSArray arrayWithArray:_dataArray];
+    myDelegate.layoutIndex = _markTag;
+    
+    [self myInit];
+}
+
+-(void)myInit
+{
+    layout = [[RGCardViewLayout alloc] init];
+    [layout setScrollDirection:UICollectionViewScrollDirectionVertical];
+    CGFloat width = kFrame.size.width - 30;
+    CGFloat hight = kFrame.size.height - 100;
+    [layout setItemSize:CGSizeMake(width, hight)];
+    [layout setSectionInset:UIEdgeInsetsMake(30, 15, 30, 15)];
+    layout.isCan = YES;
+    
+    collection = [[UICollectionView alloc] initWithFrame:kFrame collectionViewLayout:layout];
+    collection.delegate = self;
+    collection.dataSource = self;
+    collection.backgroundColor = backGroundColor;
+    [collection setPagingEnabled:YES];
+    
+    [self.view addSubview:collection];
+    [collection registerClass:[DetailMarkCell class] forCellWithReuseIdentifier:@"detailCell"];
+	[collection scrollToItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:_markTag] atScrollPosition:(UICollectionViewScrollPositionCenteredHorizontally) animated:false];
+}
+
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
+{
+    return 1;
+}
+
+- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
+{
+    return  marksArray.count;
+}
+-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+    DetailMarkCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"detailCell" forIndexPath:indexPath];
+    
+    for (int i = 0; i < marksArray.count; i++)
+    {
+        markInfo *info = marksArray[indexPath.section];
+        cell.imgView.image = [UIImage imageNamed:info.imageName];
+        cell.titleLabel.text = info.title;
+        cell.detailLabel.text = info.detail;
+    }
+    return cell;
+}
+
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+
+@end

+ 145 - 0
jiaPei/ENUM.h

@@ -0,0 +1,145 @@
+//
+//  ENUM.h
+//  jiaPei
+//
+//  Created by apple on 15/11/4.
+//  Copyright (c) 2015年 JCZ. All rights reserved.
+//
+
+/**其实我可以专门写一个类。又有enum。还有许多属性可以共享。
+ */
+#ifndef jiaPei_ENUM_h
+#define jiaPei_ENUM_h
+
+//defaultWebServiceUrl2是测试服务器 defaultWebServiceUrl是服务器
+//学员端请求
+#define defaultHttp isOfficial?  @"http://fj.jppt.com.cn/" : @"http://192.168.8.87:8080/xm"
+#define anotherDefaultHttp isOfficial?  @"https://zzjs.zzxcx.net" : @"http://192.168.8.87:8080"
+
+
+//基础请求
+#define defaultHttpUrl isOfficial? @"appservice/student/" : @"appservice2/student/"
+#define anotherDefaultHttpUrl isOfficial? @"/zzjs-admin" : @"/zzjs-admin"
+
+//上传资源
+#define defaultUploadUrl isOfficial? @"appservice/fileupload/" : @"appservice2/fileupload/"
+
+//实操计时相关
+#define defaultTrainUrl isOfficial? @"appservice/train/" : @"appservice2/train/"
+
+//公共类的请求
+#define defaultCommonUrl isOfficial? @"appservice/common/" : @"appservice2/common/"
+
+//模拟计时签到和模拟机交互
+#define defaultImitateUrl1 isOfficial? @"appservice/simulator/" : @"appservice2/simulator/"
+
+//模拟计时 预约订单
+#define defaultImitateUrl2 isOfficial? @"appservice/simulate/" : @"appservice2/simulate/"
+
+//远程理论
+#define defaultEducation isOfficial? @"appservice/education/" : @"appservice2/education/"
+
+
+//#define defaultWebServiceNameSpace @"http://impl.webservice.core.miaxis.com"
+
+/**夜间模式,设置后,要保存在userDefault里面。用这个key来存取。
+ 0表示关闭夜间模式,1表示开启。
+ */
+#define nightModeKey @"nightMode"
+
+
+/**topUp
+ */
+//测试的通知地址:    http://218.6.66.181:9999/jxglpt/admin/alipay/rechargeNotify
+//服务器通知地址:    http://fj.jppt.com.cn/jxglpt/admin/alipay/rechargeNotify
+#define topUpNotify  @"http://fj.jppt.com.cn/jxglpt/admin/alipay/rechargeNotify"//服务器通知地址
+
+
+
+/**aliPay
+ */
+//测试的通知地址:    http://218.6.66.181:9999/jxglpt/admin/alipay/appNotify
+//服务器通知地址:    http://fj.jppt.com.cn/jxglpt/admin/alipay/appNotify
+#define aliPayNotify  @"http://fj.jppt.com.cn/jxglpt/admin/alipay/appNotify"//服务器通知地址
+
+
+#define aliPayScheme  @"JSJPStudentAlipay" // 支付宝回调串
+
+#define aliPartner    @"2088221650448244" //合作身份者id,以2088开头的16位纯数字(客户给)
+
+#define aliSeller     @"2088221650448244" //收款支付宝账号
+
+#define aliPrivateKey @"MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKuaMzMc8J2Mrf4bb28I3rp5NcddxLuG2NVmb0w/h+HZz0lRFyuTstSPqcceMq6fuCTvZBF7SBya23mvafBPsVdsYwN9nU+Z7pZoc4FrafzoS98kvJM54Y4MI2r+ZwrUglyIGTzqvxuGO24gKnDRsNregXgMuOvoBKjLvsIar7sdAgMBAAECgYAKNN+6uIvvMwDeTk9wcTyeJrt2IjOjW7/l4XPZOyYf3s6fc71HED/guLLGbxtgm4teVwbCq2x8lxFayX4plvPbQFhhdbNn9YtqoYcw3YBjt3IoOrtSHb9ReIez1DbpJ7AzkqIC2ZW4APZ/e0HZ7U4JpgfZudsc6mX6PMX2/3EgwQJBANrMNXXa4B/huWnClFc3iMNaZxLtN7pi5fQeelELYQCbEPWRpnpBKn2tMd4Bps7M79/huwbxGGKmwaW5AlOOeMUCQQDIx635x5SWEZSPL+pGa+ecesAfPLc9udCw1TyaQ4lYWJEh/ZLJxa9x/wkMWZLEw6y7Aw3z/kkcXCdUPoHR5G55AkBLBFUYEXFivPvbXRGLTckgYbCRdq/ywdHh/0kk3Gfn00LfT47qv8kXyfgdDCfrI6zi7/w2Bxe7Sz192o8HowOZAkBAMR8dYcLOq/Y8RUx4kV0ueUxdcFMBiBwBvVsv0vHhbgeQv3qjyfFK2Agzi5vSDuF1tQdL//ut9oSYeZeV3Ju5AkEAgXBg3lsx8/rv4OUaB4tKMAk3xR8zoIHLnwl5jfBzD97nx3W11qEHRPfen90++9OWE9lLxvYkV1yHKDiFjS9QJw==" // 密钥
+
+//通知的名字及参数
+#define ALI_PAY_RESULT      @"Ali_pay_result_isSuccessed"
+#define ALIPAY_SUCCESSED    @"Ali_pay_isSuccessed"
+#define ALIPAY_FAILED       @"Ali_pay_isFailed"
+
+
+/**
+ 这个是表示资格证的判断条件
+ */
+
+/**从userDefaul里面存取题库名称的key,不是C1A1这些。而是小车,客车,货车等
+ 由userInfo负责,读写等操作。
+ */
+#define quesLibNameKey @"questionLibraryName"
+
+/**这里添加一个背题模式好了。把加强的去掉,换成背题。
+ 所谓背题,就是直接选择正确答案,然后显示解释
+ */
+typedef NS_ENUM(NSInteger, QuestionType) {
+    QuestionTypeOrdered = 1,
+    QuestionTypeRandom,
+    QuestionTypeChapt,
+    QuestionTypeFault,
+    //强化模式5
+    QuestionTypeStrenth,
+    QuestionTypeUndo,
+    QuestionTypeFavorite,
+    //背题模式
+    QuestionTypeRecite,
+    QuestionTypeExam,
+    QuestionTypeNotDo,
+    QuestionTypeNewRule
+};
+
+typedef NS_ENUM(NSInteger, CorrectType){
+    CorrectTypeFault = 0,
+    CorrectTypeUndo,
+    CorrectTypeRignt
+};
+
+/**其实可以用C的枚举类型。
+ */
+typedef enum{
+    aadf = 1
+}GALSKFJIEJFLKJSALDKJF;
+
+
+typedef void (^MyBlockType)(id);
+
+
+typedef void (^BlockTypeVo)(void);
+
+
+#define TICK   NSDate *startTime = [NSDate date]
+
+#define TOCK   NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])
+
+/**这里稍微修改,就可以实现全局显示时间点。
+ */
+
+
+#endif
+
+
+
+
+
+
+
+
+
+

+ 19 - 0
jiaPei/EquipmentDetailVC.h

@@ -0,0 +1,19 @@
+//
+//  EquipmentDetailVC.h
+//  jiaPei
+//
+//  Created by apple on 2017/5/10.
+//  Copyright © 2017年 JCZ. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface EquipmentDetailVC : UIViewController
+
+@property (nonatomic, copy) NSString *imiAppoint;
+
+@property (nonatomic, copy) NSString *quotaId;
+
+@property (nonatomic, copy) NSDictionary *devDic;
+
+@end

+ 434 - 0
jiaPei/EquipmentDetailVC.m

@@ -0,0 +1,434 @@
+//
+//  EquipmentDetailVC.m
+//  jiaPei
+//
+//  Created by apple on 2017/5/10.
+//  Copyright © 2017年 JCZ. All rights reserved.
+//
+
+#import "EquipmentDetailVC.h"
+#import "DateView.h"
+
+
+@interface EquipmentDetailVC ()<UITableViewDelegate,UITableViewDataSource>
+{
+    UILabel      *priceLabel;
+    UITableView  *mainTableView;
+    UILabel      *noReserveLabel;
+    UIButton     *beginBtn, *endBtn;
+    UIButton     *discountBtn;
+    
+    NSArray      *dataArray;
+    NSString     *beginTime, *endTime;
+    CGFloat      price;
+    BOOL         isUseDisCount;
+}
+@end
+
+@implementation EquipmentDetailVC
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    self.title = [NSString stringWithFormat:@"  模拟设备%@",_devDic[@"CODE"]];
+    self.view.backgroundColor = backGroundColor;
+    [self configNavigationBar];
+    
+    
+    isUseDisCount = NO;
+    beginTime = endTime = @"";
+    dataArray = [NSArray array];
+    
+    CGFloat x,y,w,h,bd;
+    
+    x = y = bd = 10;
+    w = kSize.width - 2*x;
+    h = 40;
+    UILabel *label = [[UILabel alloc] setxywh];
+    label.backgroundColor = backGroundColor;
+    [label borderColor:RQlineColor width:1 cornorRadius:5];
+    [label setText:[NSString stringWithFormat:@"  训练点:%@",_imiAppoint] Font:Font17 TextColor:kTitleColor];
+    [self.view addSubview:label];
+    
+    y += h + bd;
+    h = 90;
+    label = [[UILabel alloc] setxywh];
+    label.backgroundColor = backGroundColor;
+    [label borderColor:RQlineColor width:1 cornorRadius:5];
+    label.numberOfLines = 3;
+    [label setText:@"  培训日期:\n  开放时间:\n  培训价格:" Font:Font17 TextColor:kTitleColor];
+    [self.view addSubview:label];
+    priceLabel = label;
+    
+    y += h + bd;
+    h = 30;
+    label = [[UILabel alloc] setxywh];
+    [label setText:@"  已约时段:" Font:Font17 TextColor:kTitleColor];
+    [self.view addSubview:label];
+    
+    y += h + bd/2.0;
+    h = kSize.height - y - kNavOffSet - 200;
+    mainTableView = [[UITableView alloc] initWithFrame:setDIYFrame style:UITableViewStylePlain];
+    mainTableView.backgroundColor = backGroundColor;
+    [mainTableView borderColor:RQlineColor width:1 cornorRadius:5];
+    mainTableView.delegate = self;
+    mainTableView.dataSource = self;
+    [self.view addSubview:mainTableView];
+    
+    [mainTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
+    
+    
+    //如果有预约就隐藏
+    label = [[UILabel alloc] setxywh];
+    label.x += 10;
+    label.y += 10;
+    label.width -= 20;
+    label.height = 50;
+    label.numberOfLines = 0;
+    [label setText:@"恭喜您,该设备还没有任何预约!" Font:FontTitle TextColor:[UIColor orangeColor]];
+    [self.view addSubview:label];
+    noReserveLabel = label;
+    
+    //200 的尺寸 需要 选择时间  是否优惠 预约按钮  20+30 + 20+60+20 + 50
+    NSString *labelString = @"  选择时段:";
+    w = [labelString sizeForFont:Font17].width;
+    y += h + 2*bd;
+    h = 30;
+    label = [[UILabel alloc] setxywh];
+    [label setText:labelString Font:Font17 TextColor:kTitleColor];
+    [self.view addSubview:label];
+    
+    x += w + bd;
+    w = (kSize.width - x - bd - 30)/2.0;
+    UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
+    btn.frame = setDIYFrame;
+    [btn setTitle:@"开始时间" textColor:RQ_MAIN_COLOR Font:Font17 fotState:UIControlStateNormal];
+    [btn borderColor:RQ_MAIN_COLOR width:1 cornorRadius:5];
+    [btn target:self tag:1];
+    [self.view addSubview:btn];
+    beginBtn = btn;
+    
+    x += w + 30;
+    btn = [UIButton buttonWithType:UIButtonTypeSystem];
+    btn.frame = setDIYFrame;
+    [btn setTitle:@"结束时间" textColor:RQ_MAIN_COLOR Font:Font17 fotState:UIControlStateNormal];
+    [btn borderColor:RQ_MAIN_COLOR width:1 cornorRadius:5];
+    [btn target:self tag:2];
+    [self.view addSubview:btn];
+    endBtn = btn;
+    
+    x -= 25;
+    w = 2 * bd;
+    label = [[UILabel alloc] setxywh];
+    [label setText:@"--" Font:Font17 TextColor:kTitleColor Alignment:NSTextAlignmentCenter];
+    [self.view addSubview:label];
+    
+    
+    //优惠
+    x = bd;
+    y += h + 2*bd;
+    w = kSize.width - 2*x;
+    h = 40;
+    btn = [[UIButton alloc] setxywh];
+    btn.titleLabel.numberOfLines = 0;
+    [btn setTitle:@"暂无可用优惠券" textColor:contentTextColor Font:Font17 fotState:UIControlStateNormal];
+    [btn borderColor:contentTextColor width:1 cornorRadius:5];
+    [btn target:self tag:3];
+    [self.view addSubview:btn];
+    btn.userInteractionEnabled = NO;
+    discountBtn = btn;
+    
+    
+    //预约按钮
+    x = 0;
+    w += 2*bd;
+    y += 60 + 2*bd;
+    h = 50;
+    btn = [[UIButton alloc] setxywh];
+    btn.backgroundColor = backGroundColor;
+    [btn setTitle:@"我要预约" textColor:RQ_MAIN_COLOR Font:FontTitle fotState:UIControlStateNormal];
+    [btn target:self tag:4];
+    [self.view addSubview:btn];
+    
+    
+    [self getReserveMnByDevId];
+}
+
+- (void)btnClick:(UIButton *)sender {
+    
+    if (sender.tag == 1) {
+        DateView *dateV = [[DateView alloc] init];
+        [dateV setStyle:3];
+        [dateV showWithComplete:^(NSString * result) {
+            
+            beginTime = result;
+            [beginBtn setTitle:beginTime forState:UIControlStateNormal];
+        }];
+    }
+    
+    if (sender.tag == 2) {
+        DateView *dateV = [[DateView alloc] init];
+        [dateV setStyle:3];
+        [dateV showWithComplete:^(NSString * result) {
+            
+            endTime = result;
+            [endBtn setTitle:endTime forState:UIControlStateNormal];
+        }];
+    }
+    
+    if (sender.tag == 3) {
+        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"是否使用优惠券?" message:nil preferredStyle:UIAlertControllerStyleAlert];
+        
+        UIAlertAction *noAction = [UIAlertAction actionWithTitle:@"不使用" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            isUseDisCount = NO;
+            [discountBtn setTitle:@"您有免费半小时优惠券,点击使用" forState:UIControlStateNormal];
+        }];
+        
+        UIAlertAction *yesAction = [UIAlertAction actionWithTitle:@"使用" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            isUseDisCount = YES;
+            [discountBtn setTitle:@"已选择使用免费半小时优惠券,请选择时长为半小时的时间段" forState:UIControlStateNormal];
+        }];
+        
+        [alert addAction:noAction];
+        [alert addAction:yesAction];
+        
+        [self presentViewController:alert animated:NO completion:nil];
+    }
+    
+    if (sender.tag == 4) {
+        if (![self isValueTime]) {
+            return;
+        }
+        
+        if (isUseDisCount) {
+            if (![self isHalfOfHour]) {
+                return;
+            }
+        }
+        
+        [self uploadReserveMn];
+    }
+}
+
+- (BOOL)isValueTime {
+    
+    if (beginTime.length < 1) {
+        ShowMsg(@"请选择开始时间");
+        return NO;
+    }
+    if (endTime.length < 1) {
+        ShowMsg(@"请选择结束时间");
+        return NO;
+    }
+    
+    if ([beginTime isEqualToString:endTime]) {
+        ShowMsg(@"开始时间不能等于结束时间");
+        return NO;
+    }
+    
+    NSString *beginHou = [[beginTime componentsSeparatedByString:@":"] firstObject];
+    NSString *beginMin = [[beginTime componentsSeparatedByString:@":"] lastObject];
+    
+    NSString *endHou = [[endTime componentsSeparatedByString:@":"] firstObject];
+    NSString *endMin = [[endTime componentsSeparatedByString:@":"] lastObject];
+    
+    if (beginHou.integerValue > endHou.integerValue) {
+        ShowMsg(@"开始时间不能大于结束时间");
+        return NO;
+    }
+    
+    
+    if (beginHou.integerValue == endHou.integerValue) {
+        if (beginMin.integerValue > endMin.integerValue) {
+            ShowMsg(@"开始时间不能大于结束时间");
+            return NO;
+        }
+    }
+    
+    return YES;
+}
+
+- (BOOL)isHalfOfHour {
+    
+    NSString *beginHou = [[beginTime componentsSeparatedByString:@":"] firstObject];
+    NSString *beginMin = [[beginTime componentsSeparatedByString:@":"] lastObject];
+    
+    NSString *endHou = [[endTime componentsSeparatedByString:@":"] firstObject];
+    NSString *endMin = [[endTime componentsSeparatedByString:@":"] lastObject];
+    
+    if (endHou.integerValue - beginHou.integerValue > 1) {
+        return NO;
+    }
+    
+    if (![beginHou isEqualToString:endHou] && [beginMin isEqualToString:endMin]) {
+        return NO;
+    }
+    
+    return YES;
+}
+
+#pragma mark     tableView
+-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return dataArray.count;
+}
+
+-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
+    if (cell == nil) {
+        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
+        cell.selectionStyle = UITableViewCellSelectionStyleNone;
+        cell.textLabel.textAlignment = NSTextAlignmentCenter;
+    }
+    
+    NSDictionary *dic = dataArray[indexPath.row];
+    cell.textLabel.text = [NSString stringWithFormat:@"%@--%@  %@",dic[@"startTime"],dic[@"endTime"],dic[@"userName"]];
+    return cell;
+}
+
+-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
+    return [UIView new];
+}
+
+-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
+    return .1;
+}
+
+#pragma mark    数据请求
+- (void)getReserveMnByDevId {
+    
+    [LoadingView showHUD];
+    if (![Util connectedToNetWork]) {
+        showMsgUnconnect();
+        return;
+    }
+    
+    NSMutableArray *arr=[NSMutableArray array];
+    [arr addPro:@"dqbh"         Value:RQ_USER_MANAGER.currentUser.city];
+    [arr addPro:@"devId"        Value:_devDic[@"ID"]];
+    [arr addPro:@"quotaId"      Value:_quotaId];
+    
+    NSString* method = @"getReserveMnByDevId";
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
+        
+        RemoveHUD();
+//        NSLog(@"getReserveMnByDevId--><>%@",root);
+        if (!root) {
+            return;
+        }
+        
+        if ([root[@"code"] intValue] == 1) {
+            ShowMsg(root[@"body"]);
+            return;
+        }
+        
+        
+        price = [[root[@"body"] objectForKey:@"price"] floatValue];
+        if ([[root[@"body"] objectForKey:@"price"] floatValue] > 0.0) {
+            
+            priceLabel.text = [NSString stringWithFormat:@"  培训日期:%@\n  开放时间:%@-%@\n  培训价格:%@元",[root[@"body"] objectForKey:@"PXRQ"],[root[@"body"] objectForKey:@"STARTTIME"],[root[@"body"] objectForKey:@"ENDTIME"],[root[@"body"] objectForKey:@"price"]];
+            [self getDiscountHalfHour];
+        }else {
+            priceLabel.text = [NSString stringWithFormat:@"  培训日期:%@\n\n  开放时间:%@-%@",[root[@"body"] objectForKey:@"PXRQ"],[root[@"body"] objectForKey:@"STARTTIME"],[root[@"body"] objectForKey:@"ENDTIME"]];
+        }
+        
+        
+        dataArray = [root[@"body"] objectForKey:@"rmlist"];
+        
+        if (dataArray.count > 0) {
+            noReserveLabel.hidden = YES;
+        }else {
+            noReserveLabel.hidden = NO;
+        }
+        [mainTableView reloadData];
+    }];
+}
+
+- (void)getDiscountHalfHour {
+    
+    if (![Util connectedToNetWork]) {
+        showMsgUnconnect();
+        return;
+    }
+    
+    NSMutableArray *arr=[NSMutableArray array];
+    [arr addPro:@"dqbh"         Value:RQ_USER_MANAGER.currentUser.city];
+    [arr addPro:@"userId"       Value:RQ_USER_MANAGER.currentUser._id];
+    
+    NSString* method = @"getDiscountHalfHour";
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
+        
+        if (!root) {
+            return;
+        }
+        
+        if ([root[@"code"] intValue] == 1) {
+            ShowMsg(root[@"body"]);
+            return;
+        }
+        
+        if ([root[@"body"] integerValue] == 1) {
+            discountBtn.userInteractionEnabled = YES;
+            discountBtn.height = 50;
+            [discountBtn setTitle:@"您有免费半小时优惠券,点击使用" textColor:[UIColor orangeColor] Font:Font17 fotState:UIControlStateNormal];
+            discountBtn.layer.borderColor = [UIColor orangeColor].CGColor;
+        }
+    }];
+}
+
+
+
+- (void)uploadReserveMn {
+    
+    [LoadingView showHUD];
+    if (![Util connectedToNetWork]) {
+        showMsgUnconnect();
+        return;
+    }
+    
+    NSString *isPay = @"2";
+    if (price > 0.00) {
+        if (isUseDisCount) {
+            isPay = @"1";
+        }else{
+            isPay = @"0";
+        }
+    }
+    
+    NSMutableArray *arr=[NSMutableArray array];
+    [arr addPro:@"dqbh"         Value:RQ_USER_MANAGER.currentUser.city];
+    [arr addPro:@"deviceId"     Value:_devDic[@"ID"]];
+    [arr addPro:@"quotaId"      Value:_quotaId];
+    [arr addPro:@"isPay"        Value:isPay];
+    [arr addPro:@"startTime"    Value:beginTime];
+    [arr addPro:@"endTime"      Value:endTime];
+    [arr addPro:@"userId"       Value:RQ_USER_MANAGER.currentUser._id];
+    
+    
+    NSString* method = @"uploadReserveMn";
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *root) {
+        
+        RemoveHUD();
+        
+        if (!root) {
+            return;
+        }
+        
+        if ([root[@"code"] intValue] == 1) {
+            ShowMsg(root[@"body"]);
+            return;
+        }
+        
+        
+        [self getReserveMnByDevId];
+    }];
+}
+
+
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+
+@end

+ 41 - 0
jiaPei/Grade.h

@@ -0,0 +1,41 @@
+/**
+ 主要涉及到。读。写数据。
+ 还需要一个开始时间和,结束时间
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface Grade : NSObject
+/**日期。例如:11-16
+ */
+@property (nonatomic, copy) NSString* graDate;
+/**时间戳
+ */
+@property (nonatomic, assign) NSInteger graDateTimeStamp;
+/**分数。例如:2.
+ 改版后,把'分'字去掉了。
+ */
+@property (nonatomic, copy) NSString* graScore;
+/**时间。例如:0:12
+ */
+@property (nonatomic, copy) NSString* graTime;
+/**名称,例:马路杀手
+ */
+@property (nonatomic, copy) NSString* graHonor;
+@property (nonatomic, copy) NSString* startDate;
+@property (nonatomic, copy) NSString* endDate;
+
+/**在查询subject时,会设置这个值
+ */
+@property (nonatomic, copy) NSString* subject;
+
+/**是否上传本次成绩
+ */
+@property (nonatomic, copy) NSString* isUpdate;
+
+@end
+
+/**应该是在交卷的时候,保存考试成绩。
+ */
+
+

+ 22 - 0
jiaPei/Grade.m

@@ -0,0 +1,22 @@
+
+
+
+#import "Grade.h"
+
+@implementation Grade
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 38 - 0
jiaPei/HolderView.h

@@ -0,0 +1,38 @@
+
+/**
+ 当表单里没有数据时。就可以显示这个
+ 暂无数据 点击刷新
+ */
+
+#import <UIKit/UIKit.h>
+
+@interface HolderView : UIView
+{
+    UILabel* titLabel;
+    
+    BlockTypeVo fresh;
+    
+    /**点击后通知刷新
+     */
+    UIButton* btnFul;
+}
+@property(nonatomic,copy) NSString* title;
+
+-(void)freshBlock:(BlockTypeVo)block;
+
+@end
+
+/**
+ 、现在要处理holdView的显示问题了。
+ 、任何时候。
+ 、主线程里。要hide一下、
+ 、异步开始。设为NO。但不可显示。
+ 、异步后。设为model.cnt
+ 、
+ 、如果是block调用的。需要先removeAll
+ 、
+ */
+
+
+
+

+ 91 - 0
jiaPei/HolderView.m

@@ -0,0 +1,91 @@
+
+#import "HolderView.h"
+
+@implementation HolderView
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        [self setBackgroundColor:navBarColor];
+        self.clipsToBounds = YES;
+        
+        CGFloat x,y,w,h;
+        
+        w = h = kSize.width/3.0;
+        x = y = w;
+        UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
+        iv.center = CGPointMake(frame.size.width/2, frame.size.height/2-40);
+        [iv setImage:[UIImage imageNamed:@"community4.png"]];
+        [iv setContentMode:UIViewContentModeScaleAspectFit];
+        [self addSubview:iv];
+        
+        y = CGRectGetMaxY(iv.frame);
+        x = 0;
+        w = kSize.width;
+        h = 40 * 2;
+        UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
+        [label setTextAlignment:NSTextAlignmentCenter];
+        [label setFont:[UIFont scaleSize:18]];
+        [label setTextColor:contentTextColor];
+        [label setNumberOfLines:0];
+        [self addSubview:label];
+        titLabel = label;
+        
+        _title = @"暂无信息~";
+    }
+    return self;
+}
+
+-(void)layoutSubviews
+{
+    [super layoutSubviews];
+    [titLabel setText:_title];
+    
+    titLabel.height = [_title heightForWid:kSize.width Font:18];
+}
+
+-(void)freshBlock:(BlockTypeVo)block
+{
+    fresh = block;
+    if (!btnFul) {
+        UIButton* btn;
+        btn = [[UIButton alloc] initWithFrame:self.bounds];
+        [self addSubview:btn];
+        btnFul = btn;
+        _title = @"点击刷新";
+        
+        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
+    }
+}
+
+-(void)btnClick:(UIButton*)sender
+{
+    if (fresh) {
+        self.hidden = YES;
+        fresh();
+    }
+}
+
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

BIN
jiaPei/Images.xcassets/AppIcon.appiconset/App Store.png


+ 80 - 0
jiaPei/Images.xcassets/AppIcon.appiconset/Contents.json

@@ -0,0 +1,80 @@
+{
+  "images" : [
+    {
+      "filename" : "iPhone notification iOS 7,12@2x.png",
+      "idiom" : "iphone",
+      "scale" : "2x",
+      "size" : "20x20"
+    },
+    {
+      "filename" : "iPhone notification iOS 7,12@3x.png",
+      "idiom" : "iphone",
+      "scale" : "3x",
+      "size" : "20x20"
+    },
+    {
+      "filename" : "iPhone Spotlight iOS 5,6 & Settings.png",
+      "idiom" : "iphone",
+      "scale" : "1x",
+      "size" : "29x29"
+    },
+    {
+      "filename" : "iPhone Spotlight iOS 5,6 & Settings@2x.png",
+      "idiom" : "iphone",
+      "scale" : "2x",
+      "size" : "29x29"
+    },
+    {
+      "filename" : "iPhone Spotlight iOS 5,6 & Settings@3x.png",
+      "idiom" : "iphone",
+      "scale" : "3x",
+      "size" : "29x29"
+    },
+    {
+      "filename" : "iPhone Spotlight iOS 7,12@2x.png",
+      "idiom" : "iphone",
+      "scale" : "2x",
+      "size" : "40x40"
+    },
+    {
+      "filename" : "iPhone Spotlight iOS 7,12@3x.png",
+      "idiom" : "iphone",
+      "scale" : "3x",
+      "size" : "40x40"
+    },
+    {
+      "filename" : "iPhone App Icon iOS 5,6.png",
+      "idiom" : "iphone",
+      "scale" : "1x",
+      "size" : "57x57"
+    },
+    {
+      "filename" : "iPhone App Icon iOS 5,6@2x.png",
+      "idiom" : "iphone",
+      "scale" : "2x",
+      "size" : "57x57"
+    },
+    {
+      "filename" : "iPhone App Icon iOS 7,12@2x.png",
+      "idiom" : "iphone",
+      "scale" : "2x",
+      "size" : "60x60"
+    },
+    {
+      "filename" : "iPhone App Icon iOS 7,12@3x.png",
+      "idiom" : "iphone",
+      "scale" : "3x",
+      "size" : "60x60"
+    },
+    {
+      "filename" : "App Store.png",
+      "idiom" : "ios-marketing",
+      "scale" : "1x",
+      "size" : "1024x1024"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 5,6.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 5,6@2x.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 7,12@2x.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone App Icon iOS 7,12@3x.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 5,6 & Settings.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 5,6 & Settings@2x.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 5,6 & Settings@3x.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 7,12@2x.png


BIN
jiaPei/Images.xcassets/AppIcon.appiconset/iPhone Spotlight iOS 7,12@3x.png


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott