浏览代码

oss提交优化,埋点

胡志强 3 年之前
父节点
当前提交
321fb127f9
共有 1 个文件被更改,包括 12 次插入20 次删除
  1. 12 20
      Introduce/Record/INVideoExportController.swift

+ 12 - 20
Introduce/Record/INVideoExportController.swift

@@ -879,11 +879,6 @@ class INVideoExportController: BFBaseViewController {
     //MARK: - Request
     
     func uploadVideo() {
-        
-        let uploadRequest = PQAliOssUtil.shared.allTasks[uploadData.videoBucketKey ?? ""]
-        if uploadRequest != nil, "\(uploadRequest!.callbackParam["code"] ?? "0")" == "1" {
-            return
-        }
         // 文件上传OSS需要登录用户校验,视说APP使用一个固定用户上传。测试环境用户token: a065b8aa42481a8ae81ccc60dbc82d490c5dcefa
         BFConfig.shared.token = "a065b8aa42481a8ae81ccc60dbc82d490c5dcefa"
         // 更新进度
@@ -900,27 +895,24 @@ class INVideoExportController: BFBaseViewController {
                 wself.multipartUpload(response: response)
             }
         }
+        
+        BFEventTrackAdaptor.baseReportUpload(businessType: .bt_uploadVideo, objectType: nil, pageSource: .sp_composePage, commonParams: commonParams())
+
     }
     
     func multipartUpload(response: [String: Any]?) {
-        let FileName: String = "\(response?["FileName"] ?? "")"
-        let uploadID: String = "\(response?["Upload"] ?? "")"
+        
         uploadData.stsToken = response
-        uploadData.videoBucketKey = FileName
-        uploadData.uploadID = uploadID
-        if uploadData.asset != nil && isValidURL(url: uploadData.localPath) {
-            PQPHAssetVideoParaseUtil.exportPHAssetToMP4(phAsset: (uploadData.asset)!, isCancelCurrentExport: true) { [weak self] _, _, filePath, _ in
-                if filePath != nil, (filePath?.count ?? 0) > 0 {
-                    self?.uploadData.localPath = filePath
-                    PQAliOssUtil.multipartUpload(localPath: filePath!, response: response, videoSource: "videoCompose")
-                }
+        PQAliOssUtil.multipartUpload(localPath: uploadData.localPath ?? "", response: response, videoSource: "videoCompose")
+        PQAliOssUtil.shared.aliOssHander = { [weak self] isMatarialUpload, materialType, _, code, objectkey, _, _, _, _, _, _, _, _, _ in
+            guard let wself = self else { return }
+            
+            if !isMatarialUpload, materialType == .VIDEO, code == 1 {
+                BFEventTrackAdaptor.baseReportUpload(businessType: .bt_uploadVideoSuccess, objectType: nil, pageSource: .sp_composePage, extParams: ["ossKey": objectkey ?? "none"], commonParams: commonParams())
+
             }
-        } else {
-            PQAliOssUtil.multipartUpload(localPath: uploadData.localPath ?? "", response: response, videoSource: "videoCompose")
         }
-//        PQAliOssUtil.shared.aliOssHander = {  isMatarialUpload, materialType, _, code, objectkey, _, _, _, _, _, _, _, _, _ in
-//
-//        }
+        
     }
 }