From 64b0493e4bd40c46e341fd5de9f1862998c431b0 Mon Sep 17 00:00:00 2001
From: lijunda <475576921@qq.com>
Date: Thu, 16 Aug 2018 16:35:30 +0800
Subject: [PATCH] 无修改,测试混淆代码
---
pregnancy_guard/BaseProject/Controller/Mine/MusicSetPage.m | 393 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 387 insertions(+), 6 deletions(-)
diff --git a/pregnancy_guard/BaseProject/Controller/Mine/MusicSetPage.m b/pregnancy_guard/BaseProject/Controller/Mine/MusicSetPage.m
index a8273f7..51e6925 100644
--- a/pregnancy_guard/BaseProject/Controller/Mine/MusicSetPage.m
+++ b/pregnancy_guard/BaseProject/Controller/Mine/MusicSetPage.m
@@ -7,13 +7,24 @@
//
#import "MusicSetPage.h"
+#import "CSAudioManager.h"
+#import "NetworkSingleton.h"
#import "MusicPlayCell.h"
-#import "HotelAccount.h"
+#import "MusicModel.h"
+#import "SysTipsView.h"
+#import "QWAlertView.h"
+#import "SysSoundSetPage.h"
+#import "BaseNaviController.h"
-@interface MusicSetPage ()<UITableViewDelegate,UITableViewDataSource,musicPlayDelegate>
-
+@interface MusicSetPage ()<UITableViewDelegate,UITableViewDataSource,musicPlayDelegate,SelectedActionDelegate>
+{
+
+}
+@property (nonatomic,strong) NSData *mp3Data;
+@property (nonatomic,strong) CSAudioManager *csManager;
@property(nonatomic,strong) UITableView * tableView;
@property (nonatomic, strong) NSMutableArray *modelArray;
+@property (nonatomic, strong) SysTipsView * sysTipsView; // ������������
@end
@implementation MusicSetPage
@@ -40,10 +51,273 @@
return _tableView;
}
+- (SysTipsView *)sysTipsView
+{
+ if(!_sysTipsView)
+ {
+ _sysTipsView = [[SysTipsView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) tipsTitle:@"������������" tipsContext:@"���������������������������"];
+ self.sysTipsView.delegate = self;
+ }
+ else
+ {
+ [_sysTipsView setHidden:FALSE];
+ }
+
+ return _sysTipsView;
+}
+
+- (void)didSelectedAction:(NSInteger)type
+{
+ [self.sysTipsView setHidden:TRUE];
+ [[QWAlertView sharedMask] dismiss];
+
+ // ������������
+ if (type == 1)
+ {
+ [self.csManager stopAllMusic];
+ [self.modelArray removeAllObjects];
+
+ MusicModel * model1 = [[MusicModel alloc] init];
+ model1.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model1.user_id = [NSString stringWithFormat:@"%@",@"ID0001"];
+ model1.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model1.musicStatus = 0;
+ model1.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music.mp3"];
+ [self.modelArray addObject:model1];
+
+ MusicModel * model2 = [[MusicModel alloc] init];
+ model2.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model2.user_id = [NSString stringWithFormat:@"%@",@"ID0002"];
+ model2.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model2.musicStatus = 0;
+ model2.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music1.mp3"];
+ [self.modelArray addObject:model2];
+
+ MusicModel * model3 = [[MusicModel alloc] init];
+ model3.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model3.user_id = [NSString stringWithFormat:@"%@",@"ID0003"];
+ model3.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model3.musicStatus = 0;
+ model3.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music2.mp3"];
+
+ [self.modelArray addObject:model3];
+
+ [self.tableView reloadData];
+ }
+}
+
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
+ self.navigationItem.title = @"������������";
+ [self setNavigationLeft:@"������" sel:@selector(backAction)];
+ [self setNavigationRight:@"������" sel:@selector(resetAction)];
+
+
+ self.csManager = [CSAudioManager defaultManager];
+ self.mp3Data = nil;
+
+ MPWeakSelf(self);
+ [self.csManager setBlockPlayerStartPlay:^{
+ NSLog(@"���������-������������������");
+ [weakself.tableView reloadData];
+ }];
+
+ [self.csManager setBlockPlayerStopPlay:^{
+ NSLog(@"���������-������������������");
+ [weakself.tableView reloadData];
+ }];
+
+ [self.csManager setBlockPlayerDidFinishPlaying:^{
+ NSLog(@"���������-���������������������");
+ //[weakself.tableView reloadData];
+ }];
+
+
+ //������������������������������������������CSAudioManager.h ���������
+ //[self.csManager playSoundWithSoundName:@"sms-received1" PlayID:kPlayID2];
+
+
+ self.modelArray = [[NSMutableArray alloc] init];
+// @property(nonatomic, strong) NSString * _id;
+// @property(nonatomic, strong) NSString * user_id;
+// @property(nonatomic, strong) NSString * username;
+// @property(nonatomic, strong) NSString * musicName;
+// @property(nonatomic, strong) NSString * musicUrl; // ������������
+// @property(nonatomic, strong) NSString * xuhaoIndex;
+//
+// @property(nonatomic, assign) int cmd; // 1 ������ 2 ������������
+// @property(nonatomic, assign) int playStatus; // ������0 ������������������ 1 ������������ 2 ������������
+// @property(nonatomic, assign) int musicStatus; // ������0 ������������������ 1 ������������ 2 ������������
+// @property(nonatomic, assign) NSInteger indexRow; // ������������ http://yfsapi.7drlb.com/video/music.mp3
+
+// [UserDefault stringForKey:@"username"]
+ // 0 ������ 1 ���������
+ NSInteger musicStatus1 = [UserDefault integerForKey:@"musicStatus1"];
+ NSInteger musicStatus2 = [UserDefault integerForKey:@"musicStatus2"];
+ NSInteger musicStatus3 = [UserDefault integerForKey:@"musicStatus3"];
+
+ if( musicStatus1 == 0 )
+ {
+ MusicModel * model1 = [[MusicModel alloc] init];
+ model1.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model1.user_id = [NSString stringWithFormat:@"%@",@"ID0001"];
+ model1.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model1.musicStatus = 0;
+ model1.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music.mp3"];
+ [self.modelArray addObject:model1];
+ }
+ else
+ {
+ MusicModel * model1 = [[MusicModel alloc] init];
+ model1.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model1.user_id = [NSString stringWithFormat:@"%@",@"ID0001"];
+ model1.musicName = [UserDefault stringForKey:@"ID0001Name"];
+ model1.musicStatus = 1;
+ model1.musicUrl = [UserDefault stringForKey:@"ID0001PATH"];
+ [self.modelArray addObject:model1];
+ }
+
+
+ if( musicStatus2 == 0 )
+ {
+ MusicModel * model2 = [[MusicModel alloc] init];
+ model2.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model2.user_id = [NSString stringWithFormat:@"%@",@"ID0002"];
+ model2.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model2.musicStatus = 0;
+ model2.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music1.mp3"];
+ [self.modelArray addObject:model2];
+ }
+ else
+ {
+ MusicModel * model2 = [[MusicModel alloc] init];
+ model2.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model2.user_id = [NSString stringWithFormat:@"%@",@"ID0002"];
+ model2.musicName = [UserDefault stringForKey:@"ID0002Name"];
+ model2.musicStatus = 1;
+ model2.musicUrl = [UserDefault stringForKey:@"ID0002PATH"];
+ [self.modelArray addObject:model2];
+ }
+
+ if( musicStatus3 == 0 )
+ {
+ MusicModel * model3 = [[MusicModel alloc] init];
+ model3.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model3.user_id = [NSString stringWithFormat:@"%@",@"ID0003"];
+ model3.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model3.musicStatus = 0;
+ model3.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music2.mp3"];
+
+ [self.modelArray addObject:model3];
+ }
+ else
+ {
+ MusicModel * model3 = [[MusicModel alloc] init];
+ model3.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model3.user_id = [NSString stringWithFormat:@"%@",@"ID0003"];
+ model3.musicName = [UserDefault stringForKey:@"ID0003Name"];
+ model3.musicStatus = 1;
+ model3.musicUrl = [UserDefault stringForKey:@"ID0003PATH"];
+
+ [self.modelArray addObject:model3];
+ }
+
+ self.tableView.hidden = NO;
+ [self.tableView reloadData];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+
+ [self.modelArray removeAllObjects];
+ // 0 ������ 1 ���������
+ NSInteger musicStatus1 = [UserDefault integerForKey:@"musicStatus1"];
+ NSInteger musicStatus2 = [UserDefault integerForKey:@"musicStatus2"];
+ NSInteger musicStatus3 = [UserDefault integerForKey:@"musicStatus3"];
+
+ if( musicStatus1 == 0 )
+ {
+ MusicModel * model1 = [[MusicModel alloc] init];
+ model1.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model1.user_id = [NSString stringWithFormat:@"%@",@"ID0001"];
+ model1.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model1.musicStatus = 0;
+ model1.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music.mp3"];
+ [self.modelArray addObject:model1];
+ }
+ else
+ {
+ MusicModel * model1 = [[MusicModel alloc] init];
+ model1.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model1.user_id = [NSString stringWithFormat:@"%@",@"ID0001"];
+ model1.musicName = [UserDefault stringForKey:@"ID0001Name"];
+ model1.musicStatus = 1;
+ model1.musicUrl = [UserDefault stringForKey:@"ID0001PATH"];
+ [self.modelArray addObject:model1];
+ }
+
+
+ if( musicStatus2 == 0 )
+ {
+ MusicModel * model2 = [[MusicModel alloc] init];
+ model2.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model2.user_id = [NSString stringWithFormat:@"%@",@"ID0002"];
+ model2.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model2.musicStatus = 0;
+ model2.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music1.mp3"];
+ [self.modelArray addObject:model2];
+ }
+ else
+ {
+ MusicModel * model2 = [[MusicModel alloc] init];
+ model2.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model2.user_id = [NSString stringWithFormat:@"%@",@"ID0002"];
+ model2.musicName = [UserDefault stringForKey:@"ID0002Name"];
+ model2.musicStatus = 1;
+ model2.musicUrl = [UserDefault stringForKey:@"ID0002PATH"];
+ [self.modelArray addObject:model2];
+ }
+
+ if( musicStatus3 == 0 )
+ {
+ MusicModel * model3 = [[MusicModel alloc] init];
+ model3.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model3.user_id = [NSString stringWithFormat:@"%@",@"ID0003"];
+ model3.musicName = [NSString stringWithFormat:@"%@",@"������"];
+ model3.musicStatus = 0;
+ model3.musicUrl = [NSString stringWithFormat:@"%@",@"http://yfsapi.7drlb.com/video/music2.mp3"];
+
+ [self.modelArray addObject:model3];
+ }
+ else
+ {
+ MusicModel * model3 = [[MusicModel alloc] init];
+ model3.username = [NSString stringWithFormat:@"%@",@"������������"];
+ model3.user_id = [NSString stringWithFormat:@"%@",@"ID0003"];
+ model3.musicName = [UserDefault stringForKey:@"ID0003Name"];
+ model3.musicStatus = 1;
+ model3.musicUrl = [UserDefault stringForKey:@"ID0003PATH"];
+
+ [self.modelArray addObject:model3];
+ }
+
+ self.tableView.hidden = NO;
+ [self.tableView reloadData];
+}
+
+-(void)resetAction
+{
+ [[QWAlertView sharedMask] show:self.sysTipsView withType:(QWAlertViewStyle)QWAlertViewStyleAlert];
+}
+
+-(void)backAction
+{
+ [self.csManager stopAllMusic];
+ [self dismissViewControllerAnimated:YES completion:nil];
+ //[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning
@@ -76,7 +350,18 @@
cell = [[MusicPlayCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
- HotelAccount * model = [self.modelArray objectAtIndex:indexPath.row];
+ cell.delegate = self;
+
+ MusicModel * model = [self.modelArray objectAtIndex:indexPath.row];
+ NSInteger selIndex = [[UserDefault stringForKey:@"video"] integerValue];
+ if( selIndex == indexPath.row )
+ {
+ model.setStatus = 1;
+ }
+
+ model.indexRow = indexPath.row;
+ model._id = [NSString stringWithFormat:@"judqiowu%ld",indexPath.row];
+ model.xuhaoIndex = [NSString stringWithFormat:@"%02ld",indexPath.row+1];
[cell setItemView:model];
return cell;
@@ -99,11 +384,107 @@
//[self showActionForPhoto];
}
-- (void)musicPlaySection:(HotelAccount*)model
+- (void)musicPlaySection:(MusicModel*)model
{
-
+ if ( model.cmd == 1 )
+ {
+ if( model.playStatus == 1 )
+ {
+ // ���������������������������
+// //if( self.mp3Data != nil )
+// {
+// //������������
+// [self.csManager stopMusicWithPlayID:model.user_id];
+// [self.csManager disposeSoundWithPlayID:model.user_id];
+// }
+
+ // ���������������������������
+ for( NSUInteger i = 0; i < self.modelArray.count;i++)
+ {
+ MusicModel * tempModel = [self.modelArray objectAtIndex:i];
+ if( [tempModel._id isEqualToString:model._id] )
+ continue;
+ //������������
+ if(tempModel.playStatus == 1)
+ {
+ [self.csManager stopMusicWithPlayID:tempModel.user_id];
+ [self.csManager disposeSoundWithPlayID:tempModel.user_id];
+ }
+
+ tempModel.playStatus = 0;
+ }
+
+ if( model.musicStatus == 0 )
+ {
+ [self.csManager playingMusicWithURL:[NSURL URLWithString:model.musicUrl] playID:model.user_id];
+ }
+ else
+ {
+
+// NSString *mp3Path = [[NSBundle mainBundle] pathForResource:model.musicUrl ofType:nil];
+// NSLog(@"mp3Path : %@",mp3Path);
+ self.mp3Data = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:model.musicUrl]];
+ //������������
+ [self.csManager playingMusicWithData:self.mp3Data playID:model.user_id];
+ }
+ }
+ else if( model.playStatus == 2 )
+ {
+ //������������
+ [self.csManager stopMusicWithPlayID:model.user_id];
+ }
+ }
+ else if( model.cmd == 2 )
+ {
+ [self.csManager stopAllMusic];
+ // ������������������������
+ SysSoundSetPage* Page = [[SysSoundSetPage alloc] initIsFirstPage:NO];
+ Page.soundIndex = [model.xuhaoIndex integerValue];
+ BaseNaviController *baseNav = [[BaseNaviController alloc] initWithRootViewController:Page];
+ [self presentViewController:baseNav animated:YES completion:nil];
+ }
}
+
+-(void)update_video:(MusicModel *)model
+{
+ //[UserDefault stringForKey:@"user_id"]
+ NSString *path = [[NSString alloc] initWithFormat:UPDATE_USERINFO];
+
+ NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
+
+ //['refresh_frequency', 'video', 'is_open_upload']
+ [param setValue:[UserDefault stringForKey:@"user_id"] forKey:@"user_id"];
+ [param setValue:@"video" forKey:@"field"]; // 1 ������ 0 ������
+ [param setValue:[NSString stringWithFormat:@"%ld",model.indexRow] forKey:@"value"];
+
+ MPWeakSelf(self);
+ [NetworkSingleton networkingGetMethod:param urlName:path success:^(id responseBody)
+ {
+ MPStrongSelf(self);
+ BaseResModel * resModel = [Global toBaseModel:responseBody];
+
+ if(resModel.code == 0)
+ {
+ [UserDefault setObject:[NSString stringWithFormat:@"%ld",model.indexRow] forKey:@"video"];
+ [UserDefault synchronize];
+
+ [self.tableView reloadData];
+ [Global alertMessageEx:resModel.desc title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
+ }
+ else
+ {
+ [Global alertMessageEx:resModel.desc title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
+ }
+ }
+ failure:^(NSString *error)
+ {
+
+ [Global alertMessageEx:error title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
+ }];
+}
+
+
/*
#pragma mark - Navigation
--
Gitblit v1.8.0