|
@@ -36,6 +36,7 @@ typedef enum {
|
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
|
[self.navigationItem setLeftBarButtonItems:@[[UIBarButtonItem rq_backItemWithTitle:@"" imageName:@"back_white" target:self action:@selector(rq_back)]]];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// rq_back事件处理
|
|
@@ -43,6 +44,21 @@ typedef enum {
|
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
|
}
|
|
|
|
|
|
+// 计算两个时间的差
|
|
|
+- (NSTimeInterval)timeDifferenceExceedingSecondsBetween:(NSString *)thisTime and:(NSString *)nowTime {
|
|
|
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
|
|
+ [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
|
|
|
+
|
|
|
+ NSDate *thisDate = [dateFormatter dateFromString:thisTime];
|
|
|
+ NSDate *nowDate = [dateFormatter dateFromString:nowTime];
|
|
|
+
|
|
|
+ if (thisDate && nowDate) {
|
|
|
+ NSTimeInterval timeDifference = [nowDate timeIntervalSinceDate:thisDate];
|
|
|
+ return timeDifference;
|
|
|
+ }
|
|
|
+ return 0.0;
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark 以下内容为-从之前的PeriodVC复制计时逻辑,不做修改。
|
|
|
#pragma mark 理论计时
|
|
|
- (void)myInitTheory {
|
|
@@ -444,10 +460,7 @@ typedef enum {
|
|
|
[RQ_RemoteTheory_MANAGER uploadEduPicWithClassidStr:self.classIdStr timeStr:timeStr actionPhotoStr:dic[@"actionImg"] loginFlagType:LoginFlagType_Process resultBlock:^(BOOL isSuccess, NSDictionary * _Nonnull uploadEduPicDict) {
|
|
|
@strongify(self)
|
|
|
if (isSuccess) {
|
|
|
- [RQ_SHARE_FUNCTION showAlertWithTitle:@"温馨提示" message:@"过程验证成功" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"确定" otherButtonTitles:nil otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
|
|
|
- @strongify(self)
|
|
|
- [self.timer setFireDate:[NSDate distantPast]];
|
|
|
- }];
|
|
|
+ [self lnShowTimeHandler];
|
|
|
} else {
|
|
|
self.seconds--;
|
|
|
[self setSecondString:[NSString stringWithFormat:@"%d",(int)self.seconds]];
|
|
@@ -487,6 +500,12 @@ typedef enum {
|
|
|
[self saveTrain];
|
|
|
}
|
|
|
|
|
|
+ //判断-辽宁-晚上23:55分
|
|
|
+ if((int)self.seconds%30==0){
|
|
|
+ NSLog(@"判断-辽宁-晚上23:55分");
|
|
|
+ [self lnShowTime2399Handler];
|
|
|
+ }
|
|
|
+
|
|
|
hour = (int)self.seconds / 3600;
|
|
|
min = (int)self.seconds % 3600 / 60;
|
|
|
second = (int)self.seconds % 3600 % 60;
|
|
@@ -521,6 +540,73 @@ typedef enum {
|
|
|
self.timeLabel.text = [NSString stringWithFormat:@"0%d:%@:%@",hour,min_s,second_s];
|
|
|
}
|
|
|
|
|
|
+//2.4 辽宁-特殊判断 - 拍照上传-超时处理
|
|
|
+- (void)lnShowTimeHandler {
|
|
|
+ @weakify(self)
|
|
|
+ if ([[RQ_USER_MANAGER getParamsKey:@"APP_LN_DQBH"] rangeOfString:RQ_USER_MANAGER.currentUser.city].location != NSNotFound) {//是否辽宁
|
|
|
+
|
|
|
+ NSString *this_timeStr = [self getTimes:self.seconds];//当前计时器时间
|
|
|
+ //提示: 本次训练暂停学时较多. 请先签退, 再重新签到)
|
|
|
+ [RQ_RemoteTheory_MANAGER getCurrentTimeWithResultBlock:^(BOOL isSuccess, NSDictionary * _Nonnull timeDict) {
|
|
|
+ @strongify(self)
|
|
|
+ if (isSuccess) {
|
|
|
+ NSString *now_timeStr = timeDict[@"body"];
|
|
|
+ //如果-暂停超过15分钟-提示-签退
|
|
|
+ double timecount = fabs([self timeDifferenceExceedingSecondsBetween:this_timeStr and:now_timeStr]);
|
|
|
+ NSLog(@"辽宁timecount=%f",timecount);
|
|
|
+ if(timecount>900){
|
|
|
+ [RQ_SHARE_FUNCTION showAlertWithTitle:@"温馨提示" message:@"本次训练暂停学时较多. 请先签退, 再重新签到" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"签退" otherButtonTitles:nil otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
|
|
|
+ //走-签退-结束计时流程
|
|
|
+ @strongify(self)
|
|
|
+ [self btnClick:self.on_offBtn];
|
|
|
+ }];
|
|
|
+ }else{
|
|
|
+ [RQ_SHARE_FUNCTION showAlertWithTitle:@"温馨提示" message:@"过程验证成功" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"确定" otherButtonTitles:nil otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
|
|
|
+ @strongify(self)
|
|
|
+ [self.timer setFireDate:[NSDate distantPast]];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ return;
|
|
|
+ }else{//非辽宁-直接提示成功
|
|
|
+ [RQ_SHARE_FUNCTION showAlertWithTitle:@"温馨提示" message:@"过程验证成功" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"确定" otherButtonTitles:nil otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
|
|
|
+ @strongify(self)
|
|
|
+ [self.timer setFireDate:[NSDate distantPast]];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//2.5 辽宁-特殊判断 - 凌晨提醒签退
|
|
|
+- (void)lnShowTime2399Handler {
|
|
|
+ @weakify(self)
|
|
|
+ if ([[RQ_USER_MANAGER getParamsKey:@"APP_LN_DQBH"] rangeOfString:RQ_USER_MANAGER.currentUser.city].location != NSNotFound) {//是否辽宁
|
|
|
+ NSString *time=[myDelegate.begin_Time substringWithRange:NSMakeRange(0, 10)];
|
|
|
+ NSString *time50=[NSString stringWithFormat:@"%@ 23:50:00",time];
|
|
|
+ NSString *time55=[NSString stringWithFormat:@"%@ 23:55:00",time];
|
|
|
+ NSString *this_timeStr = [self getTimes:self.seconds];
|
|
|
+ //如果-暂停超过15分钟-提示-签退
|
|
|
+ double timecount = [self timeDifferenceExceedingSecondsBetween:this_timeStr and:time50];
|
|
|
+ if(timecount<0){
|
|
|
+ double timecount55 = [self timeDifferenceExceedingSecondsBetween:this_timeStr and:time55];
|
|
|
+ if(timecount55<0){
|
|
|
+ [self.timer setFireDate:[NSDate distantFuture]];
|
|
|
+ [RQ_SHARE_FUNCTION showAlertWithTitle:@"温馨提示" message:@"本次培训即将隔日无效. 请先签退. 0点过后再重新签到" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"签退" otherButtonTitles:nil otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
|
|
|
+ //走-签退-结束计时流程
|
|
|
+ @strongify(self)
|
|
|
+ [self btnClick:self.on_offBtn];
|
|
|
+ }];
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ ShowMsg(@"本次培训即将隔日无效. 请先签退. 0点过后再重新签到");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //23:55:00 强制签退
|
|
|
+ NSLog(@"this_timeStr=%@ time50=%@ time55=%@ %f",this_timeStr,time50,time55,timecount);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
- (void)stopTimingWithResultBlock:(void (^)(BOOL isSuccessed))resultBlock {
|
|
|
@weakify(self)
|
|
|
[self.timer setFireDate:[NSDate distantFuture]];
|