feat:修改七牛云上传下载路径读取 qiniudomain文件夹下的子文件夹名称

This commit is contained in:
joywayer
2026-02-11 20:59:20 +08:00
parent 7ee8413a3e
commit 09353155ec
7 changed files with 57 additions and 7 deletions

View File

@@ -28,6 +28,7 @@
#import "gameController.h"
#import <CoreTelephony/CTCall.h>
#import <CoreTelephony/CTCallCenter.h>
#import "QiniuManager.h"
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import "AppDelegate.h"
@@ -1886,6 +1887,29 @@
}
NSString *amrPath = [FuncPublic GetPathByFileName: _fileName ofType:@"amr"];
if ([VoiceConverter ConvertWavToAmr:_filePath amrSavePath:amrPath]){
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat =@"yyyyMMddHHmmss";
NSString *str = [formatter stringFromDate:[NSDate date]];
NSString *fileName = [NSString stringWithFormat:@"%@%08X.amr", str, arc4random()];
// 使
[[QiniuManager sharedManager] uploadAudioFile:amrPath
fileName:fileName
progressHandler:^(float percent) {
NSLog(@"七牛上传进度: %.2f", percent);
} completionHandler:^(NSString *key, NSError *error) {
if (error) {
NSLog(@"七牛上传失败: %@", error);
} else {
NSLog(@"七牛上传成功, key: %@", key);
// URL
NSString *audiourl = [[QiniuManager sharedManager] getFileUrlWithKey:key];
[_bridge callHandler:@"getaudiourl" data:@{ @"audiourl":audiourl,@"time":[NSString stringWithFormat:@"%ld",(long)time]} ];
}
}];
/*
NSData *test=[NSData dataWithContentsOfFile:amrPath];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
//text/html
@@ -1895,7 +1919,7 @@
@"image/png",
@"application/octet-stream",
@"text/json",
@"audio/amr",
@"audio/amr",
nil];
NSString *string=@"http://gameapi.0791ts.cn/api/UpLoad/PostFile";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
@@ -1915,6 +1939,7 @@
} failure:^(NSURLSessionDataTask *_Nullable task, NSError * _Nonnull error) {
NSLog(@"上传失败");
}];
*/
}else
NSLog(@"wav转amr失败");