敏感词检测
This commit is contained in:
parent
abc04bfa1c
commit
0a0bbc9ee9
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
664551746CA42328436EB43A /* Pods_ProductApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7E9D1598912BF8D031CA536 /* Pods_ProductApp.framework */; };
|
664551746CA42328436EB43A /* Pods_ProductApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7E9D1598912BF8D031CA536 /* Pods_ProductApp.framework */; };
|
||||||
|
CA0688CD2CD328C500DF7025 /* ToolCheckModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688CC2CD328C500DF7025 /* ToolCheckModel.m */; };
|
||||||
|
CA0688D02CD3291900DF7025 /* OcrModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688CF2CD3291900DF7025 /* OcrModel.m */; };
|
||||||
|
CA0688D32CD329AD00DF7025 /* TranslateLanguageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688D22CD329AD00DF7025 /* TranslateLanguageModel.m */; };
|
||||||
CA07CD142CC5E5C500AF41ED /* XieYiAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */; };
|
CA07CD142CC5E5C500AF41ED /* XieYiAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */; };
|
||||||
CA07CD172CC5F25B00AF41ED /* TextbookDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD162CC5F25B00AF41ED /* TextbookDetailModel.m */; };
|
CA07CD172CC5F25B00AF41ED /* TextbookDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD162CC5F25B00AF41ED /* TextbookDetailModel.m */; };
|
||||||
CA07CD1A2CC6335400AF41ED /* ExampleCorrectList.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD192CC6335400AF41ED /* ExampleCorrectList.m */; };
|
CA07CD1A2CC6335400AF41ED /* ExampleCorrectList.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD192CC6335400AF41ED /* ExampleCorrectList.m */; };
|
||||||
|
@ -522,6 +525,12 @@
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
87167CC240BDAA55C86F80DE /* Pods-ProductApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProductApp.debug.xcconfig"; path = "Target Support Files/Pods-ProductApp/Pods-ProductApp.debug.xcconfig"; sourceTree = "<group>"; };
|
87167CC240BDAA55C86F80DE /* Pods-ProductApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProductApp.debug.xcconfig"; path = "Target Support Files/Pods-ProductApp/Pods-ProductApp.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
B3DBEC0C6ED0E182F65EDBEA /* Pods-ProductApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProductApp.release.xcconfig"; path = "Target Support Files/Pods-ProductApp/Pods-ProductApp.release.xcconfig"; sourceTree = "<group>"; };
|
B3DBEC0C6ED0E182F65EDBEA /* Pods-ProductApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ProductApp.release.xcconfig"; path = "Target Support Files/Pods-ProductApp/Pods-ProductApp.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
CA0688CB2CD328C500DF7025 /* ToolCheckModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ToolCheckModel.h; sourceTree = "<group>"; };
|
||||||
|
CA0688CC2CD328C500DF7025 /* ToolCheckModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ToolCheckModel.m; sourceTree = "<group>"; };
|
||||||
|
CA0688CE2CD3291900DF7025 /* OcrModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OcrModel.h; sourceTree = "<group>"; };
|
||||||
|
CA0688CF2CD3291900DF7025 /* OcrModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OcrModel.m; sourceTree = "<group>"; };
|
||||||
|
CA0688D12CD329AD00DF7025 /* TranslateLanguageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslateLanguageModel.h; sourceTree = "<group>"; };
|
||||||
|
CA0688D22CD329AD00DF7025 /* TranslateLanguageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TranslateLanguageModel.m; sourceTree = "<group>"; };
|
||||||
CA07CD122CC5E5C500AF41ED /* XieYiAlterView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XieYiAlterView.h; sourceTree = "<group>"; };
|
CA07CD122CC5E5C500AF41ED /* XieYiAlterView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XieYiAlterView.h; sourceTree = "<group>"; };
|
||||||
CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XieYiAlterView.m; sourceTree = "<group>"; };
|
CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XieYiAlterView.m; sourceTree = "<group>"; };
|
||||||
CA07CD152CC5F25B00AF41ED /* TextbookDetailModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextbookDetailModel.h; sourceTree = "<group>"; };
|
CA07CD152CC5F25B00AF41ED /* TextbookDetailModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextbookDetailModel.h; sourceTree = "<group>"; };
|
||||||
|
@ -3184,6 +3193,12 @@
|
||||||
CA22D1D52CD0B86900CA7E93 /* ExampleTextTypeModel.m */,
|
CA22D1D52CD0B86900CA7E93 /* ExampleTextTypeModel.m */,
|
||||||
CA22D1E22CD0D7B200CA7E93 /* ChatRoomTipsModel.h */,
|
CA22D1E22CD0D7B200CA7E93 /* ChatRoomTipsModel.h */,
|
||||||
CA22D1E32CD0D7B200CA7E93 /* ChatRoomTipsModel.m */,
|
CA22D1E32CD0D7B200CA7E93 /* ChatRoomTipsModel.m */,
|
||||||
|
CA0688CB2CD328C500DF7025 /* ToolCheckModel.h */,
|
||||||
|
CA0688CC2CD328C500DF7025 /* ToolCheckModel.m */,
|
||||||
|
CA0688CE2CD3291900DF7025 /* OcrModel.h */,
|
||||||
|
CA0688CF2CD3291900DF7025 /* OcrModel.m */,
|
||||||
|
CA0688D12CD329AD00DF7025 /* TranslateLanguageModel.h */,
|
||||||
|
CA0688D22CD329AD00DF7025 /* TranslateLanguageModel.m */,
|
||||||
);
|
);
|
||||||
path = models;
|
path = models;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -4755,6 +4770,7 @@
|
||||||
CA5D02E62CC0DD6B007B3BA5 /* UserUploadModel.m in Sources */,
|
CA5D02E62CC0DD6B007B3BA5 /* UserUploadModel.m in Sources */,
|
||||||
CA5D02EA2CC0DD6B007B3BA5 /* UserShareModel.m in Sources */,
|
CA5D02EA2CC0DD6B007B3BA5 /* UserShareModel.m in Sources */,
|
||||||
CA8181922C9E748500EE7E6E /* StartKTXZPGViewController.m in Sources */,
|
CA8181922C9E748500EE7E6E /* StartKTXZPGViewController.m in Sources */,
|
||||||
|
CA0688D32CD329AD00DF7025 /* TranslateLanguageModel.m in Sources */,
|
||||||
CAC8064E2CA119F800C21AA7 /* StartZWPIDetailView.m in Sources */,
|
CAC8064E2CA119F800C21AA7 /* StartZWPIDetailView.m in Sources */,
|
||||||
CA5D02E32CC0DD6B007B3BA5 /* UserModel.m in Sources */,
|
CA5D02E32CC0DD6B007B3BA5 /* UserModel.m in Sources */,
|
||||||
CB489F6C2744A0BD00DA044A /* RadianDisView.m in Sources */,
|
CB489F6C2744A0BD00DA044A /* RadianDisView.m in Sources */,
|
||||||
|
@ -4859,6 +4875,7 @@
|
||||||
CAC806462CA113A200C21AA7 /* StartZWPIViewCell.m in Sources */,
|
CAC806462CA113A200C21AA7 /* StartZWPIViewCell.m in Sources */,
|
||||||
CABA14BE2C9D4342002CB3B1 /* TimeTools.m in Sources */,
|
CABA14BE2C9D4342002CB3B1 /* TimeTools.m in Sources */,
|
||||||
CAB0D36D2CAA3C6F009BF67D /* KeTangXieZuoXiangQingViewController.m in Sources */,
|
CAB0D36D2CAA3C6F009BF67D /* KeTangXieZuoXiangQingViewController.m in Sources */,
|
||||||
|
CA0688CD2CD328C500DF7025 /* ToolCheckModel.m in Sources */,
|
||||||
CB489F762744A0BD00DA044A /* UIColor+LSFoundation.m in Sources */,
|
CB489F762744A0BD00DA044A /* UIColor+LSFoundation.m in Sources */,
|
||||||
CB489F952744A0BD00DA044A /* BaseRequestDataController.m in Sources */,
|
CB489F952744A0BD00DA044A /* BaseRequestDataController.m in Sources */,
|
||||||
CB489F8A2744A0BD00DA044A /* UIButton+HQCustomIcon.m in Sources */,
|
CB489F8A2744A0BD00DA044A /* UIButton+HQCustomIcon.m in Sources */,
|
||||||
|
@ -4941,6 +4958,7 @@
|
||||||
CAA600D12CA9565500026CF4 /* KeTangXieZuoViewController.m in Sources */,
|
CAA600D12CA9565500026CF4 /* KeTangXieZuoViewController.m in Sources */,
|
||||||
CB489FA12744A0BD00DA044A /* ZJTitleView.m in Sources */,
|
CB489FA12744A0BD00DA044A /* ZJTitleView.m in Sources */,
|
||||||
CA0D082D2CA4F8930086855E /* ShouYeZNXZTableViewCell.m in Sources */,
|
CA0D082D2CA4F8930086855E /* ShouYeZNXZTableViewCell.m in Sources */,
|
||||||
|
CA0688D02CD3291900DF7025 /* OcrModel.m in Sources */,
|
||||||
CA07CD232CC6601500AF41ED /* SSENetWorkManager.m in Sources */,
|
CA07CD232CC6601500AF41ED /* SSENetWorkManager.m in Sources */,
|
||||||
CAF76E872CBE5F8B00825E5E /* GongJuCreateView.m in Sources */,
|
CAF76E872CBE5F8B00825E5E /* GongJuCreateView.m in Sources */,
|
||||||
CA07CD172CC5F25B00AF41ED /* TextbookDetailModel.m in Sources */,
|
CA07CD172CC5F25B00AF41ED /* TextbookDetailModel.m in Sources */,
|
||||||
|
|
Binary file not shown.
|
@ -116,5 +116,85 @@
|
||||||
landmarkType = "7">
|
landmarkType = "7">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "C2181E3D-270B-47C7-90A9-7D9082870C21"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "ProductApp/Other/语音/PlayAudio.m"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "81"
|
||||||
|
endingLineNumber = "81"
|
||||||
|
landmarkName = "-audioPlayerDidFinishPlaying:successfully:"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "D0A19A5D-9133-47F0-BEB7-AF3B4A685A30"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "ProductApp/Other/语音/PlayAudio.m"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "88"
|
||||||
|
endingLineNumber = "88"
|
||||||
|
landmarkName = "-audioPlayerDecodeErrorDidOccur:error:"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "C8E8B872-E034-45E0-AEFF-DE7601EB99A9"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "ProductApp/ProductMain/NetWorkManager/NetWorkManager.m"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "1723"
|
||||||
|
endingLineNumber = "1723"
|
||||||
|
landmarkName = "+requestToolCheckData:content:type:Callback:"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "9FFFA0FB-EB13-41E4-BCFC-3275868D28DE"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "ProductApp/ProductMain/NetWorkManager/NetWorkManager.m"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "1758"
|
||||||
|
endingLineNumber = "1758"
|
||||||
|
landmarkName = "+requestApiOcrData:ID:Callback:"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "BF803338-5E35-4763-8E6A-D9AD37D09E55"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "ProductApp/ProductMain/NetWorkManager/NetWorkManager.m"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "1790"
|
||||||
|
endingLineNumber = "1790"
|
||||||
|
landmarkName = "+requestTranslateLanguageData:Callback:"
|
||||||
|
landmarkType = "7">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
</Breakpoints>
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
[self.window setRootViewController:[[NavgationController alloc] initWithRootViewController:[StartViewController new]]];
|
[self.window setRootViewController:[[NavgationController alloc] initWithRootViewController:[StartViewController new]]];
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:HomeToosRef];
|
[[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:HomeToosRef];
|
||||||
|
[UserInfoModel setAiChatIsDrawing:0];
|
||||||
// [self.window setRootViewController:[TabBarController new]];
|
// [self.window setRootViewController:[TabBarController new]];
|
||||||
|
|
||||||
[self.window makeKeyAndVisible];
|
[self.window makeKeyAndVisible];
|
||||||
|
|
|
@ -91,6 +91,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
///获取role_id
|
///获取role_id
|
||||||
+(NSString *)getRole_id;
|
+(NSString *)getRole_id;
|
||||||
|
|
||||||
|
///聊天信息是否正在绘制
|
||||||
|
+(int)getAiChatIsDrawing;
|
||||||
|
+(void)setAiChatIsDrawing:(int)value;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
@ -280,5 +280,18 @@ static UserInfoModel *userinfo;
|
||||||
}
|
}
|
||||||
return strback;
|
return strback;
|
||||||
}
|
}
|
||||||
|
///聊天信息是否正在绘制
|
||||||
|
+(int)getAiChatIsDrawing
|
||||||
|
{
|
||||||
|
int back = [[[NSUserDefaults standardUserDefaults] objectForKey:AiChatIsDrawing] intValue];
|
||||||
|
if(back==1)
|
||||||
|
{
|
||||||
|
[HXHud showMessage:@"请等待回答完成" afterDelayType:0];
|
||||||
|
}
|
||||||
|
return back;
|
||||||
|
}
|
||||||
|
+(void)setAiChatIsDrawing:(int)value
|
||||||
|
{
|
||||||
|
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%d",value] forKey:AiChatIsDrawing];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -142,6 +142,9 @@ alpha:alphaValue]
|
||||||
#define CamreTiShiPaiZhao @"CamreTiShiPaiZhao"
|
#define CamreTiShiPaiZhao @"CamreTiShiPaiZhao"
|
||||||
#define CamreTiShiPiGai @"CamreTiShiPiGai"
|
#define CamreTiShiPiGai @"CamreTiShiPiGai"
|
||||||
|
|
||||||
|
///聊天是否正在绘制
|
||||||
|
#define AiChatIsDrawing @"AiChatIsDrawing"
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
}
|
}
|
||||||
-(void)textSpeedAppend
|
-(void)textSpeedAppend
|
||||||
{
|
{
|
||||||
if(self.inow+1>self.strValue.length && self.isWriteEnd==YES)
|
if(self.inow>self.strValue.length && self.isWriteEnd==YES)
|
||||||
{
|
{
|
||||||
[self.timer invalidate];
|
[self.timer invalidate];
|
||||||
self.timer = nil;
|
self.timer = nil;
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(self.inow+1>self.strValue.length)
|
if(self.inow>self.strValue.length || self.strValue.length==0)
|
||||||
{
|
{
|
||||||
if(self.backHeight)
|
if(self.backHeight)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,15 +10,18 @@
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
#import <CoreAudio/CoreAudioTypes.h>
|
#import <CoreAudio/CoreAudioTypes.h>
|
||||||
|
|
||||||
typedef void(^AudioRecoredStartBack)(void);
|
///-1失败 1开始 2结束
|
||||||
@interface AudioRecored : NSObject<AVAudioRecorderDelegate>
|
typedef void(^AudioRecoredStartBack)(int type , NSString *strfale);
|
||||||
@property (nonatomic , assign) AVAudioSessionCategory category;
|
@interface AudioRecored : NSObject
|
||||||
|
|
||||||
@property (nonatomic , strong) AudioRecoredStartBack backstart;
|
@property (nonatomic , strong) AudioRecoredStartBack backstart;
|
||||||
@property (nonatomic , strong) NSTimer *timestop;
|
|
||||||
|
+(instancetype)manager;
|
||||||
|
-(NSString *)getPath;
|
||||||
///开始录音
|
///开始录音
|
||||||
-(void)startAudio;
|
-(void)startAudio;
|
||||||
|
|
||||||
//录音停止
|
//录音停止
|
||||||
-(NSData *)stopAudio;
|
-(NSString *)stopAudio;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -9,10 +9,31 @@
|
||||||
#import "AudioRecored.h"
|
#import "AudioRecored.h"
|
||||||
#import "amrFileCodec.h"
|
#import "amrFileCodec.h"
|
||||||
|
|
||||||
static AVAudioRecorder *audiorecord;
|
static AudioRecored *manager = nil;
|
||||||
static NSString *straudiofilename;
|
|
||||||
|
@interface AudioRecored ()<AVAudioRecorderDelegate>
|
||||||
|
@property (nonatomic , assign) AVAudioSessionCategory category;
|
||||||
|
@property (nonatomic , strong) NSTimer *timestop;
|
||||||
|
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) AVAudioRecorder *audiorecord;
|
||||||
|
@property (nonatomic , strong) NSString *straudiofilename;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation AudioRecored
|
@implementation AudioRecored
|
||||||
|
|
||||||
|
+(instancetype)manager
|
||||||
|
{
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
if (manager == nil) {
|
||||||
|
manager = [[AudioRecored alloc]init];
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
设置录音相关参数
|
设置录音相关参数
|
||||||
*/
|
*/
|
||||||
|
@ -69,13 +90,17 @@ static NSString *straudiofilename;
|
||||||
*/
|
*/
|
||||||
- (NSString *) audioRecordingPath:(NSString *)fileNmaeParams{
|
- (NSString *) audioRecordingPath:(NSString *)fileNmaeParams{
|
||||||
NSString *result = nil;
|
NSString *result = nil;
|
||||||
// 应用程序沙盒Document路径
|
NSString *documentsFolder = [self getPath];
|
||||||
NSArray *folders =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
|
|
||||||
NSString *documentsFolder = [folders objectAtIndex:0];
|
|
||||||
result = [documentsFolder stringByAppendingPathComponent:fileNmaeParams];
|
result = [documentsFolder stringByAppendingPathComponent:fileNmaeParams];
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
-(NSString *)getPath
|
||||||
|
{
|
||||||
|
NSArray *folders =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
|
||||||
|
NSString *documentsFolder = [folders objectAtIndex:0];
|
||||||
|
return documentsFolder;
|
||||||
|
}
|
||||||
///准备录音
|
///准备录音
|
||||||
-(void)replay{
|
-(void)replay{
|
||||||
AVAudioSession *session = [AVAudioSession sharedInstance];
|
AVAudioSession *session = [AVAudioSession sharedInstance];
|
||||||
|
@ -93,72 +118,63 @@ static NSString *straudiofilename;
|
||||||
NSString *fileName=[NSString stringWithFormat:@"%0f.aac",[NSDate timeIntervalSinceReferenceDate] * 1000.0];// 指定文件名wav
|
NSString *fileName=[NSString stringWithFormat:@"%0f.aac",[NSDate timeIntervalSinceReferenceDate] * 1000.0];// 指定文件名wav
|
||||||
NSString *pathAsString = [self audioRecordingPath:fileName];
|
NSString *pathAsString = [self audioRecordingPath:fileName];
|
||||||
|
|
||||||
straudiofilename = pathAsString;
|
self.straudiofilename = fileName;
|
||||||
|
|
||||||
NSURL *audioRecordingURL = [NSURL fileURLWithPath:pathAsString];
|
NSURL *audioRecordingURL = [NSURL fileURLWithPath:pathAsString];
|
||||||
|
|
||||||
audiorecord = [[AVAudioRecorder alloc] initWithURL:audioRecordingURL
|
self.audiorecord = [[AVAudioRecorder alloc] initWithURL:audioRecordingURL
|
||||||
settings:[self audioRecordingSettings]
|
settings:[self audioRecordingSettings]
|
||||||
error:&error];
|
error:&error];
|
||||||
|
|
||||||
|
if (self.audiorecord != nil){
|
||||||
|
[self.audiorecord setDelegate:self];
|
||||||
|
|
||||||
if (audiorecord != nil){
|
|
||||||
[audiorecord setDelegate:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
///开始录音
|
///开始录音
|
||||||
-(void)startAudio{
|
-(void)startAudio{
|
||||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||||
self.category = [audioSession category];
|
self.category = [audioSession category];
|
||||||
[self replay];
|
[self replay];
|
||||||
|
if ([self.audiorecord prepareToRecord]){
|
||||||
NSLog(@"开始录音");
|
BOOL isStart=[self.audiorecord record];
|
||||||
|
|
||||||
|
|
||||||
if ([audiorecord prepareToRecord]){
|
|
||||||
if(self.backstart)
|
|
||||||
{
|
|
||||||
self.backstart();
|
|
||||||
}
|
|
||||||
BOOL isStart=[audiorecord record];
|
|
||||||
if (isStart) {
|
if (isStart) {
|
||||||
NSLog(@"开始录音!");
|
NSLog(@"开始录音!");
|
||||||
self.timestop = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(stopAudio) userInfo:nil repeats:NO];
|
self.timestop = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(stopAudio) userInfo:nil repeats:NO];
|
||||||
|
if(self.backstart)
|
||||||
|
{
|
||||||
|
self.backstart(1, @"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"出错了,无法录音");
|
||||||
|
if(self.backstart)
|
||||||
|
{
|
||||||
|
self.backstart(-1, @"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
NSLog(@"出错了,无法录音");
|
NSLog(@"出错了,无法录音");
|
||||||
|
if(self.backstart)
|
||||||
|
{
|
||||||
|
self.backstart(-1, @"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//录音停止
|
//录音停止
|
||||||
-(NSData *)stopAudio{
|
-(NSString *)stopAudio;{
|
||||||
|
|
||||||
[audiorecord stop];
|
[self.audiorecord stop];
|
||||||
[self.timestop invalidate];
|
[self.timestop invalidate];
|
||||||
self.timestop = nil;
|
self.timestop = nil;
|
||||||
NSData *dataaudio = [[NSData alloc]initWithContentsOfFile:straudiofilename];
|
|
||||||
// dataaudio = EncodeWAVEToAMR(dataaudio, 1, 16);
|
|
||||||
// NSString *straudiobase64 = [dataaudio base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
|
|
||||||
|
|
||||||
|
if(self.backstart)
|
||||||
AVURLAsset* audioAsset =[AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath: straudiofilename] options:nil];
|
{
|
||||||
CMTime audioDuration = audioAsset.duration;
|
self.backstart(2, self.straudiofilename);
|
||||||
float audioDurationSeconds = CMTimeGetSeconds(audioDuration);
|
}
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%.0lf",audioDurationSeconds] forKey:@"luyinwenjiansj"];
|
return self.straudiofilename;
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
||||||
[fileManager removeItemAtPath:straudiofilename error:nil];
|
|
||||||
|
|
||||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
|
||||||
NSError *err = nil;
|
|
||||||
[audioSession setCategory :AVAudioSessionCategoryPlayback error:&err];
|
|
||||||
|
|
||||||
return dataaudio;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag
|
- (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag
|
||||||
|
@ -169,6 +185,10 @@ static NSString *straudiofilename;
|
||||||
- (void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder *)recorder error:(NSError *)error
|
- (void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder *)recorder error:(NSError *)error
|
||||||
{
|
{
|
||||||
NSLog(@"报错了");
|
NSLog(@"报错了");
|
||||||
|
if(self.backstart)
|
||||||
|
{
|
||||||
|
self.backstart(-1, @"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
#import "SSENetWorkManager.h"
|
#import "SSENetWorkManager.h"
|
||||||
|
|
||||||
#import "FMDMySql.h"
|
#import "FMDMySql.h"
|
||||||
|
#import "AudioRecored.h"
|
||||||
|
|
||||||
@interface AIChatViewController ()<UITableViewDelegate,UITableViewDataSource>
|
@interface AIChatViewController ()<UITableViewDelegate,UITableViewDataSource,AVAudioPlayerDelegate>
|
||||||
///
|
///
|
||||||
@property (nonatomic , strong) UITableView *tableView;
|
@property (nonatomic , strong) UITableView *tableView;
|
||||||
///
|
///
|
||||||
|
@ -27,6 +28,11 @@
|
||||||
///表名称
|
///表名称
|
||||||
@property (nonatomic , strong) NSString *strtablename;
|
@property (nonatomic , strong) NSString *strtablename;
|
||||||
|
|
||||||
|
|
||||||
|
@property (nonatomic , strong) AVAudioPlayer *playaudio;
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) AIChatModel *modelAudio;
|
||||||
|
@property (nonatomic , assign) BOOL isDragging;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AIChatViewController
|
@implementation AIChatViewController
|
||||||
|
@ -104,6 +110,12 @@
|
||||||
}
|
}
|
||||||
-(void)getLastData
|
-(void)getLastData
|
||||||
{
|
{
|
||||||
|
if([UserInfoModel getAiChatIsDrawing]==1)
|
||||||
|
{
|
||||||
|
[self.tableView.mj_header endRefreshing];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int istart = (int)self.arrdata.count;
|
int istart = (int)self.arrdata.count;
|
||||||
NSMutableArray *arrtemp = [FMDMySql returnCharDB:self.strtablename andstart:istart length:20];
|
NSMutableArray *arrtemp = [FMDMySql returnCharDB:self.strtablename andstart:istart length:20];
|
||||||
|
|
||||||
|
@ -150,6 +162,81 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///语音操作
|
||||||
|
-(void)audioAction:(AIChatModel *)model
|
||||||
|
{
|
||||||
|
if(self.modelAudio.isaudioStart && model!= self.modelAudio)
|
||||||
|
{
|
||||||
|
self.modelAudio.isaudioStart = NO;
|
||||||
|
[self stopAudioAction];
|
||||||
|
}
|
||||||
|
self.modelAudio = model;
|
||||||
|
if(model.isaudioStart)
|
||||||
|
{
|
||||||
|
model.isaudioStart = NO;
|
||||||
|
[self stopAudioAction];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model.isaudioStart = YES;
|
||||||
|
|
||||||
|
NSString *strpath = [NSString stringWithFormat:@"%@/%@",[[AudioRecored manager] getPath],model.audioUrl];
|
||||||
|
NSData *datatemp = [NSData dataWithContentsOfFile:strpath];
|
||||||
|
|
||||||
|
[self playAudioAction:strpath];
|
||||||
|
}
|
||||||
|
[self.tableView reloadData];
|
||||||
|
}
|
||||||
|
-(void)playAudioAction:(NSString *)strfile
|
||||||
|
{
|
||||||
|
|
||||||
|
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||||
|
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
|
||||||
|
[audioSession setActive:YES error:nil];
|
||||||
|
|
||||||
|
NSError *error;
|
||||||
|
self.playaudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:strfile] error:&error];
|
||||||
|
|
||||||
|
if([self.playaudio prepareToPlay] == true)
|
||||||
|
{
|
||||||
|
[self.playaudio setDelegate:self];
|
||||||
|
|
||||||
|
[self.playaudio play];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self.modelAudio.isaudioStart = NO;
|
||||||
|
[HXHud showMessage:@"播放失败" afterDelayType:0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
-(void)stopAudioAction
|
||||||
|
{
|
||||||
|
if(self.playaudio != nil){
|
||||||
|
[self.playaudio stop];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
|
||||||
|
{
|
||||||
|
self.modelAudio.isaudioStart = NO;
|
||||||
|
[self.tableView reloadData];
|
||||||
|
}
|
||||||
|
- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError * __nullable)error
|
||||||
|
{
|
||||||
|
self.modelAudio.isaudioStart = NO;
|
||||||
|
[HXHud showMessage:@"播放失败" afterDelayType:0];
|
||||||
|
[self.tableView reloadData];
|
||||||
|
}
|
||||||
|
#pragma mark - UIScrollView
|
||||||
|
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
||||||
|
{
|
||||||
|
// self.isDragging = YES;
|
||||||
|
// [self.tableView endUpdates];
|
||||||
|
}
|
||||||
|
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
|
||||||
|
{
|
||||||
|
// self.isDragging = NO;
|
||||||
|
}
|
||||||
#pragma mark - UITableView
|
#pragma mark - UITableView
|
||||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||||
{
|
{
|
||||||
|
@ -185,6 +272,7 @@
|
||||||
cell.model = self.arrdata[indexPath.row];
|
cell.model = self.arrdata[indexPath.row];
|
||||||
|
|
||||||
[cell setBackValue:^(AIChatModel * _Nonnull model) {
|
[cell setBackValue:^(AIChatModel * _Nonnull model) {
|
||||||
|
if([UserInfoModel getAiChatIsDrawing]==1)return;
|
||||||
[self.arrdata addObject:model];
|
[self.arrdata addObject:model];
|
||||||
[FMDMySql insertChar:model andtablename:self.strtablename];
|
[FMDMySql insertChar:model andtablename:self.strtablename];
|
||||||
if(model.isnetwork)
|
if(model.isnetwork)
|
||||||
|
@ -195,6 +283,10 @@
|
||||||
[self scrollToBottom];
|
[self scrollToBottom];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
[cell setBackAudioValue:^(AIChatModel * _Nonnull model) {
|
||||||
|
[self audioAction:model];
|
||||||
|
}];
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +398,7 @@
|
||||||
modelDraw.isAnimation = YES;
|
modelDraw.isAnimation = YES;
|
||||||
modelDraw.text = @" ";
|
modelDraw.text = @" ";
|
||||||
[self.arrdata addObject:modelDraw];
|
[self.arrdata addObject:modelDraw];
|
||||||
|
[UserInfoModel setAiChatIsDrawing:1];
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[LoadAlterView show];
|
[LoadAlterView show];
|
||||||
});
|
});
|
||||||
|
@ -331,9 +423,13 @@
|
||||||
modeltemp.height = fheight;
|
modeltemp.height = fheight;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self.tableView endUpdates];
|
[self.tableView endUpdates];
|
||||||
[self.tableView reloadData];
|
if(self.isDragging==NO)
|
||||||
[self scrollToBottom];
|
{
|
||||||
|
[self.tableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone];
|
||||||
|
[self scrollToBottom];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
[UserInfoModel setAiChatIsDrawing:0];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
self.cellDraw = cellDraw;
|
self.cellDraw = cellDraw;
|
||||||
|
@ -358,7 +454,7 @@
|
||||||
float fheight = modeltemp.height;
|
float fheight = modeltemp.height;
|
||||||
|
|
||||||
self.cellDraw.height = fheight;
|
self.cellDraw.height = fheight;
|
||||||
if(ftemp-ftheight>0)
|
if(ftemp-ftheight>0 && self.isDragging==NO)
|
||||||
{
|
{
|
||||||
[self.tableView setContentOffset:CGPointMake(0, ftemp-ftheight+fheight-50)];
|
[self.tableView setContentOffset:CGPointMake(0, ftemp-ftheight+fheight-50)];
|
||||||
}
|
}
|
||||||
|
@ -376,6 +472,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} error:^(NSString * _Nonnull errorString) {
|
} error:^(NSString * _Nonnull errorString) {
|
||||||
|
[UserInfoModel setAiChatIsDrawing:0];
|
||||||
[HXHud showMessage:errorString afterDelayType:0];
|
[HXHud showMessage:errorString afterDelayType:0];
|
||||||
} ID:^(NSString * _Nonnull value) {
|
} ID:^(NSString * _Nonnull value) {
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
typedef void(^AIChatTextTableViewCellBack)(AIChatModel *model);
|
typedef void(^AIChatTextTableViewCellBack)(AIChatModel *model);
|
||||||
typedef void(^AIChatTextTableViewCellDarwBack)(BOOL isDrawFinish);
|
typedef void(^AIChatTextTableViewCellDarwBack)(BOOL isDrawFinish);
|
||||||
|
|
||||||
|
typedef void(^AIChatTextTableViewCellAudioBack)(AIChatModel *model);
|
||||||
|
|
||||||
@interface AIChatTextTableViewCell : UITableViewCell
|
@interface AIChatTextTableViewCell : UITableViewCell
|
||||||
///
|
///
|
||||||
@property (nonatomic , strong) AIChatModel *model;
|
@property (nonatomic , strong) AIChatModel *model;
|
||||||
|
@ -19,6 +22,9 @@ typedef void(^AIChatTextTableViewCellDarwBack)(BOOL isDrawFinish);
|
||||||
|
|
||||||
@property (nonatomic , strong) AIChatTextTableViewCellDarwBack backDrawValue;
|
@property (nonatomic , strong) AIChatTextTableViewCellDarwBack backDrawValue;
|
||||||
|
|
||||||
|
|
||||||
|
@property (nonatomic , strong) AIChatTextTableViewCellAudioBack backAudioValue;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
#import "AIChatFunctionView.h"
|
#import "AIChatFunctionView.h"
|
||||||
#import "AIChaAnswerView.h"
|
#import "AIChaAnswerView.h"
|
||||||
#import "ChatRoomTipsModel.h"
|
#import "ChatRoomTipsModel.h"
|
||||||
#import "PlayAudio.h"
|
|
||||||
|
|
||||||
@interface AIChatTextTableViewCell ()<PlayAudioDelegate>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
|
#import "AudioRecored.h"
|
||||||
|
|
||||||
|
@interface AIChatTextTableViewCell ()
|
||||||
///
|
///
|
||||||
@property (nonatomic , strong) AIChatArcView *viewinfoLeft;
|
@property (nonatomic , strong) AIChatArcView *viewinfoLeft;
|
||||||
///
|
///
|
||||||
|
@ -156,21 +158,9 @@
|
||||||
|
|
||||||
-(void)yuyinAction
|
-(void)yuyinAction
|
||||||
{
|
{
|
||||||
if(self.model.isaudioStart)
|
if(self.backAudioValue)
|
||||||
{
|
{
|
||||||
self.model.isaudioStart = NO;
|
self.backAudioValue(self.model);
|
||||||
[[PlayAudio manager] stopPlayaudio];
|
|
||||||
[self.btyuyin setSelected:NO];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayAudio *play = [PlayAudio manager];
|
|
||||||
[play setDelegate:self];
|
|
||||||
NSData *datatemp = [NSData dataWithContentsOfFile:self.model.audioUrl];
|
|
||||||
[play playAudioData:datatemp];
|
|
||||||
self.model.isaudioStart = YES;
|
|
||||||
|
|
||||||
[self.btyuyin setSelected:YES];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,26 +374,29 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///播放失败
|
/////播放失败
|
||||||
-(void)playCancle
|
//-(void)playCancle
|
||||||
{
|
//{
|
||||||
self.model.isaudioStart = NO;
|
// self.model.isaudioStart = NO;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
[self.btyuyin setSelected:NO];
|
// [self.btyuyin setSelected:NO];
|
||||||
[HXHud showMessage:@"播放失败" afterDelayType:0];
|
// [HXHud showMessage:@"播放失败" afterDelayType:0];
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
///播放完成
|
/////播放完成
|
||||||
-(void)playDidEnd
|
//-(void)playDidEnd
|
||||||
{
|
//{
|
||||||
self.model.isaudioStart = NO;
|
// self.model.isaudioStart = NO;
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
// dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
[self.btyuyin setSelected:NO];
|
// [self.btyuyin setSelected:NO];
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -155,6 +155,8 @@
|
||||||
|
|
||||||
-(void)yuyinDownAction
|
-(void)yuyinDownAction
|
||||||
{
|
{
|
||||||
|
if([UserInfoModel getAiChatIsDrawing]==1)return;
|
||||||
|
|
||||||
AIChatYuYinView *view = [[AIChatYuYinView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)];;
|
AIChatYuYinView *view = [[AIChatYuYinView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN_WIDTH, UISCREEN_HEIGHT)];;
|
||||||
[self.viewController.view.window addSubview:view];
|
[self.viewController.view.window addSubview:view];
|
||||||
[view setBackValue:^(AIChatModel * _Nonnull value) {
|
[view setBackValue:^(AIChatModel * _Nonnull value) {
|
||||||
|
@ -169,6 +171,7 @@
|
||||||
}
|
}
|
||||||
-(void)yuyinUpAction
|
-(void)yuyinUpAction
|
||||||
{
|
{
|
||||||
|
if([UserInfoModel getAiChatIsDrawing]==1)return;
|
||||||
NSLog(@"放开");
|
NSLog(@"放开");
|
||||||
if(self.viewYy.type==1)
|
if(self.viewYy.type==1)
|
||||||
{
|
{
|
||||||
|
@ -238,6 +241,7 @@
|
||||||
|
|
||||||
-(void)sendAction
|
-(void)sendAction
|
||||||
{
|
{
|
||||||
|
if([UserInfoModel getAiChatIsDrawing]==1)return;
|
||||||
NSString *strtemp = self.viewtext.text;
|
NSString *strtemp = self.viewtext.text;
|
||||||
strtemp = [strtemp stringByReplacingOccurrencesOfString:@" " withString:@""];
|
strtemp = [strtemp stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||||
if(strtemp.length==0)
|
if(strtemp.length==0)
|
||||||
|
@ -245,6 +249,7 @@
|
||||||
[HXHud showMessage:@"请输入您的想法" afterDelayType:0];
|
[HXHud showMessage:@"请输入您的想法" afterDelayType:0];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
[self endEditing:YES];
|
||||||
AIChatModel *modeltemp = [AIChatModel new];
|
AIChatModel *modeltemp = [AIChatModel new];
|
||||||
modeltemp.text = self.viewtext.text;
|
modeltemp.text = self.viewtext.text;
|
||||||
modeltemp.ismy = YES;
|
modeltemp.ismy = YES;
|
||||||
|
@ -296,6 +301,7 @@
|
||||||
}
|
}
|
||||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
|
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
|
if([UserInfoModel getAiChatIsDrawing]==1)return;
|
||||||
///做选中操作
|
///做选中操作
|
||||||
ChatRoomTipsModelDataItems *model = self.arrdata[indexPath.row];
|
ChatRoomTipsModelDataItems *model = self.arrdata[indexPath.row];
|
||||||
AIChatModel *modeltemp = [AIChatModel new];
|
AIChatModel *modeltemp = [AIChatModel new];
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#import "AIChatYuYinBackView.h"
|
#import "AIChatYuYinBackView.h"
|
||||||
#import "IFlyMSC/IFlyMSC.h"
|
#import "IFlyMSC/IFlyMSC.h"
|
||||||
#import "GTMBases64.h"
|
#import "GTMBases64.h"
|
||||||
|
#import "AudioRecored.h"
|
||||||
|
|
||||||
@interface AIChatYuYinView ()<IFlySpeechRecognizerDelegate>
|
@interface AIChatYuYinView ()<IFlySpeechRecognizerDelegate>
|
||||||
///
|
///
|
||||||
|
@ -168,35 +169,13 @@
|
||||||
}
|
}
|
||||||
-(void)okAction
|
-(void)okAction
|
||||||
{
|
{
|
||||||
// [self noinfo];
|
NSString *strfile = [[AudioRecored manager] stopAudio];
|
||||||
// self.textview.text = @"测试";
|
|
||||||
|
|
||||||
///
|
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);
|
|
||||||
NSString *cachePath = [NSString stringWithFormat:@"%@/%@",[paths objectAtIndex:0],self.straudioname];
|
|
||||||
NSData *data = [NSData dataWithContentsOfFile:cachePath];
|
|
||||||
|
|
||||||
|
|
||||||
// NSArray *filePath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
||||||
// NSString *documentPath = [filePath objectAtIndex:0];
|
|
||||||
// NSString *savecachePath = [NSString stringWithFormat:@"%@/%@",documentPath,self.straudioname];
|
|
||||||
// if(data)
|
|
||||||
// {
|
|
||||||
// BOOL issave = [data writeToFile:savecachePath atomically:YES];
|
|
||||||
// NSLog(@"issave = %d",issave);
|
|
||||||
// data = nil;
|
|
||||||
// }
|
|
||||||
|
|
||||||
NSString *strbase = [GTMBases64 stringByEncodingData:data];
|
|
||||||
|
|
||||||
NSData *datatemp = [GTMBases64 decodeString:strbase];
|
|
||||||
|
|
||||||
AIChatModel *model = [AIChatModel new];
|
AIChatModel *model = [AIChatModel new];
|
||||||
model.ismy = YES;
|
model.ismy = YES;
|
||||||
model.isnetwork = YES;
|
model.isnetwork = YES;
|
||||||
model.text = self.strshibie;
|
model.text = self.strshibie;
|
||||||
model.messageType = 1;
|
model.messageType = 1;
|
||||||
model.audioUrl = strbase;
|
model.audioUrl = strfile;
|
||||||
if(self.backValue)
|
if(self.backValue)
|
||||||
{
|
{
|
||||||
self.backValue(model);
|
self.backValue(model);
|
||||||
|
@ -215,12 +194,18 @@
|
||||||
[_iFlySpeechRecognizer setParameter: @"10000" forKey: [IFlySpeechConstant VAD_BOS]];
|
[_iFlySpeechRecognizer setParameter: @"10000" forKey: [IFlySpeechConstant VAD_BOS]];
|
||||||
[_iFlySpeechRecognizer setParameter: @"100000" forKey: [IFlySpeechConstant SPEECH_TIMEOUT]];
|
[_iFlySpeechRecognizer setParameter: @"100000" forKey: [IFlySpeechConstant SPEECH_TIMEOUT]];
|
||||||
//asr_audio_path 是录音文件名,设置value为nil或者为空取消保存,默认保存目录在Library/cache下。
|
//asr_audio_path 是录音文件名,设置value为nil或者为空取消保存,默认保存目录在Library/cache下。
|
||||||
NSInteger nowtime = [[NSDate date] timeIntervalSince1970];
|
// NSInteger nowtime = [[NSDate date] timeIntervalSince1970];
|
||||||
self.straudioname = [NSString stringWithFormat:@"%ld.wav",nowtime];///pcm
|
// self.straudioname = [NSString stringWithFormat:@"%ld.wav",nowtime];///pcm
|
||||||
[_iFlySpeechRecognizer setParameter:self.straudioname forKey:[IFlySpeechConstant ASR_AUDIO_PATH]];
|
// [_iFlySpeechRecognizer setParameter:self.straudioname forKey:[IFlySpeechConstant ASR_AUDIO_PATH]];
|
||||||
[_iFlySpeechRecognizer setDelegate:self];
|
[_iFlySpeechRecognizer setDelegate:self];
|
||||||
//启动识别服务
|
//启动识别服务
|
||||||
[_iFlySpeechRecognizer startListening];
|
[_iFlySpeechRecognizer startListening];
|
||||||
|
|
||||||
|
[[AudioRecored manager] startAudio];
|
||||||
|
[[AudioRecored manager] setBackstart:^(int type, NSString *strfale) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -//IFlySpeechRecognizerDelegate协议实现
|
#pragma mark -//IFlySpeechRecognizerDelegate协议实现
|
||||||
|
|
|
@ -31,6 +31,12 @@
|
||||||
#import "ExampleTextTypeModel.h"
|
#import "ExampleTextTypeModel.h"
|
||||||
#import "ChatRoomTipsModel.h"
|
#import "ChatRoomTipsModel.h"
|
||||||
|
|
||||||
|
#import "ToolCheckModel.h"
|
||||||
|
#import "OcrModel.h"
|
||||||
|
#import "TranslateLanguageModel.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface NetWorkManager : NSObject
|
@interface NetWorkManager : NSObject
|
||||||
|
@ -542,7 +548,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
Callback:(completeModeBlock)callback;
|
Callback:(completeModeBlock)callback;
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - 工具
|
||||||
/*
|
/*
|
||||||
语言列表key分组
|
语言列表key分组
|
||||||
/api/translate/language/key
|
/api/translate/language/key
|
||||||
|
@ -550,6 +556,51 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
+ (void)requestTranslateLanguageKeyData:(UIView *)view
|
+ (void)requestTranslateLanguageKeyData:(UIView *)view
|
||||||
Callback:(completeModeBlock)callback;
|
Callback:(completeModeBlock)callback;
|
||||||
|
|
||||||
|
/*
|
||||||
|
工具内sse的接口
|
||||||
|
/api/tool/completions
|
||||||
|
scene
|
||||||
|
|
||||||
|
content
|
||||||
|
after
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
工具敏感词检测
|
||||||
|
/api/tool/check
|
||||||
|
content
|
||||||
|
type 1,2
|
||||||
|
*/
|
||||||
|
+ (void)requestToolCheckData:(UIView *)view
|
||||||
|
content:(NSString *)content
|
||||||
|
type:(NSString *)type
|
||||||
|
Callback:(completeModeBlock)callback;
|
||||||
|
|
||||||
|
/*
|
||||||
|
获取图片识别结果
|
||||||
|
/api/ocr
|
||||||
|
id
|
||||||
|
*/
|
||||||
|
+ (void)requestApiOcrData:(UIView *)view
|
||||||
|
ID:(NSString *)ID
|
||||||
|
Callback:(completeModeBlock)callback;
|
||||||
|
|
||||||
|
/*
|
||||||
|
语言列表
|
||||||
|
/api/translate/language
|
||||||
|
*/
|
||||||
|
+ (void)requestTranslateLanguageData:(UIView *)view
|
||||||
|
Callback:(completeModeBlock)callback;
|
||||||
|
|
||||||
|
/*
|
||||||
|
添加使用数量
|
||||||
|
/api/tools/add_count
|
||||||
|
tool_id
|
||||||
|
*/
|
||||||
|
+ (void)requestToolsAdd_countData:(UIView *)view
|
||||||
|
tool_id:(NSString *)tool_id
|
||||||
|
Callback:(completeModeBlock)callback;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|
|
@ -1678,4 +1678,151 @@
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
工具内sse的接口
|
||||||
|
/api/tool/completions
|
||||||
|
scene
|
||||||
|
|
||||||
|
content
|
||||||
|
after
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
工具敏感词检测
|
||||||
|
/api/tool/check
|
||||||
|
content
|
||||||
|
type 1,2
|
||||||
|
*/
|
||||||
|
+ (void)requestToolCheckData:(UIView *)view
|
||||||
|
content:(NSString *)content
|
||||||
|
type:(NSString *)type
|
||||||
|
Callback:(completeModeBlock)callback
|
||||||
|
{
|
||||||
|
NSMutableDictionary *dicQuery = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicHeader = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicpush = [NSMutableDictionary new];
|
||||||
|
[dicpush setObject:[Tools isStringnil:content] forKey:@"content"];
|
||||||
|
[dicpush setObject:[Tools isStringnil:type] forKey:@"type"];
|
||||||
|
|
||||||
|
[YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/tool/check" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) {
|
||||||
|
BOOL state = NO;
|
||||||
|
NSString *describle = @"";
|
||||||
|
if (responseObject==nil) {
|
||||||
|
describle = @"网络错误";
|
||||||
|
BaseModel *model = [BaseModel new];
|
||||||
|
model.message =describle;
|
||||||
|
callback(state,model,describle);
|
||||||
|
}else{
|
||||||
|
NSDictionary *dicAll=responseObject;
|
||||||
|
describle = dicAll[@"message"];
|
||||||
|
if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) {
|
||||||
|
state = YES;
|
||||||
|
}
|
||||||
|
callback(state,[ToolCheckModel yy_modelWithJSON:dicAll],describle);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
获取图片识别结果
|
||||||
|
/api/ocr
|
||||||
|
id
|
||||||
|
*/
|
||||||
|
+ (void)requestApiOcrData:(UIView *)view
|
||||||
|
ID:(NSString *)ID
|
||||||
|
Callback:(completeModeBlock)callback
|
||||||
|
{
|
||||||
|
NSMutableDictionary *dicQuery = [NSMutableDictionary new];
|
||||||
|
[dicQuery setObject:[Tools isStringnil:ID] forKey:@"id"];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicHeader = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicpush = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
[YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:1 url:@"api/ocr" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) {
|
||||||
|
BOOL state = NO;
|
||||||
|
NSString *describle = @"";
|
||||||
|
if (responseObject==nil) {
|
||||||
|
describle = @"网络错误";
|
||||||
|
BaseModel *model = [BaseModel new];
|
||||||
|
model.message =describle;
|
||||||
|
callback(state,model,describle);
|
||||||
|
}else{
|
||||||
|
NSDictionary *dicAll=responseObject;
|
||||||
|
describle = dicAll[@"message"];
|
||||||
|
if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) {
|
||||||
|
state = YES;
|
||||||
|
}
|
||||||
|
callback(state,[OcrModel yy_modelWithJSON:dicAll],describle);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
语言列表
|
||||||
|
/api/translate/language
|
||||||
|
*/
|
||||||
|
+ (void)requestTranslateLanguageData:(UIView *)view
|
||||||
|
Callback:(completeModeBlock)callback
|
||||||
|
{
|
||||||
|
NSMutableDictionary *dicQuery = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicHeader = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicpush = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
[YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:1 url:@"api/translate/language" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) {
|
||||||
|
BOOL state = NO;
|
||||||
|
NSString *describle = @"";
|
||||||
|
if (responseObject==nil) {
|
||||||
|
describle = @"网络错误";
|
||||||
|
BaseModel *model = [BaseModel new];
|
||||||
|
model.message =describle;
|
||||||
|
callback(state,model,describle);
|
||||||
|
}else{
|
||||||
|
NSDictionary *dicAll=responseObject;
|
||||||
|
describle = dicAll[@"message"];
|
||||||
|
if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) {
|
||||||
|
state = YES;
|
||||||
|
}
|
||||||
|
callback(state,[TranslateLanguageModel yy_modelWithJSON:dicAll],describle);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
添加使用数量
|
||||||
|
/api/tools/add_count
|
||||||
|
tool_id
|
||||||
|
*/
|
||||||
|
+ (void)requestToolsAdd_countData:(UIView *)view
|
||||||
|
tool_id:(NSString *)tool_id
|
||||||
|
Callback:(completeModeBlock)callback
|
||||||
|
{
|
||||||
|
NSMutableDictionary *dicQuery = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicHeader = [NSMutableDictionary new];
|
||||||
|
|
||||||
|
NSMutableDictionary *dicpush = [NSMutableDictionary new];
|
||||||
|
[dicpush setObject:[Tools isStringnil:tool_id] forKey:@"tool_id"];
|
||||||
|
|
||||||
|
[YSAPIClient requestWithRequestBaseUrl:BaseUrl Type:2 url:@"api/tools/add_count" paraments:dicpush Headers:dicHeader Query:dicQuery completeBlock:^(id _Nullable responseObject, NSError * _Nullable error) {
|
||||||
|
BOOL state = NO;
|
||||||
|
NSString *describle = @"";
|
||||||
|
if (responseObject==nil) {
|
||||||
|
describle = @"网络错误";
|
||||||
|
BaseModel *model = [BaseModel new];
|
||||||
|
model.message =describle;
|
||||||
|
callback(state,model,describle);
|
||||||
|
}else{
|
||||||
|
NSDictionary *dicAll=responseObject;
|
||||||
|
describle = dicAll[@"message"];
|
||||||
|
if ([[NSString stringWithFormat:@"%@",dicAll[@"code"]] intValue] == 0) {
|
||||||
|
state = YES;
|
||||||
|
}
|
||||||
|
callback(state,[BaseModel yy_modelWithJSON:dicAll],describle);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
//
|
||||||
|
// OcrModel.h
|
||||||
|
// ProductApp
|
||||||
|
//
|
||||||
|
// Created by 工作 on 2024/10/31.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BaseModel.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class OcrModelData;
|
||||||
|
@interface OcrModel : BaseModel
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) OcrModelData *data;
|
||||||
|
@end
|
||||||
|
@interface OcrModelData : NSObject
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) NSString *ID;
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) NSString *result;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// OcrModel.m
|
||||||
|
// ProductApp
|
||||||
|
//
|
||||||
|
// Created by 工作 on 2024/10/31.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OcrModel.h"
|
||||||
|
|
||||||
|
@implementation OcrModel
|
||||||
|
+ (NSDictionary *)modelContainerPropertyGenericClass {
|
||||||
|
return @{@"data" : [OcrModelData class]};
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
@implementation OcrModelData
|
||||||
|
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper
|
||||||
|
{
|
||||||
|
return @{@"ID" : @"id"};
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// ToolCheckModel.h
|
||||||
|
// ProductApp
|
||||||
|
//
|
||||||
|
// Created by 工作 on 2024/10/31.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BaseModel.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface ToolCheckModel : BaseModel
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) NSString *data;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// ToolCheckModel.m
|
||||||
|
// ProductApp
|
||||||
|
//
|
||||||
|
// Created by 工作 on 2024/10/31.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "ToolCheckModel.h"
|
||||||
|
|
||||||
|
@implementation ToolCheckModel
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,20 @@
|
||||||
|
//
|
||||||
|
// TranslateLanguageModel.h
|
||||||
|
// ProductApp
|
||||||
|
//
|
||||||
|
// Created by 工作 on 2024/10/31.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BaseModel.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class TranslateLanguageModelData;
|
||||||
|
@interface TranslateLanguageModel : BaseModel
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) TranslateLanguageModelData *data;
|
||||||
|
@end
|
||||||
|
@interface TranslateLanguageModelData : NSObject
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) NSArray *items;
|
||||||
|
@end
|
||||||
|
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,22 @@
|
||||||
|
//
|
||||||
|
// TranslateLanguageModel.m
|
||||||
|
// ProductApp
|
||||||
|
//
|
||||||
|
// Created by 工作 on 2024/10/31.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "TranslateLanguageModel.h"
|
||||||
|
|
||||||
|
#import "LanguageKeyModel.h"
|
||||||
|
|
||||||
|
@implementation TranslateLanguageModel
|
||||||
|
+ (NSDictionary *)modelContainerPropertyGenericClass {
|
||||||
|
return @{@"data" : [TranslateLanguageModelData class]};
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
@implementation TranslateLanguageModelData
|
||||||
|
+ (NSDictionary *)modelContainerPropertyGenericClass {
|
||||||
|
return @{@"data" : [LanguageKeyModelDataList class]};
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
|
@ -135,6 +135,7 @@
|
||||||
{
|
{
|
||||||
GongJuTextViewController *vc = [GongJuTextViewController new];
|
GongJuTextViewController *vc = [GongJuTextViewController new];
|
||||||
vc.strtitle = model.tool_name;
|
vc.strtitle = model.tool_name;
|
||||||
|
vc.type = model.ID.intValue;
|
||||||
[self.navigationController pushViewController:vc animated:YES];
|
[self.navigationController pushViewController:vc animated:YES];
|
||||||
}
|
}
|
||||||
else if(model.ID.intValue==5)
|
else if(model.ID.intValue==5)
|
||||||
|
|
|
@ -8,15 +8,27 @@
|
||||||
#import "GongJuMinGanCiView.h"
|
#import "GongJuMinGanCiView.h"
|
||||||
#import "FSTextView.h"
|
#import "FSTextView.h"
|
||||||
|
|
||||||
@interface GongJuMinGanCiView ()
|
#import "PauseAlterView.h"
|
||||||
|
#import "SSENetWorkManager.h"
|
||||||
|
#import "NetWorkManager.h"
|
||||||
|
|
||||||
|
@interface GongJuMinGanCiView ()<UIScrollViewDelegate>
|
||||||
///
|
///
|
||||||
@property (nonatomic , strong) UIScrollView *scvback;
|
@property (nonatomic , strong) UIScrollView *scvback;
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) NSMutableArray *arrBtn;
|
||||||
///
|
///
|
||||||
@property (nonatomic , strong) FSTextView *textview;
|
@property (nonatomic , strong) FSTextView *textview;
|
||||||
|
|
||||||
@property (nonatomic , strong) UIView *viewout;
|
@property (nonatomic , strong) UIView *viewout;
|
||||||
@property (nonatomic , strong) UILabel *lbcontent;
|
@property (nonatomic , strong) ViewLable *lbcontent;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) SSEConfigModel *modelConfig;
|
||||||
|
|
||||||
|
@property (nonatomic , assign) BOOL isDragging;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GongJuMinGanCiView
|
@implementation GongJuMinGanCiView
|
||||||
|
@ -44,6 +56,16 @@
|
||||||
make.height.offset(TabHeight+30);
|
make.height.offset(TabHeight+30);
|
||||||
}];
|
}];
|
||||||
[self drawBottomView:viewbottom];
|
[self drawBottomView:viewbottom];
|
||||||
|
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
NSString *strtemp = [self getpasteInfo];
|
||||||
|
if(strtemp.length>1)
|
||||||
|
{
|
||||||
|
[PauseAlterView showTitle:@"您已复制文本,是否粘贴?" info:strtemp back:^(NSString * _Nonnull value) {
|
||||||
|
self.textview.text = strtemp;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -112,27 +134,33 @@
|
||||||
make.top.offset(16);
|
make.top.offset(16);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
UILabel *lbcontent = [[UILabel alloc] init];
|
ViewLable *lbwz = [[ViewLable alloc] init];
|
||||||
[lbcontent setText:@"结果"];
|
[view addSubview:lbwz];
|
||||||
[lbcontent setTextColor:RGBCOLOR(51, 51, 51)];
|
[lbwz mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
[lbcontent setTextAlignment:NSTextAlignmentLeft];
|
|
||||||
[lbcontent setFont:[UIFont systemFontOfSize:14]];
|
|
||||||
[lbcontent setNumberOfLines:0];
|
|
||||||
[view addSubview:lbcontent];
|
|
||||||
[lbcontent mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.offset(27);
|
make.left.offset(27);
|
||||||
make.right.equalTo(view).offset(-27);
|
make.right.equalTo(view).offset(-27);
|
||||||
make.top.equalTo(viewline.mas_bottom).offset(17);
|
make.top.equalTo(viewline.mas_bottom).offset(17);
|
||||||
}];
|
}];
|
||||||
_lbcontent = lbcontent;
|
lbwz.textColor = RGBCOLOR(61, 61, 61);
|
||||||
|
lbwz.textFont = [UIFont systemFontOfSize:16];
|
||||||
|
[lbwz setBackHeight:^(float fheight, BOOL isend) {
|
||||||
|
if(self.isDragging==NO)
|
||||||
|
{
|
||||||
|
if(self.scvback.contentSize.height-self.scvback.height>0)
|
||||||
|
{
|
||||||
|
[self.scvback setContentOffset:CGPointMake(0, self.scvback.contentSize.height-self.scvback.height)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
_lbcontent = lbwz;
|
||||||
|
|
||||||
[lbcontent setUserInteractionEnabled:YES];
|
[lbwz setUserInteractionEnabled:YES];
|
||||||
UILongPressGestureRecognizer *pressl = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(copyTextAction:)];
|
UILongPressGestureRecognizer *pressl = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(copyTextAction:)];
|
||||||
[lbcontent addGestureRecognizer:pressl];
|
[lbwz addGestureRecognizer:pressl];
|
||||||
|
|
||||||
|
|
||||||
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.bottom.equalTo(lbcontent).offset(25);
|
make.bottom.equalTo(lbwz).offset(25);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,6 +264,7 @@
|
||||||
|
|
||||||
-(void)drawCollectView:(UIView *)view
|
-(void)drawCollectView:(UIView *)view
|
||||||
{
|
{
|
||||||
|
self.arrBtn = [NSMutableArray new];
|
||||||
NSArray *arrtt = @[@"敏感词",@"广告词"];
|
NSArray *arrtt = @[@"敏感词",@"广告词"];
|
||||||
UIView *viewlast = nil;
|
UIView *viewlast = nil;
|
||||||
for(int i = 0 ; i < arrtt.count;i++)
|
for(int i = 0 ; i < arrtt.count;i++)
|
||||||
|
@ -264,6 +293,7 @@
|
||||||
}];
|
}];
|
||||||
[btitem setTag:i];
|
[btitem setTag:i];
|
||||||
[btitem addTarget:self action:@selector(itemAction:) forControlEvents:UIControlEventTouchUpInside];
|
[btitem addTarget:self action:@selector(itemAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
[self.arrBtn addObject:btitem];
|
||||||
viewlast = btitem;
|
viewlast = btitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,11 +322,32 @@
|
||||||
{
|
{
|
||||||
self.textview.text = @"";
|
self.textview.text = @"";
|
||||||
}
|
}
|
||||||
|
-(NSString *)getpasteInfo
|
||||||
|
{
|
||||||
|
// 获取通用剪贴板
|
||||||
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||||
|
// 检查剪贴板是否包含文本
|
||||||
|
if ([pasteboard isKindOfClass:[UIPasteboard class]]) {
|
||||||
|
NSString *clipboardContent = [pasteboard string];
|
||||||
|
if (clipboardContent) {
|
||||||
|
return clipboardContent;
|
||||||
|
} else {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
-(void)copyTextAction:(UIGestureRecognizer *)gesture
|
-(void)copyTextAction:(UIGestureRecognizer *)gesture
|
||||||
{
|
{
|
||||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
if(gesture.state == UIGestureRecognizerStateBegan)
|
||||||
pasteboard.string = self.lbcontent.text;
|
{
|
||||||
[HXHud showMessage:@"复制成功" afterDelayType:0];
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||||
|
pasteboard.string = self.lbcontent.strValue;
|
||||||
|
[HXHud showMessage:@"复制成功" afterDelayType:0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
-(void)itemAction:(UIButton *)sender
|
-(void)itemAction:(UIButton *)sender
|
||||||
{
|
{
|
||||||
|
@ -312,7 +363,59 @@
|
||||||
}
|
}
|
||||||
-(void)bottomAction
|
-(void)bottomAction
|
||||||
{
|
{
|
||||||
[self.viewout setHidden:NO];
|
if(self.textview.text.length==0)
|
||||||
|
{
|
||||||
|
[HXHud showMessage:self.textview.placeholder afterDelayType:0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NSMutableArray *arrtypes = [NSMutableArray new];
|
||||||
|
for(UIButton *bt in self.arrBtn)
|
||||||
|
{
|
||||||
|
if(bt.selected)
|
||||||
|
{
|
||||||
|
[arrtypes addObject:[NSString stringWithFormat:@"%ld",bt.tag+1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(arrtypes.count==0)
|
||||||
|
{
|
||||||
|
[HXHud showMessage:@"请选择检测类型" afterDelayType:0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[self addtoolsNumber];
|
||||||
|
[self getdata:[arrtypes componentsJoinedByString:@","]];
|
||||||
|
}
|
||||||
|
-(void)addtoolsNumber
|
||||||
|
{
|
||||||
|
[NetWorkManager requestToolsAdd_countData:self tool_id:[NSString stringWithFormat:@"%d",5] Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)getdata:(NSString *)types
|
||||||
|
{
|
||||||
|
[LoadAlterView show];
|
||||||
|
[NetWorkManager requestToolCheckData:self content:self.textview.text type:types Callback:^(BOOL state, ToolCheckModel *responseObject, NSString * _Nullable describle) {
|
||||||
|
[LoadAlterView dismiss];
|
||||||
|
if(state)
|
||||||
|
{
|
||||||
|
self.lbcontent.isCloseAnimation = YES;
|
||||||
|
self.lbcontent.strValue = responseObject.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[HXHud showMessage:responseObject.message afterDelayType:1];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - UIScrollView
|
||||||
|
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
||||||
|
{
|
||||||
|
self.isDragging = YES;
|
||||||
|
}
|
||||||
|
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
|
||||||
|
{
|
||||||
|
self.isDragging = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#import "GongJuTextViewController.h"
|
#import "GongJuTextViewController.h"
|
||||||
#import "GongJuTextView.h"
|
#import "GongJuTextView.h"
|
||||||
#import "PauseAlterView.h"
|
|
||||||
|
|
||||||
|
|
||||||
@interface GongJuTextViewController ()
|
@interface GongJuTextViewController ()
|
||||||
|
@ -45,11 +45,6 @@
|
||||||
view.strtitle = self.strtitle;
|
view.strtitle = self.strtitle;
|
||||||
view.type = self.type;
|
view.type = self.type;
|
||||||
|
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
||||||
[PauseAlterView showTitle:@"您已复制文本,是否粘贴?" info:@"文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容" back:^(NSString * _Nonnull value) {
|
|
||||||
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,11 @@
|
||||||
|
|
||||||
#import "GongJuTextView.h"
|
#import "GongJuTextView.h"
|
||||||
#import "FSTextView.h"
|
#import "FSTextView.h"
|
||||||
|
#import "PauseAlterView.h"
|
||||||
|
#import "SSENetWorkManager.h"
|
||||||
|
#import "NetWorkManager.h"
|
||||||
|
|
||||||
@interface GongJuTextView ()
|
@interface GongJuTextView ()<UIScrollViewDelegate>
|
||||||
///
|
///
|
||||||
@property (nonatomic , strong) UIButton *btsend;
|
@property (nonatomic , strong) UIButton *btsend;
|
||||||
|
|
||||||
|
@ -20,9 +23,13 @@
|
||||||
@property (nonatomic , strong) FSTextView *textview;
|
@property (nonatomic , strong) FSTextView *textview;
|
||||||
|
|
||||||
@property (nonatomic , strong) UIView *viewout;
|
@property (nonatomic , strong) UIView *viewout;
|
||||||
@property (nonatomic , strong) UILabel *lbcontent;
|
@property (nonatomic , strong) ViewLable *lbcontent;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
@property (nonatomic , strong) SSEConfigModel *modelConfig;
|
||||||
|
|
||||||
|
@property (nonatomic , assign) BOOL isDragging;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GongJuTextView
|
@implementation GongJuTextView
|
||||||
|
@ -32,6 +39,7 @@
|
||||||
if(self = [super initWithFrame:frame])
|
if(self = [super initWithFrame:frame])
|
||||||
{
|
{
|
||||||
UIScrollView *scvback = [[UIScrollView alloc] init];
|
UIScrollView *scvback = [[UIScrollView alloc] init];
|
||||||
|
[scvback setDelegate:self];
|
||||||
[scvback setShowsVerticalScrollIndicator:NO];
|
[scvback setShowsVerticalScrollIndicator:NO];
|
||||||
[self addSubview:scvback];
|
[self addSubview:scvback];
|
||||||
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
[scvback mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
@ -50,6 +58,16 @@
|
||||||
make.height.offset(TabHeight+30);
|
make.height.offset(TabHeight+30);
|
||||||
}];
|
}];
|
||||||
[self drawBottomView:viewbottom];
|
[self drawBottomView:viewbottom];
|
||||||
|
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
NSString *strtemp = [self getpasteInfo];
|
||||||
|
if(strtemp.length>1)
|
||||||
|
{
|
||||||
|
[PauseAlterView showTitle:@"您已复制文本,是否粘贴?" info:strtemp back:^(NSString * _Nonnull value) {
|
||||||
|
self.textview.text = strtemp;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -118,27 +136,33 @@
|
||||||
make.top.offset(16);
|
make.top.offset(16);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
UILabel *lbcontent = [[UILabel alloc] init];
|
ViewLable *lbwz = [[ViewLable alloc] init];
|
||||||
[lbcontent setText:@"结果"];
|
[view addSubview:lbwz];
|
||||||
[lbcontent setTextColor:RGBCOLOR(51, 51, 51)];
|
[lbwz mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
[lbcontent setTextAlignment:NSTextAlignmentLeft];
|
|
||||||
[lbcontent setFont:[UIFont systemFontOfSize:14]];
|
|
||||||
[lbcontent setNumberOfLines:0];
|
|
||||||
[view addSubview:lbcontent];
|
|
||||||
[lbcontent mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
||||||
make.left.offset(27);
|
make.left.offset(27);
|
||||||
make.right.equalTo(view).offset(-27);
|
make.right.equalTo(view).offset(-27);
|
||||||
make.top.equalTo(viewline.mas_bottom).offset(17);
|
make.top.equalTo(viewline.mas_bottom).offset(17);
|
||||||
}];
|
}];
|
||||||
_lbcontent = lbcontent;
|
lbwz.textColor = RGBCOLOR(61, 61, 61);
|
||||||
|
lbwz.textFont = [UIFont systemFontOfSize:16];
|
||||||
|
[lbwz setBackHeight:^(float fheight, BOOL isend) {
|
||||||
|
if(self.isDragging==NO)
|
||||||
|
{
|
||||||
|
if(self.scvback.contentSize.height-self.scvback.height>0)
|
||||||
|
{
|
||||||
|
[self.scvback setContentOffset:CGPointMake(0, self.scvback.contentSize.height-self.scvback.height)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
_lbcontent = lbwz;
|
||||||
|
|
||||||
[lbcontent setUserInteractionEnabled:YES];
|
[lbwz setUserInteractionEnabled:YES];
|
||||||
UILongPressGestureRecognizer *pressl = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(copyTextAction:)];
|
UILongPressGestureRecognizer *pressl = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(copyTextAction:)];
|
||||||
[lbcontent addGestureRecognizer:pressl];
|
[lbwz addGestureRecognizer:pressl];
|
||||||
|
|
||||||
|
|
||||||
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.bottom.equalTo(lbcontent).offset(25);
|
make.bottom.equalTo(lbwz).offset(25);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,14 +297,121 @@
|
||||||
{
|
{
|
||||||
self.textview.text = @"";
|
self.textview.text = @"";
|
||||||
}
|
}
|
||||||
|
-(NSString *)getpasteInfo
|
||||||
|
{
|
||||||
|
// 获取通用剪贴板
|
||||||
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||||
|
// 检查剪贴板是否包含文本
|
||||||
|
if ([pasteboard isKindOfClass:[UIPasteboard class]]) {
|
||||||
|
NSString *clipboardContent = [pasteboard string];
|
||||||
|
if (clipboardContent) {
|
||||||
|
return clipboardContent;
|
||||||
|
} else {
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
-(void)copyTextAction:(UIGestureRecognizer *)gesture
|
-(void)copyTextAction:(UIGestureRecognizer *)gesture
|
||||||
{
|
{
|
||||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
if(gesture.state == UIGestureRecognizerStateBegan)
|
||||||
pasteboard.string = self.lbcontent.text;
|
{
|
||||||
[HXHud showMessage:@"复制成功" afterDelayType:0];
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||||
|
pasteboard.string = self.lbcontent.strValue;
|
||||||
|
[HXHud showMessage:@"复制成功" afterDelayType:0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
-(void)bottomAction
|
-(void)bottomAction
|
||||||
{
|
{
|
||||||
[self.viewout setHidden:NO];
|
if(self.textview.text.length==0)
|
||||||
|
{
|
||||||
|
[HXHud showMessage:self.textview.placeholder afterDelayType:0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[self addtoolsNumber];
|
||||||
|
[self getdata];
|
||||||
|
}
|
||||||
|
-(void)addtoolsNumber
|
||||||
|
{
|
||||||
|
[NetWorkManager requestToolsAdd_countData:self tool_id:[NSString stringWithFormat:@"%d",self.type] Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)getdata
|
||||||
|
{
|
||||||
|
[LoadAlterView show];
|
||||||
|
///translate 翻译、get_summary 摘要、get_keyword 关键字、to_sort 缩写、to_long 扩写
|
||||||
|
/*
|
||||||
|
8 扩写 7缩写 6摘要提取 3提取关键词
|
||||||
|
*/
|
||||||
|
NSString *scene = @"";
|
||||||
|
if(self.type==8)
|
||||||
|
{
|
||||||
|
scene = @"to_long";
|
||||||
|
}
|
||||||
|
else if (self.type==7)
|
||||||
|
{
|
||||||
|
scene = @"to_sort";
|
||||||
|
}
|
||||||
|
else if (self.type==6)
|
||||||
|
{
|
||||||
|
scene = @"get_summary";
|
||||||
|
}
|
||||||
|
else if (self.type==3)
|
||||||
|
{
|
||||||
|
scene = @"get_keyword";
|
||||||
|
}
|
||||||
|
NSDictionary *dicpush = @{@"content":self.textview.text};
|
||||||
|
|
||||||
|
[[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/tool/completions?scene=%@",scene] dicpush:dicpush config:^(SSEConfigModel * _Nonnull config) {
|
||||||
|
[LoadAlterView dismiss];
|
||||||
|
self.modelConfig = config;
|
||||||
|
[self.viewout setHidden:NO];
|
||||||
|
self.lbcontent.fspeed = self.modelConfig.time.intValue/1000.0;
|
||||||
|
} backValue:^(NSString * _Nonnull value, BOOL isfinish) {
|
||||||
|
if(value.length>3)
|
||||||
|
{
|
||||||
|
[self chuliShuJu:value isfinish:NO];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(isfinish)
|
||||||
|
{
|
||||||
|
[self chuliShuJu:value isfinish:YES];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} error:^(NSString * _Nonnull errorString) {
|
||||||
|
[LoadAlterView dismiss];
|
||||||
|
[HXHud showMessage:errorString afterDelayType:0];
|
||||||
|
} ID:^(NSString * _Nonnull value) {
|
||||||
|
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
-(void)chuliShuJu:(NSString *)value isfinish:(BOOL)isfinish
|
||||||
|
{
|
||||||
|
NSLog(@"%@",value);
|
||||||
|
if(isfinish)
|
||||||
|
{
|
||||||
|
self.lbcontent.isWriteEnd = YES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self.lbcontent.strValue = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - UIScrollView
|
||||||
|
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
||||||
|
{
|
||||||
|
self.isDragging = YES;
|
||||||
|
}
|
||||||
|
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
|
||||||
|
{
|
||||||
|
self.isDragging = NO;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue