Sfoglia il codice sorgente

1.优化更新视频流程

wenweiwei 3 anni fa
parent
commit
61a3be8aa1

+ 3 - 3
BFFramework/Classes/Base/ViewModel/PQUploadViewModel.swift

@@ -83,20 +83,20 @@ public class PQUploadViewModel: NSObject {
     ///   - descr: 描述
     ///   - completeHander: <#completeHander description#>
     /// - Returns: <#description#>
-    public class func updateVideo(title: String, videoId: String, coverImgPath: String, descr: String,topicId:Int64? = nil, completeHander: @escaping (_ videoData: PQVideoListModel?, _ msg: String?) -> Void) {
+    public class func updateVideo(title: String, videoId: String, coverImgPath: String, descr: String,topicId:Int64? = nil, completeHander: @escaping (_ response:[String:Any]?,_ 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)
+                completeHander(nil,nil, error?.msg)
                 return
             }
             // 1015
             let tempModel = PQVideoListModel(jsonDict: response as! [String: Any])
             tempModel.auditStatus = 1
-            completeHander(tempModel, nil)
+            completeHander(response as? [String: Any],tempModel, nil)
         }
     }
 

+ 4 - 2
BFFramework/Classes/PModels/PQVideoListModel.swift

@@ -240,10 +240,12 @@ open class PQVideoListModel: PQBaseModel, BFVideoItemProtocol {
     public var categoryName: String = ""
     // 视频分类图
     public var categoryImage: String?
-    public var topicInfo: Dictionary<String,Any>?
+    public var topicInfo: [String: Any]?
     override public init(jsonDict: [String: Any]) {
         super.init(jsonDict: jsonDict)
-
+        if jsonDict.keys.contains("id") {
+            id = UInt64("\(jsonDict["id"] ?? "")") ?? 0
+        }
         if jsonDict.keys.contains("videoPath") {
             videoPath = "\(jsonDict["videoPath"] ?? "")"
             videoURL = videoPath

+ 1 - 1
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift

@@ -1314,7 +1314,7 @@ extension PQStuckPointPublicController {
                 .uploadObjectAsync(bucketName: bucketName, objectKey: objectKey, data: data!, fileExtensions: "png", imageUploadBlock: { _, code, ossObjectKey, _ in
                     if code == 1 && ossObjectKey == objectKey && ossObjectKey.count > 0 {
                         //add by ak 这里会在服务器生成分享使用的图片到1-2S 时间
-                        PQUploadViewModel.updateVideo(title: self?.videoData?.title ?? "", videoId: self?.videoData?.uniqueId ?? "", coverImgPath: objectKey, descr: "") { newVideoData, msg in
+                        PQUploadViewModel.updateVideo(title: self?.videoData?.title ?? "", videoId: self?.videoData?.uniqueId ?? "", coverImgPath: objectKey, descr: "") {_, newVideoData, msg in
                             
                             if newVideoData == nil {
                                 cShowHUB(superView: self?.view, msg: msg)