Pārlūkot izejas kodu

1.添加分享数据上报枚举

wenweiwei 3 gadi atpakaļ
vecāks
revīzija
a0f288df45

+ 28 - 19
BFFramework/Classes/EventTrack/ViewModel/PQEventTrackViewModel.swift

@@ -214,7 +214,7 @@ public class PQEventTrackViewModel: NSObject {
     //   - businessType: <#businessType description#>
     //   - targetUid: <#targetUid description#>
     //   - shareId: <#shareId description#>
-    public class func shareReportUpload(isShareVideo: Bool = true, screenType: Int = 1, videoId: String, pageSource: PAGESOURCE, recommendId: String?, recommendLogVO: String?,flowPool:String?, abInfoData: String?, measureType: Int?, measureId: Int?, businessType: businessType?, targetUid: Int?, shareId: String = "",playId:String?,extParams: [String: Any]? = nil) {
+    public class func shareReportUpload(isShareVideo: Bool = true, screenType: Int = 1, videoId: String, pageSource: PAGESOURCE, recommendId: String?, recommendLogVO: String?,flowPool:String?, abInfoData: String?, measureType: Int?, measureId: Int?, businessType: businessType?, targetUid: Int?, shareId: String = "",playId:String?, params: [String: Any]? = nil, eventData: [String: Any]? = nil,extParams: [String: Any]? = nil) {
         DispatchQueue.global().async {
             var url: String = PQENVUtil.shared.longvideoapi
             switch screenType {
@@ -227,47 +227,56 @@ public class PQEventTrackViewModel: NSObject {
             default:
                 break
             }
-            var params: [String: Any] = ["type": isShareVideo ? "1" : "2", "videoId": videoId, "pageSource": pageSource.rawValue, "playId": playId ?? "", "targetUid": targetUid ?? 0, "shareDepth": "0"]
+            var tempParams: [String: Any] = params ?? [:]
+            tempParams["type"] = isShareVideo ? "1" : "2"
+            tempParams["videoId"] = videoId
+            tempParams["pageSource"] = pageSource.rawValue
+            tempParams["playId"] = playId ?? ""
+            tempParams["targetUid"] = targetUid ?? 0
+            tempParams["shareDepth"] = "0"
             if extParams != nil {
-                params["extParams"] = dictionaryToJsonString(extParams!)
+                tempParams["extParams"] = dictionaryToJsonString(extParams!)
+            }
+            if eventData != nil {
+                tempParams["eventData"] = dictionaryToJsonString(eventData!)
             }
             if measureType != nil {
-                params["measureType"] = measureType
+                tempParams["measureType"] = measureType
             }
             if measureId != nil {
-                params["measureId"] = measureId
+                tempParams["measureId"] = measureId
             }
-            params["shareId"] = shareId
-            params["rootLaunchShareId"] = shareId
-            params["parentShareId"] = shareId
-            params["rootShareId"] = shareId
+            tempParams["shareId"] = shareId
+            tempParams["rootLaunchShareId"] = shareId
+            tempParams["parentShareId"] = shareId
+            tempParams["rootShareId"] = shareId
             if !BFLoginUserInfo.shared.openId.isEmpty {
-                params["shareUi"] = BFLoginUserInfo.shared.openId
+                tempParams["shareUi"] = BFLoginUserInfo.shared.openId
             }
             if pageSource.rawValue.contains("speedApp-category") {
-                params["pageCategoryId"] = 55
+                tempParams["pageCategoryId"] = 55
             }
             if isShareVideo {
-                params["shareObjectId"] = videoId
+                tempParams["shareObjectId"] = videoId
             } else {
-                params["shareObjectId"] = targetUid
+                tempParams["shareObjectId"] = targetUid
             }
             if businessType != nil {
-                params["businessType"] = businessType?.rawValue
+                tempParams["businessType"] = businessType?.rawValue
             }
             if recommendId != nil, !(recommendId?.isEmpty ?? true) {
-                params["recommendId"] = recommendId
+                tempParams["recommendId"] = recommendId
             }
             if recommendLogVO != nil, !(recommendLogVO?.isEmpty ?? true) {
-                params["recommendLogVO"] = recommendLogVO
+                tempParams["recommendLogVO"] = recommendLogVO
             }
             if flowPool != nil, (flowPool?.count ?? 0) > 0 {
-                params["flowPool"] = flowPool
+                tempParams["flowPool"] = flowPool
             }
             if abInfoData != nil, !(abInfoData?.isEmpty ?? true) {
-                params["abInfoData"] = abInfoData
+                tempParams["abInfoData"] = abInfoData
             }
-            BFNetRequestAdaptor.postRequestData(url: url, parames: params,commonParams: commonParams()) { response, _, error, _ in
+            BFNetRequestAdaptor.postRequestData(url: url, parames: tempParams,commonParams: commonParams()) { response, _, error, _ in
                 BFLog(message: "用户点击分享数据上报:\(String(describing: error)),\(response ?? [:])")
             }
         }

+ 6 - 4
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift

@@ -1417,18 +1417,19 @@ extension PQStuckPointPublicController {
             }
             cShowHUB(superView: nil, msg: nil)
             let shareId = getUniqueId(desc: "\(videoData?.uniqueId ?? "")shareId")
+            let rootPageTimestamp = Int64(Date().timeIntervalSince1970 * 1000)
             PQBaseViewModel.wxFriendShareInfo(videoId: (videoData?.uniqueId)!) { [weak self] imagePath, title, shareWeappRawId, msg in
                 if msg != nil {
                     cShowHUB(superView: nil, msg: "网络不佳哦")
                     return
                 }
                 self?.isShared = true
-                PQSingletoWXApiUtil.shared.share(type: 3, scene: Int32(WXSceneSession.rawValue), shareWeappRawId: shareWeappRawId, title: title, description: title, imageUrl: imagePath, path: self?.videoData?.videoPath, videoId: (self?.videoData?.uniqueId)!, pageSource: self?.videoData?.pageSource ?? .sp_category, shareId: shareId).wxApiUtilHander = { _, _ in
+                PQSingletoWXApiUtil.shared.share(rootPageTimestamp: rootPageTimestamp, type: 3, scene: Int32(WXSceneSession.rawValue), shareWeappRawId: shareWeappRawId, title: title, description: title, imageUrl: imagePath, path: self?.videoData?.videoPath, videoId: (self?.videoData?.uniqueId)!, pageSource: self?.videoData?.pageSource ?? .sp_category, shareId: shareId).wxApiUtilHander = { _, _ in
                 }
                 cHiddenHUB(superView: nil)
             }
             // 点击上报:分享微信
-            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_shareWechat, pageSource: .sp_stuck_publishSyncedUp, extParams: ["videoId": videoData?.uniqueId ?? ""], remindmsg: "卡点视频数据上报-(点击上报:分享微信)")
+            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_shareWechat, pageSource: .sp_stuck_publishSyncedUp, params: ["rootPageTimestamp": rootPageTimestamp], eventData: ["rootPageTimestamp": rootPageTimestamp], extParams: ["videoId": videoData?.uniqueId ?? "", "rootPageTimestamp": rootPageTimestamp], remindmsg: "卡点视频数据上报-(点击上报:分享微信)")
         case 2:
             if !(isExportSuccess && isSaveProjectSuccess && isUploadSuccess && isPublicSuccess) {
                 cShowHUB(superView: nil, msg: "视频发布失败,请重新合成")
@@ -1439,6 +1440,7 @@ extension PQStuckPointPublicController {
                 return
             }
             let shareId = getUniqueId(desc: "\(videoData?.uniqueId ?? "")shareId")
+            let rootPageTimestamp = Int64(Date().timeIntervalSince1970 * 1000)
             PQBaseViewModel.h5ShareLinkInfo(videoId: videoData?.uniqueId ?? "", pageSource: videoData?.pageSource ?? .sp_category) { [weak self] path, _ in
                 cHiddenHUB(superView: nil)
                 if path != nil {
@@ -1449,7 +1451,7 @@ extension PQStuckPointPublicController {
                         }
                         self?.isShared = true
 
-                        PQSingletoWXApiUtil.shared.share(type: 1, scene: Int32(WXSceneTimeline.rawValue), title: self?.videoData?.title ?? "\(BFLoginUserInfo.shared.nickName)made a music video for you", description: "", imageUrl: imagePath, path: path, videoId: (self?.videoData?.uniqueId)!, pageSource: self?.videoData?.pageSource ?? .sp_category, shareId: shareId).wxApiUtilHander = { _, _ in
+                        PQSingletoWXApiUtil.shared.share(rootPageTimestamp: rootPageTimestamp, type: 1, scene: Int32(WXSceneTimeline.rawValue), title: self?.videoData?.title ?? "\(BFLoginUserInfo.shared.nickName)made a music video for you", description: "", imageUrl: imagePath, path: path, videoId: (self?.videoData?.uniqueId)!, pageSource: self?.videoData?.pageSource ?? .sp_category, shareId: shareId).wxApiUtilHander = { _, _ in
                         }
                     }
                 } else {
@@ -1457,7 +1459,7 @@ extension PQStuckPointPublicController {
                 }
             }
             // 点击上报:分享朋友圈
-            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_shareWechatMoment, pageSource: .sp_stuck_publishSyncedUp, extParams: ["videoId": videoData?.uniqueId ?? ""], remindmsg: "卡点视频数据上报-(点击上报:分享朋友圈)")
+            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_click_shareWechatMoment, pageSource: .sp_stuck_publishSyncedUp, params: ["rootPageTimestamp": rootPageTimestamp], eventData: ["rootPageTimestamp": rootPageTimestamp], extParams: ["videoId": videoData?.uniqueId ?? "", "rootPageTimestamp": rootPageTimestamp], remindmsg: "卡点视频数据上报-(点击上报:分享朋友圈)")
         case 3:
 
             // 点击上报:完成

+ 1 - 2
BFFramework/Classes/Stuckpoint/View/PQSelecteMusicView.swift

@@ -640,8 +640,7 @@ class PQSelectMusicCell: UICollectionViewCell {
             playImageView.isHidden = false
             imageMaskView.isHidden = false
             playImageView.image = nil
-            playImageView.kf.setImage(with: URL(fileURLWithPath: currentBundle()!.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
-      
+            playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle.current(moduleName: "BFFramework",isAssets: false)!.path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
         } else if  bgmData?.voiceStatue == .isPause{
             playImageView.isHidden = false
             imageMaskView.isHidden = false

+ 2 - 2
BFFramework/Classes/Utils/PQThirdPlatformUtil.swift

@@ -124,7 +124,7 @@ public class PQSingletoWXApiUtil: NSObject {
     ///   - videoId: 视频ID type == 1时不为空
     ///   - pageSource: 页面pageSource type == 1时不为空
     /// - Returns: <#description#>
-    public func share(type: Int = 1, scene: Int32, shareWeappRawId: String? = nil, title: String?, description: String?, imageUrl: String?, path: String?, videoId: String, pageSource: PAGESOURCE, shareId: String) -> PQSingletoWXApiUtil {
+    public func share(rootPageTimestamp:Int64?,type: Int = 1, scene: Int32, shareWeappRawId: String? = nil, title: String?, description: String?, imageUrl: String?, path: String?, videoId: String, pageSource: PAGESOURCE, shareId: String) -> PQSingletoWXApiUtil {
         if !isInstallWX() {
             if wxApiUtilHander != nil {
                 wxApiUtilHander!(nil, "您还未安装微信客户端!")
@@ -156,7 +156,7 @@ public class PQSingletoWXApiUtil: NSObject {
                         targetPagePath = "user-videos"
                         isRhythmVideo = 0
                     }
-                    var params = (targetPagePath + "?id=\(videoId)&tp=share&rootPageSource=\(pageSource.rawValue)&shareDepth=1&rootLaunchShareId=\(shareId)&parentShareId=\(shareId)&shareId=\(shareId)&shareAppType=\(BFConfig.shared.appType)&mid=\(getMachineCode())&su=\(BFLoginUserInfo.shared.uid)&isRhythmVideo=\(isRhythmVideo)").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
+                    var params = (targetPagePath + "?id=\(videoId)&tp=share&rootPageSource=\(pageSource.rawValue)&shareDepth=1&rootLaunchShareId=\(shareId)&parentShareId=\(shareId)&shareId=\(shareId)&shareAppType=\(BFConfig.shared.appType)&mid=\(getMachineCode())&su=\(BFLoginUserInfo.shared.uid)&isRhythmVideo=\(isRhythmVideo)&rootPageTimestamp=\(rootPageTimestamp ?? Int64(Date().timeIntervalSince1970 * 1000))").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
                     ["/", "=", "?", "&"].forEach { char in
                         let custom = CharacterSet(charactersIn: char).inverted
                         params = params?.addingPercentEncoding(withAllowedCharacters: custom) ?? ""