|
@@ -11,7 +11,7 @@ import UIKit
|
|
|
// MARK: - 埋点数据上报
|
|
|
|
|
|
/// 埋点数据上报
|
|
|
-class PQEventTrackViewModel: NSObject {
|
|
|
+public class PQEventTrackViewModel: NSObject {
|
|
|
/// 基础埋点上报
|
|
|
/// - Parameters:
|
|
|
/// - logType: 数据库类型
|
|
@@ -22,7 +22,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - extParams: extParams 扩展字段,为json对象
|
|
|
/// - remindmsg: remindmsg 打印提示信息
|
|
|
/// - Returns: <#description#>
|
|
|
- class func baseReportUpload(logType: statisticsLogType = .st_log_type_simpleevent, businessType: businessType?, objectType: objectType?, pageSource: PAGESOURCE?, params: [String: Any]? = nil, eventData: [String: Any]? = nil, extParams: [String: Any]? = nil, remindmsg: String? = "基础") {
|
|
|
+ public class func baseReportUpload(logType: statisticsLogType = .st_log_type_simpleevent, businessType: businessType?, objectType: objectType?, pageSource: PAGESOURCE?, params: [String: Any]? = nil, eventData: [String: Any]? = nil, extParams: [String: Any]? = nil, remindmsg: String? = "基础") {
|
|
|
DispatchQueue.global().async {
|
|
|
// LogType
|
|
|
var tempParams: [String: Any] = params ?? [:]
|
|
@@ -64,7 +64,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - videoIds: <#videoIds description#>
|
|
|
/// - playId: <#playId description#>
|
|
|
/// - headVideoId: <#headVideoId description#>
|
|
|
- class func videoRelationReportUpload(reportLogType: reportLogType, videoData: PQVideoListModel?, pageSource: PAGESOURCE? = nil, businessType: businessType?, objectType: objectType? = nil, extParams: [String: Any]? = nil, shareId: String? = nil, videoIds: String? = nil, playId: String? = nil, headVideoId: String? = nil) {
|
|
|
+ public class func videoRelationReportUpload(reportLogType: reportLogType, videoData: PQVideoListModel?, pageSource: PAGESOURCE? = nil, businessType: businessType?, objectType: objectType? = nil, extParams: [String: Any]? = nil, shareId: String? = nil, videoIds: String? = nil, playId: String? = nil, headVideoId: String? = nil) {
|
|
|
var tempExtParams: [String: Any] = extParams ?? [:]
|
|
|
if videoData?.reCreateVideoData != nil {
|
|
|
tempExtParams["projectId"] = videoData?.reCreateVideoData?.projectId ?? ""
|
|
@@ -101,7 +101,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - businessType: 操作类型
|
|
|
/// - targetUid: 视频用户ID
|
|
|
/// - Returns: <#description#>
|
|
|
- class func reportVideoPlayUpload(reportLogType: reportLogType, videoId: String, headVideoId: String?, videoIds: String?, pageSource: PAGESOURCE, playId: String, recommendId: String?, recommendLogVO: String?, abInfoData: String?, measureType: Int?, measureId: Int?, businessType: businessType?, targetUid: Int = 0, shareId: String = "", extParams: [String: Any]? = nil, objectType: objectType? = nil) {
|
|
|
+ public class func reportVideoPlayUpload(reportLogType: reportLogType, videoId: String, headVideoId: String?, videoIds: String?, pageSource: PAGESOURCE, playId: String, recommendId: String?, recommendLogVO: String?, abInfoData: String?, measureType: Int?, measureId: Int?, businessType: businessType?, targetUid: Int = 0, shareId: String = "", extParams: [String: Any]? = nil, objectType: objectType? = nil) {
|
|
|
DispatchQueue.global().async {
|
|
|
var params: [String: Any] = ["videoId": videoId, "pageSource": pageSource.rawValue, "playId": playId, "targetUid": targetUid]
|
|
|
if measureType != nil {
|
|
@@ -180,76 +180,76 @@ class PQEventTrackViewModel: NSObject {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// 分享上报
|
|
|
- /// - Parameters:
|
|
|
- /// - isShareVideo: 是否是分享视频
|
|
|
- /// - screenType: 分享场景 1-分享视频/用户 2-分享视频到朋友圈 3-分享视频到好友
|
|
|
- /// - videoId: 视频Id
|
|
|
- /// - pageSource: 页面枚举
|
|
|
- /// - recommendId: <#recommendId description#>
|
|
|
- /// - recommendLogVO: <#recommendLogVO description#>
|
|
|
- /// - abInfoData: <#abInfoData description#>
|
|
|
- /// - measureType: <#measureType description#>
|
|
|
- /// - measureId: <#measureId description#>
|
|
|
- /// - businessType: <#businessType description#>
|
|
|
- /// - targetUid: <#targetUid description#>
|
|
|
- /// - shareId: <#shareId description#>
|
|
|
-// class func shareReportUpload(isShareVideo: Bool = true, screenType: Int = 1, videoId: String, pageSource: PAGESOURCE, recommendId: String?, recommendLogVO: String?, abInfoData: String?, measureType: Int?, measureId: Int?, businessType: businessType?, targetUid: Int?, shareId: String = "") {
|
|
|
-// DispatchQueue.global().async {
|
|
|
-// var url: String = PQENVUtil.shared.longvideoapi
|
|
|
-// switch screenType {
|
|
|
-// case 1:
|
|
|
-// url = url + userShareReportUrl
|
|
|
-// case 2:
|
|
|
-// url = url + userShareH5ReportUrl
|
|
|
-// case 3:
|
|
|
-// url = url + userShareFriendReportUrl
|
|
|
-// default:
|
|
|
-// break
|
|
|
-// }
|
|
|
-// var params: [String: Any] = ["type": isShareVideo ? "1" : "2", "videoId": videoId, "pageSource": pageSource.rawValue, "playId": PQSingletoVideoPlayer.shared.playId, "targetUid": targetUid ?? 0, "shareDepth": "0"]
|
|
|
-// if measureType != nil {
|
|
|
-// params["measureType"] = measureType
|
|
|
-// }
|
|
|
-// if measureId != nil {
|
|
|
-// params["measureId"] = measureId
|
|
|
-// }
|
|
|
-// params["shareId"] = shareId
|
|
|
-// params["rootLaunchShareId"] = shareId
|
|
|
-// params["parentShareId"] = shareId
|
|
|
-// params["rootShareId"] = shareId
|
|
|
-// if !BFLoginUserInfo.shared.openId.isEmpty {
|
|
|
-// params["shareUi"] = BFLoginUserInfo.shared.openId
|
|
|
-// }
|
|
|
-// if pageSource.rawValue.contains("speedApp-category") {
|
|
|
-// params["pageCategoryId"] = 55
|
|
|
-// }
|
|
|
-// if isShareVideo {
|
|
|
-// params["shareObjectId"] = videoId
|
|
|
-// } else {
|
|
|
-// params["shareObjectId"] = targetUid
|
|
|
-// }
|
|
|
-// if businessType != nil {
|
|
|
-// params["businessType"] = businessType?.rawValue
|
|
|
-// }
|
|
|
-// if recommendId != nil, !(recommendId?.isEmpty ?? true) {
|
|
|
-// params["recommendId"] = recommendId
|
|
|
-// }
|
|
|
-// if recommendLogVO != nil, !(recommendLogVO?.isEmpty ?? true) {
|
|
|
-// params["recommendLogVO"] = recommendLogVO
|
|
|
-// }
|
|
|
-// if abInfoData != nil, !(abInfoData?.isEmpty ?? true) {
|
|
|
-// params["abInfoData"] = abInfoData
|
|
|
-// }
|
|
|
-// SWNetRequest.postRequestData(url: url, parames: params) { response, _, error, _ in
|
|
|
-// BFLog(message: "用户点击分享数据上报:\(String(describing: error)),\(response ?? [:])")
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+// / 分享上报
|
|
|
+// / - Parameters:
|
|
|
+// / - isShareVideo: 是否是分享视频
|
|
|
+// / - screenType: 分享场景 1-分享视频/用户 2-分享视频到朋友圈 3-分享视频到好友
|
|
|
+// / - videoId: 视频Id
|
|
|
+// / - pageSource: 页面枚举
|
|
|
+// / - recommendId: <#recommendId description#>
|
|
|
+// / - recommendLogVO: <#recommendLogVO description#>
|
|
|
+// / - abInfoData: <#abInfoData description#>
|
|
|
+// / - measureType: <#measureType description#>
|
|
|
+// / - measureId: <#measureId description#>
|
|
|
+// / - 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?, abInfoData: String?, measureType: Int?, measureId: Int?, businessType: businessType?, targetUid: Int?, shareId: String = "") {
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ var url: String = PQENVUtil.shared.longvideoapi
|
|
|
+ switch screenType {
|
|
|
+ case 1:
|
|
|
+ url = url + userShareReportUrl
|
|
|
+ case 2:
|
|
|
+ url = url + userShareH5ReportUrl
|
|
|
+ case 3:
|
|
|
+ url = url + userShareFriendReportUrl
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ var params: [String: Any] = ["type": isShareVideo ? "1" : "2", "videoId": videoId, "pageSource": pageSource.rawValue, "playId": PQSingletoVideoPlayer.shared.playId, "targetUid": targetUid ?? 0, "shareDepth": "0"]
|
|
|
+ if measureType != nil {
|
|
|
+ params["measureType"] = measureType
|
|
|
+ }
|
|
|
+ if measureId != nil {
|
|
|
+ params["measureId"] = measureId
|
|
|
+ }
|
|
|
+ params["shareId"] = shareId
|
|
|
+ params["rootLaunchShareId"] = shareId
|
|
|
+ params["parentShareId"] = shareId
|
|
|
+ params["rootShareId"] = shareId
|
|
|
+ if !BFLoginUserInfo.shared.openId.isEmpty {
|
|
|
+ params["shareUi"] = BFLoginUserInfo.shared.openId
|
|
|
+ }
|
|
|
+ if pageSource.rawValue.contains("speedApp-category") {
|
|
|
+ params["pageCategoryId"] = 55
|
|
|
+ }
|
|
|
+ if isShareVideo {
|
|
|
+ params["shareObjectId"] = videoId
|
|
|
+ } else {
|
|
|
+ params["shareObjectId"] = targetUid
|
|
|
+ }
|
|
|
+ if businessType != nil {
|
|
|
+ params["businessType"] = businessType?.rawValue
|
|
|
+ }
|
|
|
+ if recommendId != nil, !(recommendId?.isEmpty ?? true) {
|
|
|
+ params["recommendId"] = recommendId
|
|
|
+ }
|
|
|
+ if recommendLogVO != nil, !(recommendLogVO?.isEmpty ?? true) {
|
|
|
+ params["recommendLogVO"] = recommendLogVO
|
|
|
+ }
|
|
|
+ if abInfoData != nil, !(abInfoData?.isEmpty ?? true) {
|
|
|
+ params["abInfoData"] = abInfoData
|
|
|
+ }
|
|
|
+ SWNetRequest.postRequestData(url: url, parames: params) { response, _, error, _ in
|
|
|
+ BFLog(message: "用户点击分享数据上报:\(String(describing: error)),\(response ?? [:])")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/// DNS上报
|
|
|
/// - Returns: <#description#>
|
|
|
- class func dnsReportUpload() {
|
|
|
+ public class func dnsReportUpload() {
|
|
|
DispatchQueue.global().async {
|
|
|
let speedExtParams = parseDNS(hostUrl: "speed.piaoquantv.com")
|
|
|
let rescdnExtParams = parseDNS(hostUrl: "rescdn.yishihui.com")
|
|
@@ -271,7 +271,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - extParams: <#extParams description#>
|
|
|
/// - pageSource: <#pageSource description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- class func reportStatisticsUpload(isHotLaunch: Bool = false, logType: statisticsLogType, coldLaunchType _: coldLaunchType = .coldLaunchType_userActiveOpen, eventId _: String?, eventData _: String?, pageSource: PAGESOURCE?) {
|
|
|
+ class public func reportStatisticsUpload(isHotLaunch: Bool = false, logType: statisticsLogType, coldLaunchType _: coldLaunchType = .coldLaunchType_userActiveOpen, eventId _: String?, eventData _: String?, pageSource: PAGESOURCE?) {
|
|
|
DispatchQueue.global().async {
|
|
|
var params: [String: Any] = ["LogType": logType.rawValue]
|
|
|
if PQSingletoMemoryUtil.shared.isColdLaunch {
|
|
@@ -342,7 +342,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - pushTargetId: pushTargetType == 1 视频ID,pushTargetType == 4 用户ID
|
|
|
/// - bizParam 扩展参数
|
|
|
/// - Returns: <#description#>
|
|
|
- class func reportPushActionUpload(pushId: String, pushTargetType: Int, pushBrand: String = cPushChannel, pushTargetId: String?,bizParam : [String: Any]? = nil) {
|
|
|
+ public class func reportPushActionUpload(pushId: String, pushTargetType: Int, pushBrand: String = cPushChannel, pushTargetId: String?,bizParam : [String: Any]? = nil) {
|
|
|
DispatchQueue.global().async {
|
|
|
var params: [String: Any] = bizParam ?? Dictionary<String,Any>.init()
|
|
|
if pushTargetId != nil {
|
|
@@ -367,7 +367,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - Parameter registerId: 设备id
|
|
|
/// - Parameter deviceToken: <#deviceToken description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- class func reportPushDeviceTokenUpload(registerId: String, deviceToken: String, completeHander: @escaping (_ isSuccess: Bool) -> Void) {
|
|
|
+ public class func reportPushDeviceTokenUpload(registerId: String, deviceToken: String, completeHander: @escaping (_ isSuccess: Bool) -> Void) {
|
|
|
DispatchQueue.global().async {
|
|
|
SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + pushDeviceTokenReportUrl, parames: ["registerId": registerId, "deviceToken": deviceToken, "brand": cPushChannel]) { response, _, error, _ in
|
|
|
completeHander(error == nil ? true : false)
|
|
@@ -383,7 +383,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - searchNumber: 数量
|
|
|
/// - reportType: 1 into 2 click 3 show
|
|
|
/// - Returns: <#description#>
|
|
|
- class func searchReportUpload(keyWord: String, searchType: Int, searchNumber: Int = 10, reportType: Int = 2) {
|
|
|
+ public class func searchReportUpload(keyWord: String, searchType: Int, searchNumber: Int = 10, reportType: Int = 2) {
|
|
|
DispatchQueue.global().async {
|
|
|
let params: [String: Any] = ["keyWord": keyWord, "searchType": searchType, "searchNumber": searchNumber, "reportType": reportType]
|
|
|
SWNetRequest.postRequestData(url: PQENVUtil.shared.longvideoapi + searchReportUrl, parames: params) { response, _, error, _ in
|
|
@@ -399,7 +399,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - ossInfo: <#ossInfo description#>
|
|
|
/// - params: <#params description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- class func publishReportUpload(projectId: String?, businessType: businessType, ossInfo: [String: Any], params: [String: Any]) {
|
|
|
+ public class func publishReportUpload(projectId: String?, businessType: businessType, ossInfo: [String: Any], params: [String: Any]) {
|
|
|
DispatchQueue.global().async {
|
|
|
var extParams: [String: Any] = ["ossInfo": dictionaryToJsonString(ossInfo) ?? "", "params": dictionaryToJsonString(params) ?? ""]
|
|
|
if projectId != nil {
|
|
@@ -417,7 +417,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - businessType: <#businessType description#>
|
|
|
/// - materialList: <#materialList description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- class func dealWithMaterialSearchReportUpload(businessType: businessType, materialList: [PQEditVisionTrackMaterialsModel]) {
|
|
|
+ public class func dealWithMaterialSearchReportUpload(businessType: businessType, materialList: [PQEditVisionTrackMaterialsModel]) {
|
|
|
if materialList.count > 0 {
|
|
|
DispatchQueue.global().async {
|
|
|
for item in materialList {
|
|
@@ -434,7 +434,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - businessType: <#businessType description#>
|
|
|
/// - pageSource: <#pageSource description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- class func materialReportUpload(material: PQEditVisionTrackMaterialsModel?, businessType: businessType?, objectType: objectType? = nil) {
|
|
|
+ public class func materialReportUpload(material: PQEditVisionTrackMaterialsModel?, businessType: businessType?, objectType: objectType? = nil) {
|
|
|
DispatchQueue.global().async {
|
|
|
var params: [String: Any] = [:]
|
|
|
var eventData: [String: Any] = [:]
|
|
@@ -481,7 +481,7 @@ class PQEventTrackViewModel: NSObject {
|
|
|
/// - extParams: 扩展字段 json格式
|
|
|
/// - remindmsg: 打印提示信息
|
|
|
/// - Returns: <#description#>
|
|
|
- class func messageReportUpload(messageIds: String?, clickId: String?, messageType: messageType?, messageSubType: messageSubType?, actionType: actionType?, objectType: objectType?, pageSource: PAGESOURCE?, readStatus: Int = 1, eventData: [String: Any]? = nil, extParams: [String: Any]? = nil, remindmsg: String? = "基础") {
|
|
|
+ public class func messageReportUpload(messageIds: String?, clickId: String?, messageType: messageType?, messageSubType: messageSubType?, actionType: actionType?, objectType: objectType?, pageSource: PAGESOURCE?, readStatus: Int = 1, eventData: [String: Any]? = nil, extParams: [String: Any]? = nil, remindmsg: String? = "基础") {
|
|
|
DispatchQueue.global().async {
|
|
|
var tempParams: [String: Any] = extParams ?? [:]
|
|
|
if messageType != nil, messageType != .mt_nomal {
|