This commit is contained in:
启星
2025-12-04 14:11:00 +08:00
parent 2d37ab6844
commit 1c5a908dda
49 changed files with 505 additions and 192 deletions

View File

@@ -33,6 +33,9 @@ typedef NS_ENUM(NSInteger, AudioRecorderState) {
/// 录音进度更新
- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didUpdateProgress:(NSTimeInterval)progress totalDuration:(NSTimeInterval)totalDuration;
/// 开始认证
-(void)didClickAuthWithFileUrl:(NSURL*)audioFileUrl;
@end
@interface QXAudioRecorderView : UIView

View File

@@ -224,33 +224,24 @@
-(void)authAction{
///
///
if ((int)self.totalDuration < 5) {
showToast(@"录音时长不得小于60秒");
NSInteger minSecond = 60;
#if DEBUG
minSecond = 5;
# else
minSecond = 60;
#endif
if ((int)self.totalDuration < minSecond) {
NSString *toast = [NSString stringWithFormat:@"录音时长不得小于%ld秒",minSecond];
showToast(toast);
return;
}
if (self.originalAudioFileURL==nil) {
showToast(@"录制文件不存在");
return;
}
NSData *data = [NSData dataWithContentsOfURL:self.originalAudioFileURL];
@weakify(self)
showLoadingInView(self.viewController.view);
[[QXCOSUploadManager shareManager] audioUploadFile:data withObjectKey:self.originalAudioFileURL.lastPathComponent complete:^(NSString * _Nonnull fileUrl, QXCOSUploadImageState state) {
@strongify(self);
dispatch_async(dispatch_get_main_queue(), ^{
hideLoadingInView(self.viewController.view);
if ([fileUrl isExist]) {
[QXMineNetwork singerAuthWithSong:fileUrl successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"上传成功");
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(@"上传失败");
}];
}else{
showToast(@"上传失败");
}
});
}];
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickAuthWithFileUrl:)]) {
[self.delegate didClickAuthWithFileUrl:self.originalAudioFileURL];
}
}
#pragma mark - Gesture Handlers