|
@@ -6,9 +6,9 @@
|
|
|
// Copyright © 2020 BytesFlow. All rights reserved.
|
|
|
//
|
|
|
|
|
|
-import UIKit
|
|
|
import BFCommonKit
|
|
|
import BFNetRequestKit
|
|
|
+import UIKit
|
|
|
|
|
|
public class PQUploadViewModel: NSObject {
|
|
|
/// 发布视频
|
|
@@ -21,12 +21,15 @@ public class PQUploadViewModel: NSObject {
|
|
|
/// - descr: 描述
|
|
|
/// - videoFromScene 视频来源场景 1:普通上传 2:创作工具,3:普通上传转创作工具,4:后台转换加工,5:卡点视频制作
|
|
|
/// - Returns: <#description#>
|
|
|
- class public func publishVideo(projectId: String?, fileExtensions: String?, title: String, videoPath: String, coverImgPath: String?, descr: String, videoFromScene: videoFromScene, reCreateData: PQReCreateModel?, eventTrackData: PQVideoMakeEventTrackModel?, completeHander: @escaping (_ videoData: PQVideoListModel?, _ jsonDict: [String: Any]?, _ msg: String?) -> Void) {
|
|
|
+ public class func publishVideo(projectId: String?, fileExtensions: String?, title: String, videoPath: String, coverImgPath: String?, descr: String, videoFromScene: videoFromScene, reCreateData: PQReCreateModel?, eventTrackData: PQVideoMakeEventTrackModel?, topicId: String? = nil, completeHander: @escaping (_ videoData: PQVideoListModel?, _ jsonDict: [String: Any]?, _ msg: String?) -> Void) {
|
|
|
BFLog(message: "AKAKAAKprojectId is\(String(describing: projectId)) videoFromScene is \(videoFromScene)")
|
|
|
- var params : Dictionary<String,Any> = ["title": title, "fileExtensions": fileExtensions ?? "application/octet-stream", "videoPath": videoPath, "descr": descr, "viewStatus": 1, "produceProjectId": (projectId ?? "") as String, "videoFromScene": videoFromScene.rawValue]
|
|
|
- if coverImgPath != nil && (coverImgPath?.count ?? 0) > 0 {
|
|
|
+ var params: [String: Any] = ["title": title, "fileExtensions": fileExtensions ?? "application/octet-stream", "videoPath": videoPath, "descr": descr, "viewStatus": 1, "produceProjectId": (projectId ?? "") as String, "videoFromScene": videoFromScene.rawValue]
|
|
|
+ if coverImgPath != nil, (coverImgPath?.count ?? 0) > 0 {
|
|
|
params["coverImgPath"] = coverImgPath
|
|
|
}
|
|
|
+ if topicId != nil, (topicId?.count ?? 0) > 0 {
|
|
|
+ params["topicId"] = topicId
|
|
|
+ }
|
|
|
BFNetRequestAdaptor.postRequestData(url: PQENVUtil.shared.longvideoapi + videoSendUrl, parames: params, commonParams: commonParams()) { response, _, error, _ in
|
|
|
if error != nil {
|
|
|
completeHander(nil, nil, error?.msg)
|
|
@@ -50,11 +53,11 @@ public class PQUploadViewModel: NSObject {
|
|
|
}
|
|
|
PQEventTrackViewModel.baseReportUpload(businessType: .bt_up_process, objectType: .ot_up_publishSuccess, pageSource: nil, extParams: extParams, remindmsg: "上传相关")
|
|
|
if projectId != nil {
|
|
|
- PQBaseViewModel.reportSendVideo(projectId!, tempModel.uniqueId ?? "",videoFromScene: videoFromScene) { isSuccess, _ in
|
|
|
+ PQBaseViewModel.reportSendVideo(projectId!, tempModel.uniqueId ?? "", videoFromScene: videoFromScene) { isSuccess, _ in
|
|
|
if !isSuccess {
|
|
|
- PQBaseViewModel.reportSendVideo(projectId!, tempModel.uniqueId ?? "",videoFromScene: videoFromScene) { isSuccess, _ in
|
|
|
+ PQBaseViewModel.reportSendVideo(projectId!, tempModel.uniqueId ?? "", videoFromScene: videoFromScene) { isSuccess, _ in
|
|
|
if !isSuccess {
|
|
|
- PQBaseViewModel.reportSendVideo(projectId!, tempModel.uniqueId ?? "",videoFromScene: videoFromScene) { isSuccess, _ in
|
|
|
+ PQBaseViewModel.reportSendVideo(projectId!, tempModel.uniqueId ?? "", videoFromScene: videoFromScene) { isSuccess, _ in
|
|
|
if !isSuccess {}
|
|
|
}
|
|
|
}
|
|
@@ -80,8 +83,12 @@ public class PQUploadViewModel: NSObject {
|
|
|
/// - descr: 描述
|
|
|
/// - completeHander: <#completeHander description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- public class func updateVideo(title: String, videoId: String, coverImgPath: String, descr: String, completeHander: @escaping (_ videoData: PQVideoListModel?, _ msg: String?) -> Void) {
|
|
|
- BFNetRequestAdaptor.postRequestData(url: PQENVUtil.shared.longvideoapi + updateVideoUrl, parames: ["title": title, "videoId": videoId, "coverImgPath": coverImgPath, "descr": descr, "viewStatus": 1, "barrageSwitch": 1], commonParams: commonParams()) { response, _, error, _ in
|
|
|
+ public class func updateVideo(title: String, videoId: String, coverImgPath: String, descr: String,topicId:Int64? = nil, completeHander: @escaping (_ videoData: PQVideoListModel?, _ msg: String?) -> Void) {
|
|
|
+ var params : Dictionary<String,Any> = ["title": title, "videoId": videoId, "coverImgPath": coverImgPath, "descr": descr, "viewStatus": 1, "barrageSwitch": 1]
|
|
|
+ if topicId != nil && (topicId ?? 0) > 0 {
|
|
|
+ params["topicId"] = topicId!
|
|
|
+ }
|
|
|
+ BFNetRequestAdaptor.postRequestData(url: PQENVUtil.shared.longvideoapi + updateVideoUrl, parames: params, commonParams: commonParams()) { response, _, error, _ in
|
|
|
if error != nil {
|
|
|
completeHander(nil, error?.msg)
|
|
|
return
|
|
@@ -100,7 +107,7 @@ public class PQUploadViewModel: NSObject {
|
|
|
/// - totalTime: 总时长
|
|
|
/// - completeHander: <#completeHander description#>
|
|
|
/// - Returns: <#description#>
|
|
|
- class public func vodeoCoverImageList(videoId: String, videoPath: String, totalTime: Int, videoHeight: CGFloat, videoWidth: CGFloat, completeHander: @escaping (_ coverImages: [PQUploadModel]?, _ msg: String?) -> Void) {
|
|
|
+ public class func vodeoCoverImageList(videoId: String, videoPath: String, totalTime: Int, videoHeight: CGFloat, videoWidth: CGFloat, completeHander: @escaping (_ coverImages: [PQUploadModel]?, _ msg: String?) -> Void) {
|
|
|
BFNetRequestAdaptor.postRequestData(url: PQENVUtil.shared.longvideoapi + vodeoCoverImageUrl, parames: ["id": videoId, "videoPath": videoPath, "totalTime": totalTime], commonParams: commonParams()) { response, _, error, _ in
|
|
|
if error != nil {
|
|
|
completeHander(nil, error?.msg)
|