Sfoglia il codice sorgente

1.更换测试域名 http://testprivacy.phone.androidscloud.com:1801

huangxiaodong 1 anno fa
parent
commit
3d510ef4d3

+ 9 - 0
创维盒子/jiSuanQi_Info.plist

@@ -100,6 +100,15 @@
 		<true/>
 		<key>NSExceptionDomains</key>
 		<dict>
+			<key>testprivacy.phone.androidscloud.com</key>
+			<dict>
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
+				<true/>
+				<key>NSExceptionRequiresForwardSecrecy</key>
+				<false/>
+				<key>NSIncludesSubdomains</key>
+				<true/>
+			</dict>
 			<key>transfer.armclouding.com</key>
 			<dict>
 				<key>NSIncludesSubdomains</key>

+ 5 - 2
创维盒子/双子星云手机/AppDelegate/PrefixHeader.pch

@@ -92,8 +92,11 @@ isBangsScreen; \
 //#define CloudService           @"http://14.18.190.141:11180"
 //#define CloudService           @"http://14.18.190.141:1280"
 //创维盒子 测试地址
-#define CloudService   @"http://14.18.190.141:1801"
-#define shareService   @"http://testprivacy.phone.armclouding.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
+//#define CloudService   @"http://14.18.190.141:1801"
+//#define shareService   @"http://testprivacy.phone.armclouding.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
+#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
+#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
+
 
 //生产环境
 //#define CloudService   @"http://hiboxde.armclouding.com:7780"

+ 9 - 0
创维盒子/双子星云手机/Info.plist

@@ -100,6 +100,15 @@
 		<true/>
 		<key>NSExceptionDomains</key>
 		<dict>
+			<key>testprivacy.phone.androidscloud.com</key>
+			<dict>
+				<key>NSIncludesSubdomains</key>
+				<true/>
+				<key>NSExceptionRequiresForwardSecrecy</key>
+				<false/>
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
+				<true/>
+			</dict>
 			<key>transfer.armclouding.com</key>
 			<dict>
 				<key>NSExceptionAllowsInsecureHTTPLoads</key>

+ 4 - 1
创维盒子/双子星云手机/netWork/netWorkManager.h

@@ -35,7 +35,7 @@ typedef void (^netWork_Faild) (NSError *error);
 
 #pragma mark  afnetwork  post 埋点请求
 //eventType 事件模块类型 0 一级模块=1 二级模块=2 三级模块=3
-//事件模块值 Scan_code 
+//事件模块值 Scan_code
 - (void)DataEmbeddingPointBy:(int)eventType withEventValue:(NSString*)eventValue;
 
 #pragma mark  afnetwork  post 请求
@@ -46,6 +46,9 @@ typedef void (^netWork_Faild) (NSError *error);
 
 #pragma mark  afnetwork  get 请求 检测文件是否存在
 - (void)cloudPhoneCheckUrlCallBackCode:(NSString*)code  success:(netWork_Success)success failure:(netWork_Faild)failure;
+
+#pragma mark  afnetwork  get 请求 音乐播放器下载音频缓存
+- (void)cloudPhoneDownloadAudioByCode:(NSString*)code withSavePath:(NSString*)savePath success:(netWork_Success)success failure:(netWork_Faild)failure;
 @end
 
 NS_ASSUME_NONNULL_END

+ 66 - 0
创维盒子/双子星云手机/netWork/netWorkManager.m

@@ -597,4 +597,70 @@ static netWorkManager *Game_NetWorkShareInstance = nil;
    //[task cancel];
     
 }
+
+
+#pragma mark  afnetwork  get 请求 音乐播放器下载音频缓存
+- (void)cloudPhoneDownloadAudioByCode:(NSString*)code withSavePath:(NSString*)savePath success:(netWork_Success)success failure:(netWork_Faild)failure
+{
+    
+    NSString *curServer = code;
+    NSString *fullUrl = curServer;
+    HLog(@"地址:%@",fullUrl);
+    
+    //managerNAS manager
+    //[managerNAS.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
+    
+    __block  SuperModel *model = [SuperModel new];
+    
+    if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
+    {// 无网络状态
+        model.code = -1;
+        success(model);
+        return;
+    }
+    
+    if(!fullUrl){
+        model.code = -1;
+        success(model);
+        return;
+    }
+    
+    if([fullUrl containsString:@"getFile"]
+       &&![fullUrl containsString:@"getFiles"]){
+        fullUrl = [fullUrl stringByReplacingOccurrencesOfString:@"getFile" withString:@"getFiles"];
+    }
+    HLog(@"%@",fullUrl);
+    
+    //1.创建管理者对象
+   AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
+   //2.确定请求的URL地址
+   NSURL *url2222 = [NSURL URLWithString:fullUrl];
+   //3.创建请求对象
+   NSURLRequest *request = [NSURLRequest requestWithURL:url2222];
+   //4.下载任务
+    
+   
+   __block  NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
+       //打印下下载进度
+       HLog(@"%@",downloadProgress);
+       
+   } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
+       //设置文件保存路径
+       return [NSURL fileURLWithPath:savePath];
+   } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
+       //HLog(@"完成cache:%@",filePath);
+       NSHTTPURLResponse *response1 = (NSHTTPURLResponse *)response;
+       NSInteger statusCode = [response1 statusCode];
+       HLog(@"statusCode:%ld",statusCode);
+       if (statusCode == 200) {
+           model.code = 0;
+           success(model);
+       }else{
+           model.code = -1;
+           success(model);
+       }
+   }];
+   //5.开始启动下载任务
+   [task resume];
+}
 @end