From 25f409185a53e5e7beb17518a684298d92d31b3f Mon Sep 17 00:00:00 2001
From: 单军华 <WindShan@danjunhuas-MacBook-Pro.local>
Date: Fri, 04 May 2018 13:34:53 +0800
Subject: [PATCH] iPhone x 屏幕适配修改

---
 pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m |  435 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 387 insertions(+), 48 deletions(-)

diff --git a/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m b/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m
index d0cf052..f528e9b 100644
--- a/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m
+++ b/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m
@@ -28,6 +28,12 @@
 #import<BaiduMapAPI_Search/BMKPoiSearchType.h>
 #import "DataModel.h"
 #import "UIImage+animatedGIF.h"
+#import "UploadData.h"
+#import "AdNoticeView.h"
+#import "NoticeModel.h"
+#import "MusicModel.h"
+#import "CSAudioManager.h"
+
 @interface RadiaDetectionPage ()<ASValueTrackingSliderDelegate,ASValueTrackingSliderDataSource,cbCharacteristicManagerDelegate,BMKMapViewDelegate,BMKLocationServiceDelegate>
 {
     ZZCircleProgress *circle3;
@@ -83,7 +89,16 @@
     UIImageView * ic_zhishu_bk;
     UIImageView * ic_weixin_tips;
     UIImageView * ic_dianyuan;
+    BOOL        bOpenConnectBLE;
+    MusicModel * model1;
+    MusicModel * model2;
+    MusicModel * model3;
 }
+
+@property (nonatomic, strong) AdNoticeView * adNoticeView; // ������������
+@property (nonatomic,strong) CSAudioManager *csManager;
+@property (nonatomic,strong) NSData *mp3Data;
+@property (nonatomic, strong) NSMutableArray *modelArray;
 @end
 
 
@@ -177,11 +192,14 @@
         
         deviceStstaus = 2;
         deviceStatusLabel.text = @"���������";
-        if (myTimer == nil)
-            myTimer =  [NSTimer scheduledTimerWithTimeInterval:[myTimeInterval doubleValue] target:self selector:@selector(data_upload) userInfo:nil repeats:YES];
-        else
-            //���������������
-            [myTimer setFireDate:[NSDate distantPast]];
+        if ([is_open_upload intValue] == 1)
+        {
+            if (myTimer == nil)
+                myTimer =  [NSTimer scheduledTimerWithTimeInterval:[myTimeInterval doubleValue] target:self selector:@selector(data_upload) userInfo:nil repeats:YES];
+            else
+                //���������������
+                [myTimer setFireDate:[NSDate distantPast]];
+        }
         //���myTimeInterval���������������data_upload���������
     }
 }
@@ -273,15 +291,16 @@
                 
                 //dataModelArr
                 DataModel * model = [[DataModel alloc]init];
-                model.value = [_BiaozhunJiliangNumLabel.text floatValue];
-                model.time  = [DateUtil stringFromDateYMD:[NSDate date]];
-                model.type = 0;
-                model.is_warn = 0;
+                model.value = _BiaozhunJiliangNumLabel.text;
+                model.time  = [DateUtil stringFromDateYMDHMS:[NSDate date]];
+                model.type = @"0";
+                model.is_warn = @"0";
                 
-                if(model.value < 0.16)
+                if([model.value floatValue] < 0.16)
                 {
+                    [self.csManager stopAllMusic];
                     // 100
-                    circle3.progress = model.value*100;
+                    circle3.progress = [model.value floatValue]*100;
                     _currentShuziTipsLabel.text = @"������������������";
                     _currentTipsLabel.textColor = RgbColor(64, 159, 252);
                     _currentTipsLabel.text = @"������������������������������\n ������������������������������������������������";
@@ -295,10 +314,11 @@
 //                    _currentTipsLabel.textColor = kUIColorFromRGB(0x848787);
 
                 }
-                else if(model.value >= 0.16 && model.value  < 0.8)
+                else if([model.value floatValue] >= 0.16 && [model.value floatValue]  < 0.8)
                 {
+                    [self.csManager stopAllMusic];
                     // 100
-                    float tempValue = model.value;
+                    float tempValue = [model.value floatValue];
                     if(tempValue > 0.50)
                         tempValue = 0.50;
                     
@@ -306,7 +326,7 @@
                     _currentShuziTipsLabel.text = @"���������������������������";
                     _currentTipsLabel.textColor = RgbColor(64, 159, 252);
                     _currentTipsLabel.text = @"������������������������������\n ���������������������������������������������������";
-                    model.is_warn = 1;
+                    model.is_warn = @"1";
                     
                     _AnquanStatustLabel.text = @"������";
                     _AnquanStatustLabel.textColor = kUIColorFromRGB(0x0d95fe);
@@ -315,11 +335,26 @@
                     ic_weixin_tips.image = [UIImage imageNamed:@"icon_qingwei"];
                     ic_zhishu_bk.image = [UIImage imageNamed:@"ic_zhishu_bk"];
                     _currentTipsLabel.textColor = kUIColorFromRGB(0x848787);
+                    
+                    MusicModel * model = [self.modelArray objectAtIndex:0];
+                    
+                    if( model.musicStatus == 0 )
+                    {
+                        [self.csManager playingMusicWithURL:[NSURL URLWithString:model.musicUrl]  playID:model.user_id];
+                    }
+                    else
+                    {
+                        self.mp3Data = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:model.musicUrl]];
+                        //������������
+                        [self.csManager playingMusicWithData:self.mp3Data playID:model.user_id];
+                    }
                 }
-                else if(model.value >= 0.8 && model.value < 2)
+                else if([model.value floatValue] >= 0.8 && [model.value floatValue] < 2)
                 {
+                    [self.csManager stopAllMusic];
+                    
                     // 264
-                    float tempValue = (model.value*100)/266;
+                    float tempValue = ([model.value floatValue]*100)/266;
                     if(tempValue <= 0.50)
                         tempValue = 0.51;
                     
@@ -327,7 +362,7 @@
                     _currentShuziTipsLabel.text = @"���������������������������";
                     _currentTipsLabel.textColor = RgbColor(252, 80,		 84);
                     _currentTipsLabel.text = @"������������������������������\n ���������������������������������������������������";
-                    model.is_warn = 1;
+                    model.is_warn = @"1";
                     
                     _AnquanStatustLabel.text = @"������";
                     _AnquanStatustLabel.textColor = kUIColorFromRGB(0xc240ff);
@@ -336,12 +371,25 @@
                     ic_weixin_tips.image = [UIImage imageNamed:@"icon_zhongdu"];
                     ic_zhishu_bk.image = [UIImage imageNamed:@"bt_zise"];
                     _currentTipsLabel.textColor = kUIColorFromRGB(0x848787);
-                }
-                else if(model.value >2)
-                {
-                    // 400
                     
-                    float tempValue = (model.value*100)/400;
+                    MusicModel * model = [self.modelArray objectAtIndex:1];
+                    
+                    if( model.musicStatus == 0 )
+                    {
+                        [self.csManager playingMusicWithURL:[NSURL URLWithString:model.musicUrl]  playID:model.user_id];
+                    }
+                    else
+                    {
+                        self.mp3Data = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:model.musicUrl]];
+                        //������������
+                        [self.csManager playingMusicWithData:self.mp3Data playID:model.user_id];
+                    }
+                }
+                else if([model.value floatValue] >2)
+                {
+                    [self.csManager stopAllMusic];
+                    // 400
+                    float tempValue = ([model.value floatValue]*100)/400;
                     if(tempValue <= 0.75)
                         tempValue = 0.76;
                     
@@ -350,7 +398,7 @@
                     _currentShuziTipsLabel.text = @"������������������������������";
                     _currentTipsLabel.textColor = RgbColor(252, 80, 84);
                     _currentTipsLabel.text = @"������������������������������\n ���������������������������������������������������";
-                    model.is_warn = 1;
+                    model.is_warn = @"1";
                     
                     _AnquanStatustLabel.text = @"������";
                     _AnquanStatustLabel.textColor = kUIColorFromRGB(0xff4e63);
@@ -359,6 +407,19 @@
                     ic_weixin_tips.image = [UIImage imageNamed:@"icon_yanzhong"];
                     ic_zhishu_bk.image = [UIImage imageNamed:@"ic_yanzhong_tips"];
                     _currentTipsLabel.textColor = kUIColorFromRGB(0x848787);
+                    
+                    MusicModel * model = [self.modelArray objectAtIndex:2];
+                    
+                    if( model.musicStatus == 0 )
+                    {
+                        [self.csManager playingMusicWithURL:[NSURL URLWithString:model.musicUrl]  playID:model.user_id];
+                    }
+                    else
+                    {
+                        self.mp3Data = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:model.musicUrl]];
+                        //������������
+                        [self.csManager playingMusicWithData:self.mp3Data playID:model.user_id];
+                    }
                 }
                 
                 [_trackingSlider setValue:circle3.progress];
@@ -367,7 +428,7 @@
                 [dataModelArr addObject:model];
             }
         }
-        else if(receiveHexValue.length == 16 )
+        else if(receiveHexValue.length == 8 )
         {
             // ������������������
             NSString * baoTouStr = [receiveHexValue substringWithRange:NSMakeRange(0,2)];
@@ -376,14 +437,47 @@
                 NSString * timeValueStr = [receiveHexValue substringWithRange:NSMakeRange(2,8)];
                 //dataModelArr
                 DataModel * model = [[DataModel alloc]init];
-                model.value = [timeValueStr floatValue];
-                model.time  = [DateUtil stringFromDateYMD:[NSDate date]];
-                model.type = 1;
-                model.is_warn = 0;
+                model.value = timeValueStr;
+                model.time  = [DateUtil stringFromDateYMDHMS:[NSDate date]];
+                model.type = @"1";
+                model.is_warn = @"0";
                 
                 [dataModelArr addObject:model];
             }
         }
+        else if(receiveHexValue.length == 16 )
+         {
+             // ������������������
+             NSString * baoTouStr = [receiveHexValue substringWithRange:NSMakeRange(0,2)];
+             if( [baoTouStr isEqualToString: @"3A"])
+             {
+                 NSString * yearValueStr = [receiveHexValue substringWithRange:NSMakeRange(2,2)];
+                 NSString * mounthValueStr = [receiveHexValue substringWithRange:NSMakeRange(4,2)];
+                 NSString * dayValueStr = [receiveHexValue substringWithRange:NSMakeRange(6,2)];
+                 NSString * hourValueStr = [receiveHexValue substringWithRange:NSMakeRange(8,2)];
+                 NSString * dataValueStr = [receiveHexValue substringWithRange:NSMakeRange(10,4)];
+                 
+                 NSString * yearValue = [NSString stringWithFormat:@"%lu",strtoul([yearValueStr UTF8String],0,16)];
+                 NSString * mounthValue = [NSString stringWithFormat:@"%lu",strtoul([mounthValueStr UTF8String],0,16)];
+                 NSString * dayValue = [NSString stringWithFormat:@"%lu",strtoul([dayValueStr UTF8String],0,16)];
+                 NSString * hourValue = [NSString stringWithFormat:@"%lu",strtoul([hourValueStr UTF8String],0,16)];
+                 
+                 NSString * timeFormatValue = [NSString stringWithFormat:@"20%@-%02d-%02d %02d:00",yearValue,[mounthValue intValue],[dayValue intValue],[hourValue intValue]];
+                 
+                 NSString * dataValue = [NSString stringWithFormat:@"%lu",strtoul([dataValueStr UTF8String],0,16)];
+   
+                 //dataModelArr
+                 DataModel * model = [[DataModel alloc]init];
+                 model.value = [NSString stringWithFormat:@"%.1f",[dataValue floatValue]*0.01];;
+                 model.time  = timeFormatValue;
+                 model.type = @"1";
+                 model.is_warn = @"0";
+                 
+                 [dataModelArr addObject:model];
+                 
+                 [self data_upload];                 
+             }
+         }
         else
         {
             //NSString * shishiStr = [receiveHexValue substringWithRange:NSMakeRange(0,4)];
@@ -520,6 +614,52 @@
     }
 }
 
+-(void)GetNoticeInfo
+{
+    //[UserDefault stringForKey:@"user_id"]
+    NSString *path = [[NSString alloc] initWithFormat:GET_NOTICE];
+    
+    NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
+    
+    MPWeakSelf(self);
+    [NetworkSingleton networkingGetMethod:params urlName:path success:^(id responseBody)
+     {
+         MPStrongSelf(self);
+         BaseResModel * resModel = [Global toBaseModel:responseBody];
+         
+         if(resModel.code == 0)
+         {
+             //[UserDefault setObject:self.is_open_upload forKey:@"is_open_upload"];
+             [UserDefault synchronize];
+             
+             
+             NoticeModel * model = [NoticeModel mj_objectWithKeyValues:resModel.content];
+             
+             if (self.adNoticeView == nil)
+             {
+                 self.adNoticeView = [[AdNoticeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) dataModel:model];
+                 //self.adNoticeView.delegate = self;
+                 [self.view addSubview:self.adNoticeView];
+             }
+             else
+             {
+                 [self.adNoticeView setUIView:model];
+             }
+             
+             [UserDefault setObject:[DateUtil stringFromDateYMD:[NSDate date]] forKey:@"NoticeTime"];
+         }
+         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];
+     }];
+}
+
 /*!
  *  @method UUIDArray:
  *
@@ -558,7 +698,7 @@
 {
     
     bleCurrentUUID = [UserDefault objectForKey:@"bleUUID"];
-    NSString *bleName = [UserDefault objectForKey:@"bleName"];
+    //NSString *bleName = [UserDefault objectForKey:@"bleName"];
     
     //_mapView.delegate = self; // ������������������������������������nil������������������������������
     _locService.delegate = self;
@@ -569,6 +709,12 @@
         {
             deviceStstaus = 1;
             deviceStatusLabel.text = @"���������";
+            
+            //��������������� ������������
+            if(myScanTimer)
+                [myScanTimer setFireDate:[NSDate distantFuture]];
+            
+            [self onLineSet];
             
             // ������������������������
             NSArray *allService = [self UUIDArray:[[[CBMoralManager sharedManager] serviceUUIDDict] allKeys]];
@@ -607,6 +753,104 @@
         }
         
     }
+    
+    [self setMusicConfig];
+}
+
+-(void)setMusicConfig
+{
+    // 0 ������ 1 ���������
+    NSInteger musicStatus1 = [UserDefault integerForKey:@"musicStatus1"];
+    NSInteger musicStatus2 = [UserDefault integerForKey:@"musicStatus2"];
+    NSInteger musicStatus3 = [UserDefault integerForKey:@"musicStatus3"];
+    
+    if( musicStatus1 == 0 )
+    {
+        if(model1 == nil)
+        {
+            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
+    {
+        if(model1 == nil)
+        {
+            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 )
+    {
+        if(model2 == nil)
+        {
+            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
+    {
+        if(model2 == nil)
+        {
+            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 )
+    {
+        if(model3 == nil)
+        {
+            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
+    {
+        if(model3 == nil)
+        {
+            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];
+    }
 }
 
 -(void)stopScanning2
@@ -616,11 +860,16 @@
     // ������������������������������
     if(_bConnectSuccess == NO)
     {
-        if (myScanTimer == nil)
-            myScanTimer =  [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(continueScanning) userInfo:nil repeats:YES];
-        else
-            //���������������
-            [myScanTimer setFireDate:[NSDate distantPast]];
+        if(bOpenConnectBLE == NO)
+        {
+            bOpenConnectBLE = YES;
+            
+            if (myScanTimer == nil)
+                myScanTimer =  [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(continueScanning) userInfo:nil repeats:YES];
+            else
+                //���������������
+                [myScanTimer setFireDate:[NSDate distantPast]];
+        }
     }
 }
 
@@ -669,11 +918,16 @@
         // ������������������������������
         if(_bConnectSuccess == NO)
         {
-            if (myScanTimer == nil)
-                myScanTimer =  [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(continueScanning) userInfo:nil repeats:YES];
-            else
-                //���������������
-                [myScanTimer setFireDate:[NSDate distantPast]];
+            if(bOpenConnectBLE == NO)
+            {
+                bOpenConnectBLE = YES;
+                
+                if (myScanTimer == nil)
+                    myScanTimer =  [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(continueScanning) userInfo:nil repeats:YES];
+                else
+                    //���������������
+                    [myScanTimer setFireDate:[NSDate distantPast]];
+            }
         }
     }
 }
@@ -813,6 +1067,12 @@
 
 #define MAXOFFSETANGLE 152.0f
 #define MAXVALUE       100.0f
+//������������
+-(void)viewWillDisappear:(BOOL)animated
+{
+    [super viewWillDisappear:animated];
+    [self.csManager stopAllMusic];
+}
 
 - (void)viewDidLoad {
     [super viewDidLoad];
@@ -864,6 +1124,15 @@
         scale = 0.8;
         pointerOffset = 5;
     }
+//    else if(IsiPhoneX)
+//    {
+//        unitFontSize = 12;
+//        jiliangFontSize = 12;
+//        numFontSize = 14;
+//        tipsFontSize = 13;
+//        scale = 0.8;
+//        pointerOffset = 5;
+//    }
     
     UIImageView * ic_head_bg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 66*scale)];
     ic_head_bg.image = [UIImage imageNamed:@"ic_head_bg"];
@@ -947,7 +1216,7 @@
     _currentShuziTipsLabel.text = @"���������������";
     [ic_zhishu_bk addSubview:_currentShuziTipsLabel];
     
-    UIImageView * ic_bottom_bg = [[UIImageView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-64-88*scale-44, SCREEN_WIDTH, 88*scale)];
+    UIImageView * ic_bottom_bg = [[UIImageView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-NavBar_Height-88*scale-TabbarHeight, SCREEN_WIDTH, 88*scale)];
     ic_bottom_bg.image = [UIImage imageNamed:@"ic_radia_bottom_bg"];
     [self.view addSubview:ic_bottom_bg];
     
@@ -1014,10 +1283,64 @@
     
     dataModelArr = [[NSMutableArray alloc] init];
     
+//    for (int i = 0; i < 10; i++) {
+//        DataModel * model = [[DataModel alloc] init];
+//        model.time  = [DateUtil stringFromDateYMDHMS:[NSDate date]];
+//        model.type = @"1";
+//        model.is_warn = @"0";
+//        model.value = @"0.012";
+//        [dataModelArr addObject:[model mj_JSONString]];
+//    }
+//
+//
+//    NSDictionary * tempDic =  [dataModelArr mj_keyValues];
+//
+//    NSString * tempStr = [Global convertToJsonData:tempDic];
     myTimeInterval = [UserDefault stringForKey:@"refresh_frequency"];
     is_open_upload = [UserDefault stringForKey:@"is_open_upload"];
     
+    bOpenConnectBLE = false;
+    
     [self offLineSet];
+    
+    // ������������������������
+    NSString* NoticeTime = [UserDefault stringForKey:@"NoticeTime"];
+    BOOL bGetNotice = NO;
+    if (NoticeTime == nil)
+    {
+        bGetNotice = YES;
+    }
+    else
+    {
+        bGetNotice = YES;
+        if([DateUtil isToday:NoticeTime])
+            bGetNotice = NO;
+    }
+    
+    //[UserDefault setObject:[DateUtil stringFromDateYMD:[NSDate date]] forKey:@"NoticeTime"];
+    if(bGetNotice == YES)
+    {
+        [self GetNoticeInfo];
+    }
+    
+    self.csManager = [CSAudioManager defaultManager];
+    self.mp3Data = nil;
+    
+    self.modelArray = [[NSMutableArray alloc] init];
+    
+    MPWeakSelf(self);
+    [self.csManager setBlockPlayerStartPlay:^{
+        NSLog(@"���������-������������������");
+    }];
+    
+    [self.csManager setBlockPlayerStopPlay:^{
+        NSLog(@"���������-������������������");
+    }];
+    
+    [self.csManager setBlockPlayerDidFinishPlaying:^{
+        NSLog(@"���������-���������������������");
+    }];
+    [self setMusicConfig];
     //myTimer =  [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(function:) userInfo:nil repeats:YES];
     //���1���������������function���������
     
@@ -1059,6 +1382,14 @@
 
 -(void)storyAticon
 {
+    //���������������
+    if(myTimer)
+        [myTimer setFireDate:[NSDate distantFuture]];
+    
+    //���������������
+    if(myScanTimer)
+        [myScanTimer setFireDate:[NSDate distantFuture]];
+    
     HistoryRecordPage* page = [[HistoryRecordPage alloc] initIsFirstPage:NO];
     
     BaseNaviController *baseNav = [[BaseNaviController alloc] initWithRootViewController:page];
@@ -1154,23 +1485,31 @@
 
 -(void)data_upload
 {
+    // ������������������������������
+    if ([dataModelArr count] == 0 )
+        return;
+    
     //[UserDefault stringForKey:@"user_id"]
     NSString *path = [[NSString alloc] initWithFormat:DATA_UPLOAD];
     
     UploadModel *model = [[UploadModel alloc] init];
     
+    model.data = [[UploadData alloc] init];
     //['refresh_frequency', 'video', 'is_open_upload']
     //[param setValue:[UserDefault stringForKey:@"user_id"] forKey:@"user_id"];
+    address = @"������������";
     
-    model.lat = [NSString stringWithFormat:@"%lf",latitude];
-    model.lon = [NSString stringWithFormat:@"%lf",longitude];
-    model.userid = [UserDefault stringForKey:@"user_id"];
-    model.address = address;
-    model.modelArray = [[NSMutableArray alloc] init];
-    [model.modelArray addObjectsFromArray:dataModelArr];
+    model.data.lat = [NSString stringWithFormat:@"%lf",latitude];
+    model.data.lon = [NSString stringWithFormat:@"%lf",longitude];
+    model.data.userid = [UserDefault stringForKey:@"user_id"];
+    model.data.address = address;
     
+    model.data.data = [[NSMutableArray alloc] init];
+   [model.data.data addObjectsFromArray:dataModelArr];
+    
+    //NSString * tempString = [Global convertToJsonData:model.toDic];
     MPWeakSelf(self);
-    [NetworkSingleton networkingGetMethod:model.toDic urlName:path success:^(id responseBody)
+    [NetworkSingleton networkingPostMethod:model.toDic urlName:path success:^(id responseBody)
      {
          MPStrongSelf(self);
          BaseResModel * resModel = [Global toBaseModel:responseBody];
@@ -1193,7 +1532,7 @@
                                   failure:^(NSString *error)
      {
          
-         [Global alertMessageEx:error title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
+         [Global alertMessageEx:error title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
      }];
 }
 

--
Gitblit v1.8.0