Commit 7d0e83fc authored by 曹云霄's avatar 曹云霄

修改项说明:修复解除绑定银行卡失败、刷新不及时、提现区分opple奖励和产品返利

parent 8f4a4127
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
break; break;
case 0://start == end case 0://start == end
{ {
[formater setDateFormat:@"yyyy-MM-dd HH:dd:ss"]; [formater setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
self.conditionModel.createTimeBegin = nil; self.conditionModel.createTimeBegin = nil;
self.conditionModel.createTimeEnd = nil; self.conditionModel.createTimeEnd = nil;
} }
...@@ -298,33 +298,6 @@ ...@@ -298,33 +298,6 @@
[self.allCustomerTableview.mj_header beginRefreshing]; [self.allCustomerTableview.mj_header beginRefreshing];
} }
#pragma mark -比较两个NSDate的大小
- (int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *oneDayStr = [dateFormatter stringFromDate:oneDay];
NSString *anotherDayStr = [dateFormatter stringFromDate:anotherDay];
NSDate *dateA = [dateFormatter dateFromString:oneDayStr];
NSDate *dateB = [dateFormatter dateFromString:anotherDayStr];
NSComparisonResult result = [dateA compare:dateB];
NSLog(@"date1 : %@, date2 : %@", oneDay, anotherDay);
if (result == NSOrderedDescending) {
//NSLog(@"Date1 is in the future");
return 1;
}
else if (result == NSOrderedAscending){
//NSLog(@"Date1 is in the past");
return -1;
}
//NSLog(@"Both dates are the same");
return 0;
}
#pragma mark -Return键检测 #pragma mark -Return键检测
- (BOOL)textFieldShouldReturn:(UITextField *)textField - (BOOL)textFieldShouldReturn:(UITextField *)textField
{ {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#pragma mark - lazy #pragma mark - lazy
- (NSArray *)titleArray - (NSArray *)titleArray
{ {
return @[@"持卡人",@"银行卡号",@"身份证号码"]; return @[@"持卡人",@"银行卡号",@"身份证号码",@"手机号码"];
} }
- (void)viewDidLoad { - (void)viewDidLoad {
...@@ -61,47 +61,37 @@ ...@@ -61,47 +61,37 @@
#pragma mark - 验证银行卡信息是否匹配 #pragma mark - 验证银行卡信息是否匹配
- (void)validationBankCardInformationIsMatching - (void)validationBankCardInformationIsMatching
{ {
// {
// "bankAccount": "6214832132890315",
// "accountName": "陈焱焱",
// "identityCode": "320921199311166750",
// "phoneNumber": "18262621719"
// }
TOCommAuthEntity *entity = [[TOCommAuthEntity alloc] init]; TOCommAuthEntity *entity = [[TOCommAuthEntity alloc] init];
entity.bankAccount = @"6214832132890315"; BindingTableViewCell *cardholderCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
entity.accountName = @"陈焱焱"; entity.accountName = cardholderCell.bindingInputTextField.text;
entity.identityCode = @"320921199311166750"; BindingTableViewCell *bankAccountCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]];
entity.phoneNumber = @"18262621719"; entity.bankAccount = bankAccountCell.bindingInputTextField.text;
// BindingTableViewCell *cardholderCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; BindingTableViewCell *identityCodeCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
// entity.accountName = cardholderCell.bindingInputTextField.text; entity.identityCode = identityCodeCell.bindingInputTextField.text;
// BindingTableViewCell *bankAccountCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:1 inSection:0]]; BindingTableViewCell *phoneNumberCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:0]];
// entity.bankAccount = bankAccountCell.bindingInputTextField.text; entity.phoneNumber = phoneNumberCell.bindingInputTextField.text;
// BindingTableViewCell *identityCodeCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]]; if ([[self class] isBlankString:entity.accountName]) {
// entity.identityCode = identityCodeCell.bindingInputTextField.text; [XBLoadingView showHUDViewWithText:@"持卡人不能为空"]; return;
// BindingTableViewCell *phoneNumberCell = [self.bindingTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:0]]; }
// entity.phoneNumber = phoneNumberCell.bindingInputTextField.text; if ([[self class] isBlankString:entity.identityCode]) {
// //校验 [XBLoadingView showHUDViewWithText:@"身份证号码不能为空"]; return;
// if ([[self class] isBlankString:entity.phoneNumber]) { }
// [XBLoadingView showHUDViewWithText:@"手机号不能为空"]; return; if ([[self class] isBlankString:entity.bankAccount]) {
// } [XBLoadingView showHUDViewWithText:@"银行卡号不能为空"]; return;
// if ([[self class] isBlankString:entity.accountName]) { }
// [XBLoadingView showHUDViewWithText:@"持卡人不能为空"]; return; if ([[self class] isBlankString:entity.identityCode]) {
// } [XBLoadingView showHUDViewWithText:@"身份证号码不能为空"]; return;
// if ([[self class] isBlankString:entity.identityCode]) { }
// [XBLoadingView showHUDViewWithText:@"身份证号码不能为空"]; return; if ([self isPureInt:entity.accountName]) {
// } [XBLoadingView showHUDViewWithText:@"银行卡号格式不正确"]; return;
// if ([[self class] isBlankString:entity.bankAccount]) { }
// [XBLoadingView showHUDViewWithText:@"银行卡号不能为空"]; return; if (![HENLENSONG isValidateMobile:entity.phoneNumber]) {
// } [XBLoadingView showHUDViewWithText:@"手机号码格式不正确"]; return;
// if (![HENLENSONG isValidateMobile:entity.phoneNumber]) { }
// [XBLoadingView showHUDViewWithText:@"手机号码格式不正确"]; return;
// }
// if ([self isPureInt:entity.accountName]) {
// [XBLoadingView showHUDViewWithText:@"银行卡号格式不正确"]; return;
// }
NSString *type = [MyBankClass returnBankName:entity.bankAccount]; NSString *type = [MyBankClass returnBankName:entity.bankAccount];
WS(weakSelf); WS(weakSelf);
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
NSLog(@"%@",[[entity toDictionary] JSONString]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(VALIDATION) WithRequestType:ZERO WithParameter:entity WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(VALIDATION) WithRequestType:ZERO WithParameter:entity WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
......
...@@ -26,12 +26,16 @@ ...@@ -26,12 +26,16 @@
@implementation IntegralDetailsViewController @implementation IntegralDetailsViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self setUpRefreshAction];
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self uiConfigAction]; [self uiConfigAction];
[self setUpRefreshAction];
} }
#pragma mark - UI #pragma mark - UI
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#pragma mark - 选项按钮 #pragma mark - 选项按钮
- (IBAction)extensionButtonClickAction:(UIButton *)sender { - (IBAction)extensionButtonClickAction:(UIButton *)sender {
self.bestView.hidden = NO;
if (self.bestView.width != 0) { if (self.bestView.width != 0) {
[UIView animateWithDuration:0.2 animations:^{ [UIView animateWithDuration:0.2 animations:^{
self.bestView.width = 0; self.bestView.width = 0;
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
*/ */
typedef void(^DeletePostBlock)(NSString *topicId); typedef void(^DeletePostBlock)(NSString *topicId);
/**
刷新列表
*/
typedef void(^RefreshListBlock)();
@interface ForumItemDetailViewController : BaseViewController @interface ForumItemDetailViewController : BaseViewController
...@@ -47,6 +51,11 @@ typedef void(^DeletePostBlock)(NSString *topicId); ...@@ -47,6 +51,11 @@ typedef void(^DeletePostBlock)(NSString *topicId);
*/ */
@property (nonatomic,copy) DeletePostBlock delectBlock; @property (nonatomic,copy) DeletePostBlock delectBlock;
/**
刷新列表
*/
@property (nonatomic,copy) RefreshListBlock refreshBlock;
/** /**
帖子详情数据源 帖子详情数据源
*/ */
......
...@@ -180,7 +180,8 @@ ...@@ -180,7 +180,8 @@
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{ {
CommentListTableViewCell *commentCell = (CommentListTableViewCell *)cell; CommentListTableViewCell *commentCell = (CommentListTableViewCell *)cell;
commentCell.bestView.hidden = YES; commentCell.bestView.width = ZERO;
commentCell.bestView.x = commentCell.optionButton.x;
} }
#pragma mark - 计算选中图片显示所需高度 #pragma mark - 计算选中图片显示所需高度
...@@ -234,6 +235,9 @@ ...@@ -234,6 +235,9 @@
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
weakSelf.commentInputTextFieldView.text = nil; weakSelf.commentInputTextFieldView.text = nil;
[XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{ [XBLoadingView showHUDViewWithSuccessText:@"评论成功" completeBlock:^{
if (weakSelf.refreshBlock) {
weakSelf.refreshBlock();
}
[weakSelf getPostDetailAction:YES]; [weakSelf getPostDetailAction:YES];
}]; }];
}else { }else {
...@@ -280,7 +284,6 @@ ...@@ -280,7 +284,6 @@
{ {
WS(weakSelf); WS(weakSelf);
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
NSLog(@"%@",[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest?@"true":@"false"]);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest?@"true":@"false"] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(BASEREPLY),self.topicDetail.fid,replyId,isBest?@"true":@"false"] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
......
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
{ {
self.classifyTitleLabel.text = self.category.name; self.classifyTitleLabel.text = self.category.name;
[self.classifyImageView sd_setImageWithURL:[NSURL URLWithString:self.category.attachment.fileUrl] placeholderImage:REPLACEIMAGE]; [self.classifyImageView sd_setImageWithURL:[NSURL URLWithString:self.category.attachment.fileUrl] placeholderImage:REPLACEIMAGE];
self.classifyListCountLabel.text = [NSString stringWithFormat:@"%ld",self.category.topicCount];
} }
#pragma mark - 获取分类帖子列表 #pragma mark - 获取分类帖子列表
...@@ -99,7 +98,6 @@ ...@@ -99,7 +98,6 @@
{ {
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
WS(weakSelf); WS(weakSelf);
NSLog(@"%@",[[condtion toDictionary] JSONString]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(QUERTFORUMLIST) WithRequestType:ZERO WithParameter:condtion WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(QUERTFORUMLIST) WithRequestType:ZERO WithParameter:condtion WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
...@@ -112,6 +110,7 @@ ...@@ -112,6 +110,7 @@
} }
ForumTopicResponse *result = [[ForumTopicResponse alloc] initWithDictionary:returnValue[@"data"] error:nil]; ForumTopicResponse *result = [[ForumTopicResponse alloc] initWithDictionary:returnValue[@"data"] error:nil];
[weakSelf.datasArray addObjectsFromArray:result.forumTopicEntity]; [weakSelf.datasArray addObjectsFromArray:result.forumTopicEntity];
weakSelf.classifyListCountLabel.text = [NSString stringWithFormat:@"帖子: %ld",result.total];
}else { }else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]]; [XBLoadingView showHUDViewWithText:returnValue[@"message"]];
} }
...@@ -164,15 +163,15 @@ ...@@ -164,15 +163,15 @@
ForumItemDetailViewController *postDetail = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"ForumItemDetailViewController"]; ForumItemDetailViewController *postDetail = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"ForumItemDetailViewController"];
postDetail.topicDetail = self.datasArray[indexPath.row]; postDetail.topicDetail = self.datasArray[indexPath.row];
WS(weakSelf); WS(weakSelf);
[postDetail setRefreshBlock:^{
[weakSelf.classificationListTableView.mj_header beginRefreshing];
}];
//删除帖子 //删除帖子
[postDetail setDelectBlock:^(NSString *topicId) { [postDetail setDelectBlock:^(NSString *topicId) {
for (int i=0; i<weakSelf.datasArray.count; i++) { for (int i=0; i<weakSelf.datasArray.count; i++) {
CustomTOForumTopicEntity *entity = self.datasArray[i]; CustomTOForumTopicEntity *entity = self.datasArray[i];
if ([entity.fid isEqualToString:topicId]) { if ([entity.fid isEqualToString:topicId]) {
[weakSelf.classificationListTableView beginUpdates]; [weakSelf.classificationListTableView.mj_header beginRefreshing];
[weakSelf.datasArray removeObjectAtIndex:i];
[weakSelf.classificationListTableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:i inSection:ZERO]] withRowAnimation:UITableViewRowAnimationLeft];
[weakSelf.classificationListTableView endUpdates];
} }
} }
}]; }];
......
...@@ -221,11 +221,10 @@ ...@@ -221,11 +221,10 @@
studyResult.details = (NSArray<TOStudyResultDetailEntity>*)submitAnswerArray; studyResult.details = (NSArray<TOStudyResultDetailEntity>*)submitAnswerArray;
studyResult.grade = [NSNumber numberWithInteger:allScore]; studyResult.grade = [NSNumber numberWithInteger:allScore];
//判断考核是否合格 //判断考核是否合格
if (self.taskDetails.passGrade < allScore) { studyResult.examResult = (self.taskDetails.passGrade < allScore)?@"1":@"0";
studyResult.examResult = @"1";
}
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
WS(weakSelf); WS(weakSelf);
NSLog(@"%@",[[studyResult toDictionary] JSONString])
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SUBMITANSWER) WithRequestType:ZERO WithParameter:studyResult WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(SUBMITANSWER) WithRequestType:ZERO WithParameter:studyResult WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
...@@ -259,12 +258,12 @@ ...@@ -259,12 +258,12 @@
}else { }else {
WS(weakSelf); WS(weakSelf);
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),@"studyScore"] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),INSPECTIONTHROUGH] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
AssessmentQualifiedViewController *qualified = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AssessmentQualifiedViewController"]; AssessmentQualifiedViewController *qualified = [[[weakSelf class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AssessmentQualifiedViewController"];
qualified.delegate = self; qualified.delegate = self;
qualified.intrgral = [NSString stringWithFormat:@"+%@",returnValue[@"data"][@"optionValue"]]; qualified.intrgral = [NSString stringWithFormat:@"+%@",returnValue[@"data"]];
qualified.allScore = [NSString stringWithFormat:@"%ld",allScore]; qualified.allScore = [NSString stringWithFormat:@"%ld",allScore];
qualified.preferredContentSize = CGSizeMake(300, 300); qualified.preferredContentSize = CGSizeMake(300, 300);
qualified.modalPresentationStyle = UIModalPresentationFormSheet; qualified.modalPresentationStyle = UIModalPresentationFormSheet;
......
...@@ -47,6 +47,13 @@ ...@@ -47,6 +47,13 @@
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES; self.navigationController.interactivePopGestureRecognizer.enabled = YES;
} }
//记录播放时间
VideoHelperViewController *videoVc = [self.childViewControllers firstObject];
if (videoVc.learningItem) {
double currentTime = [videoVc getCurrentPlayingTime];
double totalTime = videoVc.playerItem.duration.value/videoVc.playerItem.duration.timescale;
[self switchVideoRecordPlayTime:videoVc.learningItem.attachment withPlayTime:currentTime withPlayPercent:currentTime/totalTime];
}
} }
- (void)viewDidLoad { - (void)viewDidLoad {
...@@ -54,9 +61,10 @@ ...@@ -54,9 +61,10 @@
[self addChildViewController]; [self addChildViewController];
[self getStudyItemDetailAction]; [self getStudyItemDetailAction];
[self listeningHomeButton];
} }
#pragma mark - #pragma mark - 添加子控制器
- (void)addChildViewController - (void)addChildViewController
{ {
//播放窗口 //播放窗口
...@@ -68,6 +76,7 @@ ...@@ -68,6 +76,7 @@
VideoListViewController *playList = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"VideoListViewController"]; VideoListViewController *playList = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"VideoListViewController"];
playList.studyItemTitle = self.studyTypeEntity.name; playList.studyItemTitle = self.studyTypeEntity.name;
playList.delegate = self; playList.delegate = self;
videoWindow.progressDelegate = playList;
[self addChildViewController:playList]; [self addChildViewController:playList];
[self.view addSubview:playList.view]; [self.view addSubview:playList.view];
//播放简介 //播放简介
...@@ -97,6 +106,33 @@ ...@@ -97,6 +106,33 @@
playDetail.view.frame = CGRectMake(0, ScreenHeight/2+NavigationHeight, ScreenWidth*2/3, ScreenHeight/2-NavigationHeight); playDetail.view.frame = CGRectMake(0, ScreenHeight/2+NavigationHeight, ScreenWidth*2/3, ScreenHeight/2-NavigationHeight);
} }
#pragma mark - 监听Home键
- (void)listeningHomeButton
{
//监听是否触发home键挂起程序.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:)name:UIApplicationWillResignActiveNotification object:nil];
//监听是否重新进入程序程序.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:)name:UIApplicationDidBecomeActiveNotification object:nil];
}
#pragma mark - 进入后台
- (void)applicationWillResignActive:(NSNotification *)notification
{
printf("触发home按下\n");
//记录播放时间
VideoHelperViewController *videoVc = [self.childViewControllers firstObject];
if (videoVc.learningItem) {
double currentTime = [videoVc getCurrentPlayingTime];
double totalTime = videoVc.playerItem.duration.value/videoVc.playerItem.duration.timescale;
[self switchVideoRecordPlayTime:videoVc.learningItem.attachment withPlayTime:currentTime withPlayPercent:currentTime/totalTime];
}
}
#pragma mark - 进入前台
- (void)applicationDidBecomeActive:(NSNotification *)notification
{
printf("重新进来后响应\n");
}
#pragma mark - 获取学习项详情 #pragma mark - 获取学习项详情
- (void)getStudyItemDetailAction - (void)getStudyItemDetailAction
...@@ -135,9 +171,15 @@ ...@@ -135,9 +171,15 @@
VideoHelperViewController *videoVc = [self.childViewControllers firstObject]; VideoHelperViewController *videoVc = [self.childViewControllers firstObject];
RsStudyTask *studyEntity = self.studyResult.studyEntity[indexPath.section]; RsStudyTask *studyEntity = self.studyResult.studyEntity[indexPath.section];
CustomStudyEntity *studyList = studyEntity.studyTasks[indexPath.row]; CustomStudyEntity *studyList = studyEntity.studyTasks[indexPath.row];
videoVc.indexPath = indexPath;
if ([studyList.attachment.fileUrl rangeOfString:@".mp4"].location != NSNotFound) { if ([studyList.attachment.fileUrl rangeOfString:@".mp4"].location != NSNotFound) {
//判断是否是第一次播放
if (videoVc.learningItem) {
double currentTime = [videoVc getCurrentPlayingTime];
double totalTime = videoVc.playerItem.duration.value/videoVc.playerItem.duration.timescale;
[self switchVideoRecordPlayTime:videoVc.learningItem.attachment withPlayTime:currentTime withPlayPercent:currentTime/totalTime];
}
videoVc.learningItem = studyList; videoVc.learningItem = studyList;
videoVc.videoTitleLabel.text = studyList.title;
}else if ([studyList.attachment.fileUrl rangeOfString:@".ppt"].location != NSNotFound) { }else if ([studyList.attachment.fileUrl rangeOfString:@".ppt"].location != NSNotFound) {
[videoVc resetPlayer]; [videoVc resetPlayer];
...@@ -152,6 +194,32 @@ ...@@ -152,6 +194,32 @@
} }
} }
#pragma mark - 切换视频播放记录播放时间
- (void)switchVideoRecordPlayTime:(TOAttachmentEntity *)attachment withPlayTime:(double)playTime withPlayPercent:(double)percent
{
TOAttachmentPlayEntity *playTimeEntity = [[TOAttachmentPlayEntity alloc] init];
playTimeEntity.fid = attachment.entityId;
playTimeEntity.attachmentId = attachment.fid;
playTimeEntity.employeeId = [Shoppersmanager manager].Shoppers.employee.fid;
playTimeEntity.playTime = [NSString stringWithFormat:@"%.0lf",playTime];
playTimeEntity.playPercent = [NSString stringWithFormat:@"%.2lf",percent];
NSLog(@"%@",[playTimeEntity toDictionary]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(ATTACHMENTPLAYTIME) WithRequestType:ZERO WithParameter:playTimeEntity WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSLog(@"记录播放时间成功")
attachment.playTime = playTimeEntity.playTime;
attachment.playPercent = playTimeEntity.playPercent;
}else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]];
}
} WithFailureBlock:^(NSError *error) {
[XBLoadingView showHUDViewWithText:error.localizedDescription];
}];
}
#pragma mark - 视频播放完成 #pragma mark - 视频播放完成
- (void)videoPlayFinish:(CustomStudyEntity *)studyEntity - (void)videoPlayFinish:(CustomStudyEntity *)studyEntity
{ {
...@@ -177,7 +245,6 @@ ...@@ -177,7 +245,6 @@
{ {
dispatch_group_t group = dispatch_group_create(); dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group); dispatch_group_enter(group);
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
// 任务一,学习项完成 // 任务一,学习项完成
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(FINISHSTUDY),studuEntity.fid,[Shoppersmanager manager].Shoppers.employee.fid] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(FINISHSTUDY),studuEntity.fid,[Shoppersmanager manager].Shoppers.employee.fid] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
...@@ -194,12 +261,12 @@ ...@@ -194,12 +261,12 @@
}]; }];
// 任务二,获得学习积分 // 任务二,获得学习积分
dispatch_group_enter(group); dispatch_group_enter(group);
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),@"finishStudyScore"] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),STUDYFINISH] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
dispatch_group_leave(group); dispatch_group_leave(group);
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
if (getIntegral) { if (getIntegral) {
getIntegral(returnValue[@"data"][@"optionValue"]); getIntegral(returnValue[@"data"]);
} }
}else { }else {
[XBLoadingView showHUDViewWithText:returnValue[@"message"]]; [XBLoadingView showHUDViewWithText:returnValue[@"message"]];
...@@ -211,7 +278,6 @@ ...@@ -211,7 +278,6 @@
}]; }];
// 全部任务完成 // 全部任务完成
dispatch_group_notify(group, dispatch_get_main_queue(), ^{ dispatch_group_notify(group, dispatch_get_main_queue(), ^{
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
}); });
} }
...@@ -249,8 +315,7 @@ ...@@ -249,8 +315,7 @@
[XBLoadingView showHUDViewWithText:@"学习内容为空"];return; [XBLoadingView showHUDViewWithText:@"学习内容为空"];return;
} }
VideoListViewController *studyListVC = self.childViewControllers[1]; VideoListViewController *studyListVC = self.childViewControllers[1];
studyListVC.datasArray = result.studyEntity; studyListVC.datasArray = [NSMutableArray arrayWithArray:result.studyEntity];
VideoDetailViewController *studyDetailsVC = self.childViewControllers[2]; VideoDetailViewController *studyDetailsVC = self.childViewControllers[2];
studyDetailsVC.datasArray = result.studyEntity; studyDetailsVC.datasArray = result.studyEntity;
studyDetailsVC.indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; studyDetailsVC.indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
*/ */
@property (weak, nonatomic) IBOutlet UILabel *studyItemTitleLabel; @property (weak, nonatomic) IBOutlet UILabel *studyItemTitleLabel;
/**
考核状态
*/
@property (weak, nonatomic) IBOutlet UIImageView *examResultImageView;
/** /**
学习时间 学习时间
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
{ {
_model = model; _model = model;
self.studyItemTitleLabel.text = _model.title; self.studyItemTitleLabel.text = _model.title;
//考核状态
if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) {
self.examResultImageView.hidden = YES;
}else {
self.examResultImageView.hidden = NO;
}
} }
@end @end
...@@ -11,11 +11,38 @@ ...@@ -11,11 +11,38 @@
#import <MediaPlayer/MediaPlayer.h> #import <MediaPlayer/MediaPlayer.h>
#import "VIMediaCache.h" #import "VIMediaCache.h"
/**
视频播放
*/
@protocol VideoPlayerDelegate <NSObject> @protocol VideoPlayerDelegate <NSObject>
@optional @optional
/**
视频播放完成
@param studyEntity 学习任务entity
*/
- (void)videoPlayFinish:(CustomStudyEntity *)studyEntity; - (void)videoPlayFinish:(CustomStudyEntity *)studyEntity;
@end
/**
视频播放进度
*/
@protocol VideoPlayProgressDelegate <NSObject>
/**
播放进度
@param proportion 进度
@param indexPath index
*/
- (void)videoPlayProportion:(NSInteger)proportion withIndexPath:(NSIndexPath *)indexPath;
@end @end
@interface VideoHelperViewController : BaseViewController @interface VideoHelperViewController : BaseViewController
...@@ -30,6 +57,7 @@ ...@@ -30,6 +57,7 @@
@property (nonatomic,strong) id avplayerServer; @property (nonatomic,strong) id avplayerServer;
@property (nonatomic,strong) VIResourceLoaderManager *resourceLoaderManager; @property (nonatomic,strong) VIResourceLoaderManager *resourceLoaderManager;
@property (nonatomic,weak) id<VideoPlayerDelegate> delegate; @property (nonatomic,weak) id<VideoPlayerDelegate> delegate;
@property (nonatomic,weak) id<VideoPlayProgressDelegate> progressDelegate;
/** /**
视频导航栏 视频导航栏
...@@ -66,6 +94,11 @@ ...@@ -66,6 +94,11 @@
*/ */
@property (weak, nonatomic) IBOutlet UILabel *playItemTotalTimeLabel; @property (weak, nonatomic) IBOutlet UILabel *playItemTotalTimeLabel;
/**
播放项下标
*/
@property (nonatomic,strong) NSIndexPath *indexPath;
/** /**
播放路径 播放路径
*/ */
...@@ -81,5 +114,12 @@ ...@@ -81,5 +114,12 @@
*/ */
- (void)resetPlayer; - (void)resetPlayer;
/**
当前播放时间
@return 秒数
*/
- (double)getCurrentPlayingTime;
@end @end
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
} }
} }
#pragma mark - SetUp AVPlayer #pragma mark - SetUp AVPlayer
- (void)setUpAVPlayer - (void)setUpAVPlayer
{ {
...@@ -78,6 +79,7 @@ ...@@ -78,6 +79,7 @@
self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.customPlayer]; self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.customPlayer];
self.playerLayer.frame = CGRectMake(0, 0, ScreenWidth*2/3, ScreenHeight/2); self.playerLayer.frame = CGRectMake(0, 0, ScreenWidth*2/3, ScreenHeight/2);
[self.view.layer insertSublayer:self.playerLayer atIndex:0]; [self.view.layer insertSublayer:self.playerLayer atIndex:0];
self.videoTitleLabel.text = self.learningItem.title;
} }
#pragma mark - AVPlayer KVO #pragma mark - AVPlayer KVO
...@@ -93,6 +95,7 @@ ...@@ -93,6 +95,7 @@
#pragma mark -KVO回调 #pragma mark -KVO回调
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
WS(weakSelf);
if ([keyPath isEqualToString:@"status"]) {//播放状态 if ([keyPath isEqualToString:@"status"]) {//播放状态
NSInteger status = [[change objectForKey:NSKeyValueChangeNewKey] integerValue]; NSInteger status = [[change objectForKey:NSKeyValueChangeNewKey] integerValue];
switch (status) { switch (status) {
...@@ -103,10 +106,25 @@ ...@@ -103,10 +106,25 @@
[XBLoadingView showHUDViewWithText:@"播放失败"]; [XBLoadingView showHUDViewWithText:@"播放失败"];
break; break;
case AVPlayerStatusReadyToPlay://正在播放 case AVPlayerStatusReadyToPlay://正在播放
{
self.playButton.selected = NO;
[XBLoadingView hideHUDViewWithDefaultWithView:self.view]; [XBLoadingView hideHUDViewWithDefaultWithView:self.view];
self.playItemTotalTimeLabel.text = [NSString stringWithFormat:@"/ %@",[self convertTime:CMTimeGetSeconds(self.playerItem.duration)]]; self.playItemTotalTimeLabel.text = [NSString stringWithFormat:@"/ %@",[self convertTime:CMTimeGetSeconds(self.playerItem.duration)]];
self.playButton.selected = NO; NSString *timeString = [self timeFormatted:[self.learningItem.attachment.playTime integerValue]];
if (![[self class] isBlankString:timeString]) {
[self.customPlayer pause];
self.playButton.selected = YES;
[self promptBoxWithMessage:[NSString stringWithFormat:@"上次播放时间:%@,是否继续播放",timeString] cancelBlock:^{
[weakSelf.customPlayer play];
weakSelf.playButton.selected = NO;
} sureBlock:^{
[weakSelf.customPlayer seekToTime:CMTimeMake([weakSelf.learningItem.attachment.playTime integerValue], ONE) toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
weakSelf.playButton.selected = NO;
}];
}
break; break;
}
default: default:
break; break;
} }
...@@ -147,19 +165,27 @@ ...@@ -147,19 +165,27 @@
//更新播放时间 //更新播放时间
CMTime ctime = weakSelf.customPlayer.currentTime; CMTime ctime = weakSelf.customPlayer.currentTime;
weakSelf.playingTimeLabel.text = [weakSelf convertTime:ctime.value/ctime.timescale]; weakSelf.playingTimeLabel.text = [weakSelf convertTime:ctime.value/ctime.timescale];
//更新播放百分比
if ([weakSelf.progressDelegate respondsToSelector:@selector(videoPlayProportion:withIndexPath:)]) {
[weakSelf.progressDelegate videoPlayProportion:[weakSelf getCurrentPlayingTime]/CMTimeGetSeconds(weakSelf.playerItem.duration)*100 withIndexPath:weakSelf.indexPath];
}
}]; }];
} }
#pragma mark - 隐藏(显示)状态栏、工具栏 #pragma mark - 隐藏(显示)状态栏、工具栏
- (void)hideOrShowNavigationBarAndToolBar - (void)hideOrShowNavigationBarAndToolBar
{ {
WS(weakSelf);
[UIView animateWithDuration:0.4 animations:^{ [UIView animateWithDuration:0.4 animations:^{
weakSelf.videoNavigationView.alpha = weakSelf.toolNaviViewIsHide?1:0; self.videoNavigationView.alpha = self.toolNaviViewIsHide?1:0;
weakSelf.videoToolView.alpha = weakSelf.toolNaviViewIsHide?1:0; self.videoToolView.alpha = self.toolNaviViewIsHide?1:0;
}completion:^(BOOL finished) { }completion:^(BOOL finished) {
weakSelf.toolNaviViewIsHide = !weakSelf.toolNaviViewIsHide; self.toolNaviViewIsHide = !self.toolNaviViewIsHide;
if (!self.toolNaviViewIsHide) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self hideOrShowNavigationBarAndToolBar];
});
}
}]; }];
} }
...@@ -180,7 +206,6 @@ ...@@ -180,7 +206,6 @@
#pragma mark - 播放完成 #pragma mark - 播放完成
- (void)playFinish - (void)playFinish
{ {
[self.customPlayer seekToTime:kCMTimeZero];
self.playButton.selected = YES; self.playButton.selected = YES;
if ([self.delegate respondsToSelector:@selector(videoPlayFinish:)]) { if ([self.delegate respondsToSelector:@selector(videoPlayFinish:)]) {
[self.delegate videoPlayFinish:self.learningItem]; [self.delegate videoPlayFinish:self.learningItem];
...@@ -311,7 +336,6 @@ ...@@ -311,7 +336,6 @@
[audioInputParams setTrackID:[track trackID]]; [audioInputParams setTrackID:[track trackID]];
[allAudioParams addObject:audioInputParams]; [allAudioParams addObject:audioInputParams];
} }
AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix]; AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix];
[audioMix setInputParameters:allAudioParams]; [audioMix setInputParameters:allAudioParams];
[self.playerItem setAudioMix:audioMix]; [self.playerItem setAudioMix:audioMix];
......
...@@ -41,4 +41,10 @@ ...@@ -41,4 +41,10 @@
*/ */
@property (nonatomic,strong) PNCircleChart *studyProgressView; @property (nonatomic,strong) PNCircleChart *studyProgressView;
/**
考核状态
*/
@property (weak, nonatomic) IBOutlet UIImageView *examResultImageView;
@end @end
...@@ -27,7 +27,13 @@ ...@@ -27,7 +27,13 @@
_model = model; _model = model;
self.studyItemTitleLabel.text = _model.title; self.studyItemTitleLabel.text = _model.title;
self.studyItemTimeLabel.text = _model.videoLength; self.studyItemTimeLabel.text = _model.videoLength;
[self.studyProgressView updateChartByCurrent:@50]; [self.studyProgressView updateChartByCurrent:[NSNumber numberWithInteger:[_model.attachment.playPercent floatValue]*100]];
//考核状态
if ([BaseViewController isBlankString:_model.examResult] || [_model.examResult isEqualToString:@"0"]) {
self.examResultImageView.hidden = YES;
}else {
self.examResultImageView.hidden = NO;
}
} }
@end @end
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import "BaseViewController.h" #import "BaseViewController.h"
#import "VideoHelperViewController.h"
/** /**
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
@end @end
@interface VideoListViewController : BaseViewController @interface VideoListViewController : BaseViewController<VideoPlayProgressDelegate>
@property (nonatomic,weak) id<SelectStudyItemDelegate> delegate; @property (nonatomic,weak) id<SelectStudyItemDelegate> delegate;
...@@ -40,5 +41,5 @@ ...@@ -40,5 +41,5 @@
/** /**
学习列表数据源 学习列表数据源
*/ */
@property (nonatomic,strong) NSArray *datasArray; @property (nonatomic,strong) NSMutableArray *datasArray;
@end @end
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
} }
#pragma mark - 数据源 #pragma mark - 数据源
- (void)setDatasArray:(NSArray *)datasArray - (void)setDatasArray:(NSMutableArray *)datasArray
{ {
_datasArray = datasArray; _datasArray = datasArray;
[self.studyListTableView reloadData]; [self.studyListTableView reloadData];
...@@ -104,4 +104,15 @@ ...@@ -104,4 +104,15 @@
} }
#pragma mark - 视频播放百分比
- (void)videoPlayProportion:(NSInteger)proportion withIndexPath:(NSIndexPath *)indexPath
{
VideoListItemTableViewCell *videoPlayCell = [self.studyListTableView cellForRowAtIndexPath:indexPath];
RsStudyTask *studyEntity = self.datasArray[indexPath.section];
CustomStudyEntity *studyList = studyEntity.studyTasks[indexPath.row];
studyList.attachment.playPercent = [NSString stringWithFormat:@"%ld",proportion];
[videoPlayCell.studyProgressView updateChartByCurrent:@(proportion)];
}
@end @end
...@@ -10,8 +10,17 @@ ...@@ -10,8 +10,17 @@
/**
取消、完成代理
*/
@protocol DismissDelegate <NSObject> @protocol DismissDelegate <NSObject>
@optional @optional
/**
取消
*/
- (void)dismissController; - (void)dismissController;
/** /**
......
...@@ -264,13 +264,13 @@ ...@@ -264,13 +264,13 @@
}else { }else {
WS(weakSelf); WS(weakSelf);
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),@"passLevelScore"]; NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(GETINTEGRAL),RECRUITTHROUGH];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
finish.state = ONE; finish.state = ONE;
finish.score = [NSString stringWithFormat:@"%ld",allScore]; finish.score = [NSString stringWithFormat:@"%ld",allScore];
finish.integral = [NSString stringWithFormat:@"+%@",returnValue[@"data"][@"optionValue"]]; finish.integral = [NSString stringWithFormat:@"+%@",returnValue[@"data"]];
[weakSelf showPopoverView:finish]; [weakSelf showPopoverView:finish];
}else { }else {
...@@ -290,6 +290,13 @@ ...@@ -290,6 +290,13 @@
[self.popover dismissPopoverAnimated:YES]; [self.popover dismissPopoverAnimated:YES];
} }
#pragma mark - 取消闯关
- (IBAction)exitButtonClickAction:(UIButton *)sender {
if ([self.delegate respondsToSelector:@selector(dismissController)]) {
[self.delegate dismissController];
}
}
#pragma mark - 弹出框 #pragma mark - 弹出框
- (void)showPopoverView:(BaseViewController *)controller - (void)showPopoverView:(BaseViewController *)controller
{ {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
@protocol CompeteDelegate <NSObject> @protocol CompeteDelegate <NSObject>
@optional
- (void)finish; - (void)finish;
@end @end
......
...@@ -96,7 +96,14 @@ ...@@ -96,7 +96,14 @@
- (void)selectApplicableAction:(UITapGestureRecognizer *)sender - (void)selectApplicableAction:(UITapGestureRecognizer *)sender
{ {
TOPassLevelEntity *entity = self.emigratedResponse.passLevelEntity[sender.view.tag]; TOPassLevelEntity *entity = self.emigratedResponse.passLevelEntity[sender.view.tag];
if ([[self class] compareDateString:entity.endDate]) { //判断闯关任务是否过期
NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];
dateFormat.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *date = [dateFormat dateFromString:entity.endDate];
NSDate *date2 = [date dateByAddingTimeInterval:8 * 60 * 60];//手动增加8小时
int result = [self compareOneDay:[NSDate date] withAnotherDay:date2];
if (result == ONE) {
[XBLoadingView showHUDViewWithText:@"已过期"];return; [XBLoadingView showHUDViewWithText:@"已过期"];return;
} }
AnswerViewController *answer = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AnswerViewController"]; AnswerViewController *answer = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"AnswerViewController"];
...@@ -106,7 +113,7 @@ ...@@ -106,7 +113,7 @@
[self showPopoverView:answer]; [self showPopoverView:answer];
} }
#pragma mark ------- <DismissDelegate> #pragma mark - <DismissDelegate>
#pragma mark - 做题完成 #pragma mark - 做题完成
- (void)dismissController - (void)dismissController
{ {
......
...@@ -20,4 +20,14 @@ ...@@ -20,4 +20,14 @@
*/ */
@property (nonatomic,copy) void(^showApplyDetails)(TOApplyBillEntity *model); @property (nonatomic,copy) void(^showApplyDetails)(TOApplyBillEntity *model);
/**
提现卡号
*/
@property (nonatomic,copy) NSString *bankCardNumber;
/**
提现类型
*/
@property (nonatomic,copy) NSString *billType;
@end @end
...@@ -41,21 +41,21 @@ ...@@ -41,21 +41,21 @@
if ([self.inputRebateTextField.text floatValue] > self.rebateAmount) { if ([self.inputRebateTextField.text floatValue] > self.rebateAmount) {
[XBLoadingView showHUDViewWithText:@"当前账户余额不足"];return; [XBLoadingView showHUDViewWithText:@"当前账户余额不足"];return;
} }
if ([self.inputRebateTextField.text floatValue] <= 0) { if ([self.inputRebateTextField.text floatValue] <= 10) {
[XBLoadingView showHUDViewWithText:@"格式不正确"];return; [XBLoadingView showHUDViewWithText:@"提现金额不能小于10"];return;
} }
if ([self includeChinese:self.inputRebateTextField.text]) { if ([self includeChinese:self.inputRebateTextField.text]) {
[XBLoadingView showHUDViewWithText:@"格式不正确"];return; [XBLoadingView showHUDViewWithText:@"格式不正确"];return;
} }
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:[NSString stringWithFormat:@"请确认提现金额:%@元",self.inputRebateTextField.text] preferredStyle:UIAlertControllerStyleAlert]; [self promptBoxWithMessage:[NSString stringWithFormat:@"请确认提现金额:%@元",self.inputRebateTextField.text] cancelBlock:^{
[alertVC addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
} sureBlock:^{
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
ApplyRequest *withdrawal = [[ApplyRequest alloc] init]; ApplyRequest *withdrawal = [[ApplyRequest alloc] init];
withdrawal.amount = [NSNumber numberWithFloat:[self.inputRebateTextField.text floatValue]]; withdrawal.amount = [NSNumber numberWithFloat:[weakSelf.inputRebateTextField.text floatValue]];
withdrawal.billType = nil; withdrawal.billType = weakSelf.billType;
withdrawal.bankCardNumber = @""; withdrawal.bankCardNumber = weakSelf.bankCardNumber;
NSLog(@"%@",[[withdrawal toDictionary] JSONString]);
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(WITHDRAWAL) WithRequestType:ZERO WithParameter:withdrawal WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkRequestWithURL:SERVERREQUESTURL(WITHDRAWAL) WithRequestType:ZERO WithParameter:withdrawal WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
...@@ -70,12 +70,7 @@ ...@@ -70,12 +70,7 @@
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
[XBLoadingView showHUDViewWithText:error.localizedDescription]; [XBLoadingView showHUDViewWithText:error.localizedDescription];
}]; }];
}];
}]];
[alertVC addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
[self presentViewController:alertVC animated:YES completion:nil];
} }
#pragma mark - 提现申请成功 #pragma mark - 提现申请成功
......
...@@ -81,11 +81,6 @@ ...@@ -81,11 +81,6 @@
/*******************************/ /*******************************/
/**
* 账户数据
*/
@property (nonatomic,strong) EarningsResponse *model;
/** /**
* 我的卡劵包 * 我的卡劵包
*/ */
...@@ -102,9 +97,13 @@ ...@@ -102,9 +97,13 @@
@property (nonatomic,strong) EarningsResponse *resultEntity; @property (nonatomic,strong) EarningsResponse *resultEntity;
@end
//欧普奖励
NSString *const commission = @"commission";
//红包
NSString *const redPackage = @"redPackage";
@end
@implementation RebateViewController @implementation RebateViewController
...@@ -139,7 +138,7 @@ ...@@ -139,7 +138,7 @@
// 我的抽奖 // 我的抽奖
LuckyDrawDetailsViewController *draw = [[[self class] getMainStoryboardClass]instantiateViewControllerWithIdentifier:@"LuckyDrawDetailsViewController"]; LuckyDrawDetailsViewController *draw = [[[self class] getMainStoryboardClass]instantiateViewControllerWithIdentifier:@"LuckyDrawDetailsViewController"];
[self addChildViewController:draw]; [self addChildViewController:draw];
draw.drawValue = 0; draw.drawValue = ZERO;
[self.drawBackgroundView addSubview:draw.view]; [self.drawBackgroundView addSubview:draw.view];
} }
...@@ -193,25 +192,30 @@ ...@@ -193,25 +192,30 @@
self.oppleRewardAmountLabel.attributedText = oppleReward; self.oppleRewardAmountLabel.attributedText = oppleReward;
self.currentAmountLabel.text = [NSString stringWithFormat:@"%.2f",[response.redPackageAccountTotal floatValue] + [response.accountTotal floatValue]]; self.currentAmountLabel.text = [NSString stringWithFormat:@"%.2f",[response.redPackageAccountTotal floatValue] + [response.accountTotal floatValue]];
self.productRebateAmountLabel.text = [NSString stringWithFormat:@"%.2f",[response.accountTotal floatValue]]; self.productRebateAmountLabel.text = [NSString stringWithFormat:@"%.2f",[response.accountTotal floatValue]];
self.productRebateYesterdayAmountLabel.text = [NSString stringWithFormat:@"冻结金额:%.2f",[response.yesterdayEarnings floatValue]]; self.productRebateYesterdayAmountLabel.text = [NSString stringWithFormat:@"昨日收益:%.2f",[response.yesterdayEarnings floatValue]];
self.productRebateHistoryAmountLabel.text = [NSString stringWithFormat:@"历史收益:%.2f",[response.historyEarning floatValue]]; self.productRebateHistoryAmountLabel.text = [NSString stringWithFormat:@"历史收益:%.2f",[response.historyEarning floatValue]];
self.productRebateFreezeAmountLabel.text = [NSString stringWithFormat:@"昨日收益:%.2f",[response.applytotal floatValue]]; self.productRebateFreezeAmountLabel.text = [NSString stringWithFormat:@"冻结金额:%.2f",[response.applytotal floatValue]];
self.oppleRewardYesterdayAmountLabel.text = [NSString stringWithFormat:@"昨日收益:%.2f",[response.redPackageYesterdayEarnings floatValue]]; self.oppleRewardYesterdayAmountLabel.text = [NSString stringWithFormat:@"昨日收益:%.2f",[response.redPackageYesterdayEarnings floatValue]];
self.oppleRewardHistoryAmountLabel.text = [NSString stringWithFormat:@"历史收益:%.2f",[response.redPackageHistoryEarning floatValue]]; self.oppleRewardHistoryAmountLabel.text = [NSString stringWithFormat:@"历史收益:%.2f",[response.redPackageHistoryEarning floatValue]];
self.oppleRewardFreezeAmountLabel.text = [NSString stringWithFormat:@"冻结金额:%.2f",[response.redPackageApplytotal floatValue]]; self.oppleRewardFreezeAmountLabel.text = [NSString stringWithFormat:@"冻结金额:%.2f",[response.redPackageApplytotal floatValue]];
self.oppleRewardAmountLabel.text = [NSString stringWithFormat:@"%.2f",[response.redPackageAccountTotal floatValue]]; self.oppleRewardAmountLabel.text = [NSString stringWithFormat:@"%.2f",[response.redPackageAccountTotal floatValue]];
// self.productRebateButton.enabled = response.isUsable;
// self.oppleRewardButton.enabled = response.isUsable;
} }
#pragma mark - 提现<tag == 100 产品返利><tag == 101 欧普奖励> #pragma mark - 提现<tag == 100 产品返利><tag == 101 欧普奖励>
- (IBAction)withdrawalButtonClickAction:(UIButton *)sender { - (IBAction)withdrawalButtonClickAction:(UIButton *)sender {
if (!self.resultEntity.bankCards.count) {
[self showUnboundedAlertView];
}
// if (!self.resultEntity.isUsable) {
// [self promptCustomerTitle:@"我知道了" withMessage:@"只能在周二和周五发起提现申请!" finish:nil];
// return;
// }
WS(weakSelf); WS(weakSelf);
RebateDetailsViewController *rebateDetails = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"RebateDetailsViewController"]; RebateDetailsViewController *rebateDetails = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"RebateDetailsViewController"];
rebateDetails.rebateAmount = [self.model.accountTotal floatValue]-[self.model.applytotal floatValue]; rebateDetails.rebateAmount = (sender.tag == 100)?[self.resultEntity.accountTotal floatValue]:[self.resultEntity.redPackageAccountTotal floatValue];
rebateDetails.billType = (sender.tag == 100)?commission:redPackage;
[rebateDetails setShowApplyDetails:^(TOApplyBillEntity *entity) { [rebateDetails setShowApplyDetails:^(TOApplyBillEntity *entity) {
WithdrawalTableViewController *detailVC = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"WithdrawalTableViewController"]; WithdrawalTableViewController *detailVC = [[[self class] getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"WithdrawalTableViewController"];
detailVC.model = entity; detailVC.model = entity;
...@@ -272,7 +276,7 @@ ...@@ -272,7 +276,7 @@
[XBLoadingView showHUDViewWithDefault]; [XBLoadingView showHUDViewWithDefault];
WS(weakSelf); WS(weakSelf);
TOBankCardEntity *entity = self.resultEntity.bankCards[0]; TOBankCardEntity *entity = self.resultEntity.bankCards[0];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(UNBINDING),entity.bankAccount] WithRequestType:ZERO WithParameter:nil WithReturnValueBlock:^(id returnValue) { [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:[NSString stringWithFormat:SERVERREQUESTURL(UNBINDING),entity.bankAccount] WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[XBLoadingView hideHUDViewWithDefault]; [XBLoadingView hideHUDViewWithDefault];
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
{ {
if (_dataArray == nil) { if (_dataArray == nil) {
_dataArray = [NSMutableArray arrayWithObjects:@"体验中心",@"场景库",@"产品库",@"客户管理",@"学习中心",@"关于", nil]; _dataArray = [NSMutableArray arrayWithObjects:@"体验中心",@"场景库",@"产品库",@"客户管理",@"学习中心",@"关于", nil];
if (![[Shoppersmanager manager].Shoppers.employee.userKey isEqualToString:@"学习人员"]) { if ([[Shoppersmanager manager].Shoppers.employee.userKey rangeOfString:@"学习人员"].location == NSNotFound) {
[_dataArray removeObject:@"学习中心"]; [_dataArray removeObject:@"学习中心"];
} }
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -165,9 +165,16 @@ ...@@ -165,9 +165,16 @@
@return 是否比当前时间大 @return 是否比当前时间大
*/ */
+ (BOOL)compareDateString:(NSString *)dateString; - (int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay;
/**
转换秒钟
@param totalSeconds 秒数
*/
- (NSString *)timeFormatted:(NSInteger)totalSeconds;
......
...@@ -566,22 +566,44 @@ ...@@ -566,22 +566,44 @@
} }
/** #pragma mark -比较两个NSDate的大小
比较时间大小 - (int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay
@param dateString 时间字符串
@return 是否比当前时间大
*/
+ (BOOL)compareDateString:(NSString *)dateString
{ {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd 23:59:59"]; [dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *endDate = [dateFormatter dateFromString:dateString]; NSString *oneDayStr = [dateFormatter stringFromDate:oneDay];
if ([endDate compare:[NSDate date]] == NSOrderedAscending) { NSString *anotherDayStr = [dateFormatter stringFromDate:anotherDay];
return YES; NSDate *dateA = [dateFormatter dateFromString:oneDayStr];
NSDate *dateB = [dateFormatter dateFromString:anotherDayStr];
NSComparisonResult result = [dateA compare:dateB];
if (result == NSOrderedDescending) {
return 1;
} }
return NO; else if (result == NSOrderedAscending){
return -1;
}
return 0;
}
/**
转换秒钟
@param totalSeconds 秒数
*/
- (NSString *)timeFormatted:(NSInteger)totalSeconds
{
NSInteger seconds = totalSeconds % 60;
NSInteger minutes = (totalSeconds / 60) % 60;
NSInteger hours = totalSeconds / 3600;
if (!hours && !minutes && seconds) {
return [NSString stringWithFormat:@"%02ld秒", seconds];
}else if (!hours && minutes){
return [NSString stringWithFormat:@"%02ld分:%02ld秒",minutes,seconds];
}else if (hours && minutes) {
return [NSString stringWithFormat:@"%02ld时:%02ld分:%02ld秒",hours, minutes, seconds];
}
return nil;
} }
......
...@@ -426,7 +426,12 @@ extern NSString *const UNBINDING; ...@@ -426,7 +426,12 @@ extern NSString *const UNBINDING;
/** /**
* 学习完成 * 学习完成
*/ */
extern NSString *const FINISHSTUDY ; extern NSString *const FINISHSTUDY;
/**
* 附件播放时间
*/
extern NSString *const ATTACHMENTPLAYTIME;
/*****************************************接口地址*****************************************/ /*****************************************接口地址*****************************************/
...@@ -580,4 +585,18 @@ extern NSString *const PROMPTDRAWINFORMATION; ...@@ -580,4 +585,18 @@ extern NSString *const PROMPTDRAWINFORMATION;
*/ */
extern NSString *const NOTREADANNOUNCEMENT; extern NSString *const NOTREADANNOUNCEMENT;
/**
* 学习完成
*/
extern NSString *const STUDYFINISH;
/**
* 考核通过
*/
extern NSString *const INSPECTIONTHROUGH;
/**
* 闯关通过
*/
extern NSString *const RECRUITTHROUGH;
...@@ -348,9 +348,9 @@ NSString *const THROUGHLIST = @"/passLevel/query"; ...@@ -348,9 +348,9 @@ NSString *const THROUGHLIST = @"/passLevel/query";
NSString *const SUBMITANSWER = @"/study/submitStudyResult"; NSString *const SUBMITANSWER = @"/study/submitStudyResult";
/** /**
* 获取相应分数对应的积分 * 获取对应的积分
*/ */
NSString *const GETINTEGRAL = @"/option/get/%@"; NSString *const GETINTEGRAL = @"/score/getScoreRule/%@";
/** /**
* 获取闯关详情 * 获取闯关详情
...@@ -421,6 +421,11 @@ NSString *const UNBINDING = @"/applybill/unbind/%@"; ...@@ -421,6 +421,11 @@ NSString *const UNBINDING = @"/applybill/unbind/%@";
* 学习完成 * 学习完成
*/ */
NSString *const FINISHSTUDY = @"/study/finishStudy/%@/%@"; NSString *const FINISHSTUDY = @"/study/finishStudy/%@/%@";
/**
* 附件播放时间
*/
NSString *const ATTACHMENTPLAYTIME = @"/attachment/play";
/*****************************************接口地址*****************************************/ /*****************************************接口地址*****************************************/
...@@ -579,4 +584,17 @@ NSString *const PROMPTDRAWINFORMATION = @"PROMPTDRAWINFORMATION"; ...@@ -579,4 +584,17 @@ NSString *const PROMPTDRAWINFORMATION = @"PROMPTDRAWINFORMATION";
*/ */
NSString *const NOTREADANNOUNCEMENT = @"NOTREADANNOUNCEMENT"; NSString *const NOTREADANNOUNCEMENT = @"NOTREADANNOUNCEMENT";
/**
* 学习完成
*/
NSString *const STUDYFINISH = @"5";
/**
* 考核通过
*/
NSString *const INSPECTIONTHROUGH = @"6";
/**
* 闯关通过
*/
NSString *const RECRUITTHROUGH = @"7";
...@@ -180,6 +180,7 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -180,6 +180,7 @@ extern NSString * const GRADEMETHOD_MANUL;
@class TOShopcartEntity; @class TOShopcartEntity;
@class TOStudyEmployeeEntity; @class TOStudyEmployeeEntity;
@class TOStudyResultEntity; @class TOStudyResultEntity;
@class TOAttachmentPlayEntity;
@class TOStudyTopicEntity; @class TOStudyTopicEntity;
@class TOStudyTypeEntity; @class TOStudyTypeEntity;
@class Action; @class Action;
...@@ -268,6 +269,7 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -268,6 +269,7 @@ extern NSString * const GRADEMETHOD_MANUL;
@protocol RsCommissionRequest @end @protocol RsCommissionRequest @end
@protocol DataPage @end @protocol DataPage @end
@protocol PageRows @end @protocol PageRows @end
@protocol TOAttachmentPlayEntity @end
@protocol RsResponse @end @protocol RsResponse @end
@protocol FunctionInfo @end @protocol FunctionInfo @end
@protocol LoginResult @end @protocol LoginResult @end
...@@ -789,6 +791,23 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -789,6 +791,23 @@ extern NSString * const GRADEMETHOD_MANUL;
@end /* interface ForumTopicCondition */ @end /* interface ForumTopicCondition */
@interface TOAttachmentPlayEntity : JSONModel
@property (nonatomic,copy) NSString *fid;
@property (nonatomic,copy) NSString *employeeId;
@property (nonatomic,copy) NSString *attachmentId;
@property (nonatomic,copy) NSString *playTime;
@property (nonatomic,copy) NSString *playPercent;
//{
//"id": "string",
//"employeeId": "string",
//"attachmentId": "string",
//"playTime": "string",
//"playPercent": "string"
//}
@end
/** /**
* @author Administrator * @author Administrator
...@@ -1688,6 +1707,12 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -1688,6 +1707,12 @@ extern NSString * const GRADEMETHOD_MANUL;
* *
*/ */
@property (nonatomic, copy) NSString *playTime; @property (nonatomic, copy) NSString *playTime;
/**
* 播放百分比
*
*
*/
@property (nonatomic, copy) NSString *playPercent;
@end /* interface TOAttachmentEntity */ @end /* interface TOAttachmentEntity */
...@@ -3608,7 +3633,7 @@ extern NSString * const GRADEMETHOD_MANUL; ...@@ -3608,7 +3633,7 @@ extern NSString * const GRADEMETHOD_MANUL;
* *
* *
*/ */
@property (nonatomic, assign) NSInteger examResult; @property (nonatomic, copy) NSString *examResult;
/** /**
* 学习内容 * 学习内容
* *
......
...@@ -1373,6 +1373,18 @@ NSString * const SORTDIRECTION_DESC = @"desc"; ...@@ -1373,6 +1373,18 @@ NSString * const SORTDIRECTION_DESC = @"desc";
} }
@end
@implementation TOAttachmentPlayEntity
+(JSONKeyMapper*)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"id": @"fid",
}];
}
@end @end
NSString * const STUDYTASKSTATE_INITIAL = @"initial"; NSString * const STUDYTASKSTATE_INITIAL = @"initial";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment