Browse Source

异常上报

Steven 10 months ago
parent
commit
03c9c541fc
24 changed files with 329 additions and 39 deletions
  1. 18 4
      KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj
  2. 1 1
      KulexiuForStudent/KulexiuForStudent.xcodeproj/xcshareddata/xcschemes/KulexiuForStudent.xcscheme
  3. 42 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/AccompanyWebView/KSAccompanyWebViewController.m
  4. 11 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h
  5. 16 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m
  6. 40 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/LogManager/KSLogManager.h
  7. 55 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/LogManager/KSLogManager.m
  8. 2 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/TXIMLinsenter.h
  9. 17 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/TXIMLinsenter.m
  10. 23 0
      KulexiuForStudent/KulexiuForStudent/Common/Base/WebView/KSBaseWKWebViewController.m
  11. 45 0
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m
  12. 2 2
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/VideoPlayerView/KSVideoPlayerView.h
  13. 18 3
      KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/VideoPlayerView/KSVideoPlayerView.m
  14. 1 0
      KulexiuForStudent/KulexiuForStudent/Module/Login/Model/UserInfoManager.m
  15. 18 18
      KulexiuForStudent/KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.m
  16. BIN
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/CloudAccompanyLibrary
  17. 3 0
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Headers/KSCloudWebViewController.h
  18. 5 0
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Headers/KSVideoRecordManager.h
  19. 2 0
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Headers/kSNewPlayer.h
  20. BIN
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Info.plist
  21. BIN
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeDirectory
  22. BIN
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeRequirements-1
  23. 10 10
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeResources
  24. BIN
      KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeSignature

+ 18 - 4
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -331,6 +331,8 @@
 		BC2932FA2AAEC4720024D98E /* InstitutionMineBodyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC2932F92AAEC4720024D98E /* InstitutionMineBodyView.xib */; };
 		BC2932FD2AAEF4AB0024D98E /* InsititutionMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2932FC2AAEF4AB0024D98E /* InsititutionMineViewController.m */; };
 		BC2933002AAEFC810024D98E /* INSSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2932FF2AAEFC810024D98E /* INSSettingViewController.m */; };
+		BC29AD332BFAFF3200D44848 /* KSLogManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BC29AD312BFAFF3200D44848 /* KSLogManager.m */; };
+		BC29AD352BFAFF7100D44848 /* CloudAccompanyLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC29AD342BFAFF7100D44848 /* CloudAccompanyLibrary.framework */; };
 		BC2DFF4B28BDFE740056105A /* HomeTeacherLiveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFF4A28BDFE730056105A /* HomeTeacherLiveModel.m */; };
 		BC2DFF4E28BE068D0056105A /* TeacherStyleFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFF4D28BE068D0056105A /* TeacherStyleFlowLayout.m */; };
 		BC2DFF5728BE143A0056105A /* HomeTempLiveCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFF5528BE143A0056105A /* HomeTempLiveCell.m */; };
@@ -408,7 +410,6 @@
 		BC38C4A32AFA4F6C00ABFCC2 /* TenantMineFunctionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC38C4A22AFA4F6C00ABFCC2 /* TenantMineFunctionView.xib */; };
 		BC3A4EAB28DAC0CD001C4428 /* ShareLiveDisplayView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC3A4EAA28DAC0CD001C4428 /* ShareLiveDisplayView.m */; };
 		BC3A4EAD28DAC0D6001C4428 /* ShareLiveDisplayView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC3A4EAC28DAC0D6001C4428 /* ShareLiveDisplayView.xib */; };
-		BC3A556D2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A556A2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework */; };
 		BC3A556E2BAA7B2D002E1616 /* KSTunerLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */; };
 		BC3A556F2BAA7B2D002E1616 /* KSTunerLibrary.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		BC3A55822BAA8F34002E1616 /* KSCloudWebManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BC3A55802BAA8F34002E1616 /* KSCloudWebManager.m */; };
@@ -1581,6 +1582,9 @@
 		BC2932FC2AAEF4AB0024D98E /* InsititutionMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InsititutionMineViewController.m; sourceTree = "<group>"; };
 		BC2932FE2AAEFC810024D98E /* INSSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = INSSettingViewController.h; sourceTree = "<group>"; };
 		BC2932FF2AAEFC810024D98E /* INSSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = INSSettingViewController.m; sourceTree = "<group>"; };
+		BC29AD302BFAFF3200D44848 /* KSLogManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSLogManager.h; sourceTree = "<group>"; };
+		BC29AD312BFAFF3200D44848 /* KSLogManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSLogManager.m; sourceTree = "<group>"; };
+		BC29AD342BFAFF7100D44848 /* CloudAccompanyLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CloudAccompanyLibrary.framework; sourceTree = "<group>"; };
 		BC2DFF4928BDFE730056105A /* HomeTeacherLiveModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeTeacherLiveModel.h; sourceTree = "<group>"; };
 		BC2DFF4A28BDFE730056105A /* HomeTeacherLiveModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeTeacherLiveModel.m; sourceTree = "<group>"; };
 		BC2DFF4C28BE068D0056105A /* TeacherStyleFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TeacherStyleFlowLayout.h; sourceTree = "<group>"; };
@@ -1712,7 +1716,6 @@
 		BC3A4EAA28DAC0CD001C4428 /* ShareLiveDisplayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareLiveDisplayView.m; sourceTree = "<group>"; };
 		BC3A4EAC28DAC0D6001C4428 /* ShareLiveDisplayView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShareLiveDisplayView.xib; sourceTree = "<group>"; };
 		BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = KSTunerLibrary.framework; sourceTree = "<group>"; };
-		BC3A556A2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CloudAccompanyLibrary.framework; sourceTree = "<group>"; };
 		BC3A55802BAA8F34002E1616 /* KSCloudWebManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSCloudWebManager.m; sourceTree = "<group>"; };
 		BC3A55812BAA8F34002E1616 /* KSCloudWebManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSCloudWebManager.h; sourceTree = "<group>"; };
 		BC3BF62F2B9EAFC800831494 /* client.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; path = client.p12; sourceTree = "<group>"; };
@@ -2553,7 +2556,7 @@
 			files = (
 				BCA1136828A3A5CF007FAFB9 /* Accelerate.framework in Frameworks */,
 				BCFEE1932AD15C0E000E888F /* SoundpipeAudioKit in Frameworks */,
-				BC3A556D2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework in Frameworks */,
+				BC29AD352BFAFF7100D44848 /* CloudAccompanyLibrary.framework in Frameworks */,
 				BCFEE18D2AD15BD4000E888F /* AudioKitEX in Frameworks */,
 				BCDA2C122BF5F29900ED16AC /* KSToolLibrary.framework in Frameworks */,
 				BC8B6E152856E20800866917 /* WebKit.framework in Frameworks */,
@@ -3469,6 +3472,7 @@
 		2779350B27E324A40010E277 /* Base */ = {
 			isa = PBXGroup;
 			children = (
+				BC29AD322BFAFF3200D44848 /* LogManager */,
 				BC3300172BBAB623003D4921 /* CoursewareDownload */,
 				BC3A55752BAA8479002E1616 /* AlertView */,
 				BC3A55742BAA841A002E1616 /* NavigationController */,
@@ -4245,6 +4249,15 @@
 			path = NavController;
 			sourceTree = "<group>";
 		};
+		BC29AD322BFAFF3200D44848 /* LogManager */ = {
+			isa = PBXGroup;
+			children = (
+				BC29AD302BFAFF3200D44848 /* KSLogManager.h */,
+				BC29AD312BFAFF3200D44848 /* KSLogManager.m */,
+			);
+			path = LogManager;
+			sourceTree = "<group>";
+		};
 		BC2DFF5928C097D00056105A /* AnimationSource */ = {
 			isa = PBXGroup;
 			children = (
@@ -4634,9 +4647,9 @@
 			children = (
 				BC00A65F2BB58FDB00231B74 /* LLPhotoBrowse.bundle */,
 				BC00A6602BB58FDC00231B74 /* WMPlayer.bundle */,
-				BC3A556A2BAA7B1A002E1616 /* CloudAccompanyLibrary.framework */,
 				BCDA2C112BF5F29900ED16AC /* KSToolLibrary.framework */,
 				BC3A55682BAA7B19002E1616 /* KSTunerLibrary.framework */,
+				BC29AD342BFAFF7100D44848 /* CloudAccompanyLibrary.framework */,
 				BC3BF62F2B9EAFC800831494 /* client.p12 */,
 			);
 			path = ToolKit;
@@ -6968,6 +6981,7 @@
 				BC8C2C5C2823F57100FBA5D5 /* KSAddressPickerView.m in Sources */,
 				2723B62727F157D500E0B90B /* GroupMemberViewController.m in Sources */,
 				BC38C3EE2AF893B400ABFCC2 /* KSPlayerSliderView.m in Sources */,
+				BC29AD332BFAFF3200D44848 /* KSLogManager.m in Sources */,
 				BC119216280ED6A900A716F7 /* MyLiveCourseCell.m in Sources */,
 				BC0D95392AC2AB0D00E54D3F /* PasswordModifyBodyView.m in Sources */,
 				275E8AB027E18F8800DD3F6E /* ViewController.m in Sources */,

+ 1 - 1
KulexiuForStudent/KulexiuForStudent.xcodeproj/xcshareddata/xcschemes/KulexiuForStudent.xcscheme

@@ -51,7 +51,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "TEST"
+      buildConfiguration = "DEV"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 42 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/AccompanyWebView/KSAccompanyWebViewController.m

@@ -25,7 +25,7 @@
 // 合成
 #import <KSToolLibrary/KSMediaEditor.h>
 #import "KSMediaMergeView.h"
-
+#import "KSLogManager.h"
 
 @interface KSAccompanyWebViewController ()<KSAQRecordManagerDelegate,KSAudioSessionManagerDelegate,PlayerEngineDelegate,TunerDelegate,kSNewPlayerManagerDelegate>
 
@@ -1407,10 +1407,29 @@
                 
             }
         }];
+        [_videoRecordManager errorMessageCallback:^(NSDictionary * _Nonnull errorParm) {
+            [weakSelf uploadVideoRecordErrorMessage:errorParm];
+        }];
     }
     return _videoRecordManager;
 }
 
+- (void)uploadVideoRecordErrorMessage:(NSDictionary *)errorParm {
+    NSMutableDictionary *parm = [NSMutableDictionary dictionaryWithDictionary:errorParm];
+    [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
+    [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
+    NSString *content = [parm mj_JSONString];
+    NSMutableDictionary *submitParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
+    NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:submitParm];
+    [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:UserDefault(TokenKey) logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+        if ([dic ks_integerValueForKey:@"code"] == 200) {
+            
+        }
+    } faliure:^(NSError * _Nonnull error) {
+        
+    }];
+}
+
 - (void)showSuccessMessage:(NSString *)message {
     if (![NSString isEmptyString:message]) {
         [LOADING_MANAGER MBShowAUTOHidingInWindow:message];
@@ -1747,6 +1766,28 @@
                                @"content" : @{@"reson":@"播放已停止"}
     };
     [self postMessage:postParm];
+    
+    NSError *error = player.player.error;
+    if (error) {
+        NSLog(@"-- error desc - %@", error.description);
+        NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+        [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
+        [parm setValue:@"KSCloudWebViewController_MP3Player" forKey:@"Location"];
+        [parm setValue:@(error.code) forKey:@"errorCode"];
+        [parm setValue:error.description forKey:@"errorDesc"];
+        [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
+        NSString *content = [parm mj_JSONString];
+        NSMutableDictionary *submitParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
+        NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:submitParm];
+        [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:UserDefault(TokenKey) logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+            if ([dic ks_integerValueForKey:@"code"] == 200) {
+                
+            }
+        } faliure:^(NSError * _Nonnull error) {
+            
+        }];
+        
+    }
 }
 
 - (NSMutableArray *)delayArray {

+ 11 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h

@@ -1016,6 +1016,17 @@ NS_ASSUME_NONNULL_BEGIN
 /// @param success 成功
 /// @param faliure 失败
 + (void)sysSuggestionListRequest:(NSString *)post suggestionType:(NSString *)suggestionType startTime:(NSString *)startTime endTime:(NSString *)endTime page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
+#pragma mark ----- Log 上报功能
+// sysExceptionLog/save
+
+/// Log日志上报
+/// @param post post
+/// @param access_token token
+/// @param logArray 上报内容
+/// @param success 成功
+/// @param faliure 失败
++ (void)sysExceptionLogUpdate:(NSString *)post token:(NSString *)access_token logArray:(NSMutableArray *)logArray success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 @end
 
 NS_ASSUME_NONNULL_END

+ 16 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m

@@ -1963,4 +1963,20 @@
     [parm setValue:endTime forKey:@"endTime"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
+
+#pragma mark ----- Log 上报功能
+// sysExceptionLog/save
+
+/// Log日志上报
+/// @param post post
+/// @param access_token token
+/// @param logArray 上报内容
+/// @param success 成功
+/// @param faliure 失败
++ (void)sysExceptionLogUpdate:(NSString *)post token:(NSString *)access_token logArray:(NSMutableArray *)logArray success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    
+    [self configRequestMethodJSONWithToken:access_token];
+    NSString *url = [NSString stringWithFormat:@"%@%@%@", hostURL,@"/api-auth", @"/sysExceptionLog/save"];
+    [self request:post andWithUrl:url and:logArray success:success faliure:faliure];
+}
 @end

+ 40 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/LogManager/KSLogManager.h

@@ -0,0 +1,40 @@
+//
+//  KSLogManager.h
+//  KulexiuSchoolStudent
+//
+//  Created by 王智 on 2024/4/28.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface KSLogManager : NSObject
+/*
+NSDate *current = [NSDate date];
+NSDateFormatter *formatter = [NSObject getDateformatter];
+[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+NSString *time = [formatter stringFromDate:current];
+NSString *deviceType = [NSString getDeviceVersion];
+NSString *systemVersion = [NSString getSystemVersion];
+NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+[parm setValue:exceptionType forKey:@"exceptionType"];
+[parm setValue:content forKey:@"content"];
+
+[parm setValue:deviceType forKey:@"deviceType"];
+[parm setValue:systemVersion forKey:@"deviceVersion"];
+[parm setValue:@"STUDENT" forKey:@"clientType"];
+[parm setValue:UserDefault(PHONEKEY) forKey:@"phone"];
+[parm setValue:@"IOS" forKey:@"appType"];
+[parm setValue:@"KLX" forKey:@"appKey"];
+[parm setValue:time forKey:@"exceptionTime"];
+*/
+/// 生成上传log
+/// - Parameters:
+///   - content: 上报内容
+///   - type: 类型
++ (NSMutableDictionary *)generateLogMessageWithContent:(NSString *)content type:(NSString *)type;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 55 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/LogManager/KSLogManager.m

@@ -0,0 +1,55 @@
+//
+//  KSLogManager.m
+//  KulexiuSchoolStudent
+//
+//  Created by 王智 on 2024/4/28.
+//
+
+#import "KSLogManager.h"
+
+@implementation KSLogManager
+/*
+NSDate *current = [NSDate date];
+NSDateFormatter *formatter = [NSObject getDateformatter];
+[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+NSString *time = [formatter stringFromDate:current];
+NSString *deviceType = [NSString getDeviceVersion];
+NSString *systemVersion = [NSString getSystemVersion];
+NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+[parm setValue:exceptionType forKey:@"exceptionType"];
+[parm setValue:content forKey:@"content"];
+
+[parm setValue:deviceType forKey:@"deviceType"];
+[parm setValue:systemVersion forKey:@"deviceVersion"];
+[parm setValue:@"STUDENT" forKey:@"clientType"];
+[parm setValue:UserDefault(PHONEKEY) forKey:@"phone"];
+[parm setValue:@"IOS" forKey:@"appType"];
+[parm setValue:@"KLX" forKey:@"appKey"];
+[parm setValue:time forKey:@"exceptionTime"];
+*/
+
+/// 生成上传log
+/// - Parameters:
+///   - content: 上报内容
+///   - type: 类型
++ (NSMutableDictionary *)generateLogMessageWithContent:(NSString *)content type:(NSString *)type {
+    
+    NSDate *current = [NSDate date];
+    NSDateFormatter *formatter = [NSObject getDateformatter];
+    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+    NSString *logTime = [formatter stringFromDate:current];
+    NSString *deviceType = [NSString getDeviceVersion];
+    NSString *systemVersion = [NSString getSystemVersion];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:type forKey:@"exceptionType"];
+    [parm setValue:content forKey:@"content"];
+    [parm setValue:deviceType forKey:@"deviceType"];
+    [parm setValue:systemVersion forKey:@"deviceVersion"];
+    [parm setValue:@"STUDENT" forKey:@"clientType"];
+    [parm setValue:UserDefault(PHONEKEY) forKey:@"phone"];
+    [parm setValue:@"IOS" forKey:@"appType"];
+    [parm setValue:@"KLX" forKey:@"appKey"];
+    [parm setValue:logTime forKey:@"exceptionTime"];
+    return parm;
+}
+@end

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/TXIMLinsenter.h

@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface TXIMLinsenter : NSObject
 
+@property (nonatomic, strong) NSString *access_token;
+
 // 是否成功登录IM
 @property (nonatomic, assign) BOOL loginIMSuccess;
 

+ 17 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/LoginManger/TXIMLinsenter.m

@@ -10,6 +10,7 @@
 #import "AppDelegate+AppService.h"
 #import "ClassroomService.h"
 #import "TXLiveTextMessage.h"
+#import "KSLogManager.h"
 
 @interface TXIMLinsenter ()<TUILoginListener,V2TIMConversationListener,V2TIMSimpleMsgListener,V2TIMSignalingListener,V2TIMGroupListener>
 
@@ -92,6 +93,22 @@
     NSLog(@"----- tx IM SDK 连接成功");
     self.isIMConnected = YES;
     [[NSNotificationCenter defaultCenter] postNotificationName:@"TXIMConnected" object:nil];
+#pragma mark ----- IM连接成功埋点
+    NSDictionary *parm = @{
+        @"userId" :UserDefault(UIDKey),
+        @"Location" : @"IM Connected",
+        @"version" : [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"],
+    };
+    NSString *content = [parm mj_JSONString];
+    NSMutableDictionary *uploadParm = [KSLogManager generateLogMessageWithContent:content type:@"RECORD"];
+    NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:uploadParm];
+    [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:self.access_token logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+        if ([dic ks_integerValueForKey:@"code"] == 200) {
+            
+        }
+    } faliure:^(NSError * _Nonnull error) {
+        
+    }];
 }
 
 - (void)onConnectFailed:(int)code err:(NSString *)err {

+ 23 - 0
KulexiuForStudent/KulexiuForStudent/Common/Base/WebView/KSBaseWKWebViewController.m

@@ -36,6 +36,7 @@
 #import "KSWebLoadRefreshView.h"
 
 #import "KSNewAlertView.h"
+#import "KSLogManager.h"
 
 typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     CHOOSETYPE_XML,
@@ -1158,6 +1159,28 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 // 数据加载发生错误时调用
 - (void)webView:(WKWebView *)webView didFailNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
     NSLog(@"----数据加载发生错误时调用");
+    // 错误上报
+    if (error) {
+        NSLog(@"-- error desc - %@", error.description);
+        NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+        [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
+        [parm setValue:@"KSBaseWKWebViewController" forKey:@"Location"];
+        [parm setValue:webView.URL.absoluteString forKey:@"url"];
+        [parm setValue:@(error.code) forKey:@"errorCode"];
+        [parm setValue:error.description forKey:@"errorDesc"];
+        [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
+        
+        NSString *content = [parm mj_JSONString];
+        NSMutableDictionary *uploadParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
+        NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:uploadParm];
+        [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:UserDefault(TokenKey) logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+            if ([dic ks_integerValueForKey:@"code"] == 200) {
+                
+            }
+        } faliure:^(NSError * _Nonnull error) {
+            
+        }];
+    }
 }
 
 

+ 45 - 0
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/KSMediaMergeView.m

@@ -23,6 +23,7 @@
 
 #import "ShareFunctionView.h"
 #import "KSUMShareManager.h"
+#import "KSLogManager.h"
 
 @interface KSMediaMergeView ()<kSNewPlayerManagerDelegate,KSVideoPlayerViewDelegate,RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource>
 
@@ -1026,6 +1027,30 @@
     }
 }
 
+- (void)videoPlayerOccurError:(AVPlayer *)player {
+    NSError *error = player.error;
+    if (error) {
+        NSLog(@"-- error desc - %@", error.description);
+        NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+        [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
+        [parm setValue:@"KSMediaMergeViewVideoPlayer" forKey:@"Location"];
+        [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
+        [parm setValue:@(error.code) forKey:@"errorCode"];
+        [parm setValue:error.description forKey:@"errorDesc"];
+        NSString *content = [parm mj_JSONString];
+        NSMutableDictionary *uploadParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
+        NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:uploadParm];
+        [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:UserDefault(TokenKey) logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+            if ([dic ks_integerValueForKey:@"code"] == 200) {
+                
+            }
+        } faliure:^(NSError * _Nonnull error) {
+            
+        }];
+    }
+}
+
+
 - (void)playFinished:(kSNewPlayer *)player {
     if (player == self.recordPlayer) {
         
@@ -1049,6 +1074,26 @@
 - (void)playerDidError:(kSNewPlayer *)player {
     // 播放出现问题
     [self stopPlay];
+    NSError *error = player.player.error;
+    if (error) {
+        NSLog(@"-- error desc - %@", error.description);
+        NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+        [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
+        [parm setValue:@"KSMediaMergeViewMp3Player" forKey:@"Location"];
+        [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
+        [parm setValue:@(error.code) forKey:@"errorCode"];
+        [parm setValue:error.description forKey:@"errorDesc"];
+        NSString *content = [parm mj_JSONString];
+        NSMutableDictionary *uploadParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
+        NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:uploadParm];
+        [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:UserDefault(TokenKey) logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+            if ([dic ks_integerValueForKey:@"code"] == 200) {
+                
+            }
+        } faliure:^(NSError * _Nonnull error) {
+            
+        }];
+    }
 }
 
 - (KSVideoPlayerView *)videoView {

+ 2 - 2
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/VideoPlayerView/KSVideoPlayerView.h

@@ -19,8 +19,9 @@
 
 -(void)videoPlayerFinishedPlay:(AVPlayer *_Nonnull)player;
 
+- (void)videoPlayerIsReadyPlay:(AVPlayer *_Nonnull)player;
 
-
+- (void)videoPlayerOccurError:(AVPlayer *_Nonnull)player;
 @end
 
 NS_ASSUME_NONNULL_BEGIN
@@ -29,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic,weak)id<KSVideoPlayerViewDelegate>delegate;
 
-@property (nonatomic, strong) AVPlayer *videoPlayer;
 
 @property (nonatomic, assign) BOOL isMute;
 

+ 18 - 3
KulexiuForStudent/KulexiuForStudent/Common/MediaMerge/AudioMerge/VideoPlayerView/KSVideoPlayerView.m

@@ -10,11 +10,13 @@
 
 @interface KSVideoPlayerView ()
 
+@property (nonatomic, strong) AVPlayer *videoPlayer;
+
 @property(nonatomic,strong) AVPlayerItem *currentItem;
 
 @property (nonatomic,retain) AVPlayerLayer  *playerLayer;
 
-@property(nonatomic,retain)id timeObserver;//时间观察
+@property(nonatomic,retain) id timeObserver;//时间观察
 
 @property (nonatomic, assign) BOOL cacheFinish;
 
@@ -39,11 +41,14 @@
 
 - (void)initPlayer {
     [UIApplication sharedApplication].idleTimerDisabled=YES;
-
 }
 
 
 - (void)resetPlayer {
+    if (self.playerLayer) {
+        [self.playerLayer removeFromSuperlayer];
+        self.playerLayer = nil;
+    }
     [self.videoPlayer replaceCurrentItemWithPlayerItem:nil];
     self.videoPlayer = nil;
 }
@@ -120,6 +125,7 @@
         [_videoPlayer pause];
     }
     [self removeAllNoticeAndObserver];
+    [self resetPlayer];
 }
 
 - (void)seekToStart {
@@ -212,6 +218,7 @@
 {
     [_currentItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
 }
+
 #pragma mark----数据缓冲状态的监听
 -(void)addNetDataStatusObserver
 {
@@ -232,11 +239,19 @@
                 break;
             case AVPlayerStatusReadyToPlay:{
                 NSLog(@"准备完毕,可以播放");
+                dispatch_main_sync_safe(^{
+                    if (self.delegate && [self.delegate respondsToSelector:@selector(videoPlayerIsReadyPlay:)]) {
+                        [self.delegate videoPlayerIsReadyPlay:self.videoPlayer];
+                    }
+                });
             }
                 break;
             case AVPlayerStatusFailed:{
                 _isPlaying = NO;
                 NSLog(@"加载失败,网络或者服务器出现问题");
+                if (self.delegate && [self.delegate respondsToSelector:@selector(videoPlayerOccurError:)]) {
+                    [self.delegate videoPlayerOccurError:self.videoPlayer];
+                }
             }
                 break;
             default:
@@ -324,7 +339,7 @@
 }
 
 - (void)dealloc {
-    NSLog(@" -------- player dealloc ");
+    NSLog(@" -------- video player dealloc ");
 }
 /*
 // Only override drawRect: if you perform custom drawing.

+ 1 - 0
KulexiuForStudent/KulexiuForStudent/Module/Login/Model/UserInfoManager.m

@@ -255,6 +255,7 @@
     if ([NSString isEmptyString:imToken]) {
         return;
     }
+    TXIM_LINSENTER.access_token = UserDefault(TokenKey);
     [TXIM_LINSENTER TXIMLoginWithUserId:UserDefault(IM_USERID) sig:imToken callback:^(BOOL isSuccess, NSString * _Nullable msg) {
         if (isSuccess) {
             dispatch_async(dispatch_get_main_queue(), ^{

+ 18 - 18
KulexiuForStudent/KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.m

@@ -7,7 +7,7 @@
 
 #import "KSMetronomePlayer.h"
 #import <AVFoundation/AVFoundation.h>
-//#import "KSLogManager.h"
+#import "KSLogManager.h"
 
 @interface KSMetronomePlayer ()
 
@@ -92,23 +92,23 @@
     [self.audioEngine startAndReturnError:&error];
     if (error) {
 #pragma mark ----- 错误上报
-//        NSLog(@"-- error desc - %@", error.description);
-//        NSMutableDictionary *parm = [NSMutableDictionary dictionary];
-//        [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
-//        [parm setValue:@"metronomePlay" forKey:@"Location"];
-//        [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
-//        [parm setValue:@(error.code) forKey:@"errorCode"];
-//        [parm setValue:error.description forKey:@"errorDesc"];
-//        NSString *content = [parm mj_JSONString];
-//        NSMutableDictionary *uploadParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
-//        NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:uploadParm];
-//        [KSNetworkingManager sysExceptionLogUpdate:KS_POST logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
-//            if ([dic ks_integerValueForKey:@"code"] == 200) {
-//                
-//            }
-//        } faliure:^(NSError * _Nonnull error) {
-//            
-//        }];
+        NSLog(@"-- error desc - %@", error.description);
+        NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+        [parm setValue:UserDefault(UIDKey) forKey:@"userId"];
+        [parm setValue:@"metronomePlay" forKey:@"Location"];
+        [parm setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forKey:@"version"];
+        [parm setValue:@(error.code) forKey:@"errorCode"];
+        [parm setValue:error.description forKey:@"errorDesc"];
+        NSString *content = [parm mj_JSONString];
+        NSMutableDictionary *uploadParm = [KSLogManager generateLogMessageWithContent:content type:@"ERROR"];
+        NSMutableArray *uploadArray = [NSMutableArray arrayWithObject:uploadParm];
+        [KSNetworkingManager sysExceptionLogUpdate:KS_POST token:UserDefault(TokenKey) logArray:uploadArray success:^(NSDictionary * _Nonnull dic) {
+            if ([dic ks_integerValueForKey:@"code"] == 200) {
+                
+            }
+        } faliure:^(NSError * _Nonnull error) {
+            
+        }];
     }
     self.audioEngine.autoShutdownEnabled = YES;
 }

BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/CloudAccompanyLibrary


+ 3 - 0
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Headers/KSCloudWebViewController.h

@@ -37,6 +37,9 @@
 // 上传
 - (void)uploadFile:(NSString *_Nonnull)uploadFileUrl success:(void(^_Nullable)(NSString * _Nonnull remoteFileUrl))success faliure:(void(^_Nullable)(NSString * _Nonnull desc))faliure;
 
+// 错误上报回调 ,额外需填写当前版本
+- (void)cloudPageOccourError:(NSMutableDictionary *_Nonnull)uploadParm;
+
 @end
 
 NS_ASSUME_NONNULL_BEGIN

+ 5 - 0
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Headers/KSVideoRecordManager.h

@@ -10,6 +10,8 @@
 
 typedef void(^KSVideoRecordCallback)(BOOL isSuccess, NSString * _Nullable message);
 
+typedef void(^KSVideoRecordErrorCallback)(NSDictionary * _Nonnull errorParm);
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface KSVideoRecordManager : NSObject
@@ -46,6 +48,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)clearVideoFile;
 
+// 错误回调
+- (void)errorMessageCallback:(KSVideoRecordErrorCallback)callback;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Headers/kSNewPlayer.h

@@ -32,6 +32,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface kSNewPlayer : NSObject
 
+@property(nonatomic,strong, readonly) AVPlayer *player;
+
 @property (nonatomic, assign) BOOL isReady;
 
 @property (nonatomic, assign) BOOL isPlaying;

BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/Info.plist


BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeDirectory


BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeRequirements-1


+ 10 - 10
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeResources

@@ -54,19 +54,19 @@
 		</data>
 		<key>Headers/KSCloudWebViewController.h</key>
 		<data>
-		s0w9GhO5Bd1aS7dIDTVZ+7Am1qw=
+		pZOk0rtmzLtLAH9cSM9y5V6aZ/k=
 		</data>
 		<key>Headers/KSVideoRecordManager.h</key>
 		<data>
-		CJqdyXOd3xT7h5IcjnAsBINz2xI=
+		Ins78iJ7FlX1PoqhnAFEw4DAix8=
 		</data>
 		<key>Headers/kSNewPlayer.h</key>
 		<data>
-		X2XN9irloBDbPzY/b0eZq0vFpnI=
+		/EmFON7pgDfYqZXte5+VuTCx30U=
 		</data>
 		<key>Info.plist</key>
 		<data>
-		NuL3nHg/McGQdlTYK4RMQg7eOTQ=
+		EbXK4oBtuwzpcM6n6jwLip0yy+c=
 		</data>
 	</dict>
 	<key>files2</key>
@@ -207,33 +207,33 @@
 		<dict>
 			<key>hash</key>
 			<data>
-			s0w9GhO5Bd1aS7dIDTVZ+7Am1qw=
+			pZOk0rtmzLtLAH9cSM9y5V6aZ/k=
 			</data>
 			<key>hash2</key>
 			<data>
-			vl7XdMyd71/yd1vGqPY+KQTgYnMwQt261AgYbDjfQiE=
+			RO0ZS6NoI6TZn40r/kX+ncngS2X+PI+xR65M5qT1qUs=
 			</data>
 		</dict>
 		<key>Headers/KSVideoRecordManager.h</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			CJqdyXOd3xT7h5IcjnAsBINz2xI=
+			Ins78iJ7FlX1PoqhnAFEw4DAix8=
 			</data>
 			<key>hash2</key>
 			<data>
-			+CBcFUFEFEUNB3Qvg0pTrkobAfPoQufuNMZsHJRb6sM=
+			hd1YLjbCUB6NcOSoWquK1K484BqR4Ewrj2GzHtONQ/4=
 			</data>
 		</dict>
 		<key>Headers/kSNewPlayer.h</key>
 		<dict>
 			<key>hash</key>
 			<data>
-			X2XN9irloBDbPzY/b0eZq0vFpnI=
+			/EmFON7pgDfYqZXte5+VuTCx30U=
 			</data>
 			<key>hash2</key>
 			<data>
-			7BWfNRynhcPvJdTf3C3kP3jkfCdn6V/LpXbzj4Vt+fk=
+			frpKu3bmbEnJpGISJIx9Ohop6rzvLaDxk5om3tWT19I=
 			</data>
 		</dict>
 	</dict>

BIN
KulexiuForStudent/KulexiuForStudent/ToolKit/CloudAccompanyLibrary.framework/_CodeSignature/CodeSignature