Commit d0102ac286e35d3f1b165e965d58ce7e043a776e

Authored by “张旭”
1 parent 14f28c15

上传鉴权-不用默认的sign

metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
@@ -9,6 +9,7 @@ import Foundation @@ -9,6 +9,7 @@ import Foundation
9 import Qiniu 9 import Qiniu
10 import CNLiveRequestBastKit 10 import CNLiveRequestBastKit
11 import CNLiveBaseTools 11 import CNLiveBaseTools
  12 +import CNLiveBusinessTools
12 13
13 typealias ProgressBlcok = (_ key: String,_ percent: CGFloat) -> Void 14 typealias ProgressBlcok = (_ key: String,_ percent: CGFloat) -> Void
14 typealias SuccessBlock = (_ key: String,_ url: String) -> Void 15 typealias SuccessBlock = (_ key: String,_ url: String) -> Void
@@ -118,17 +119,24 @@ class UploadManager: NSObject { @@ -118,17 +119,24 @@ class UploadManager: NSObject {
118 param.setValue("2", forKey: "storageType") 119 param.setValue("2", forKey: "storageType")
119 param.setValue(kBucketName_QN, forKey: "bucket") 120 param.setValue(kBucketName_QN, forKey: "bucket")
120 param.setValue("\(CNLiveTimeTools.getNow10NumTimestamp())", forKey: "timestamp") 121 param.setValue("\(CNLiveTimeTools.getNow10NumTimestamp())", forKey: "timestamp")
  122 + param.setValue("2", forKey: "appType")
  123 + param.setValue("i", forKey: "clientPlat")
  124 + param.setValue("ios", forKey: "frmId")
  125 + param.setValue("i", forKey: "plat")
  126 +
  127 + let signParam = CNLiveBusinessTools.encryptionSign(withParameter: NSMutableDictionary(dictionary: param), encryptionKey: "ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac")
  128 + let newParam: [String: Any] = signParam as? [String: Any] ?? [:]
121 129
122 let custom_param = NSMutableDictionary() 130 let custom_param = NSMutableDictionary()
123 custom_param.setValue("802_li40qhp922", forKey: "appId")//CNLiveMCEnvironmentManager.shared.appId 131 custom_param.setValue("802_li40qhp922", forKey: "appId")//CNLiveMCEnvironmentManager.shared.appId
124 custom_param.setValue("ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac", forKey: "appKey")//CNLiveMCEnvironmentManager.shared.appKey 132 custom_param.setValue("ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac", forKey: "appKey")//CNLiveMCEnvironmentManager.shared.appKey
125 CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) 133 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
126 CNLiveNetworking.setupShowResult(true) 134 CNLiveNetworking.setupShowResult(true)
127 - CNLiveNetworking.setAllowRequestDefaultArgument(true) 135 + CNLiveNetworking.setAllowRequestDefaultArgument(false)
128 CNLiveNetworking.setupShowDataResult(false) 136 CNLiveNetworking.setupShowDataResult(false)
129 CNLiveNetworking.setupSignRequestKey("ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac")//CNLiveMCEnvironmentManager.shared.appKey)//APPKey_wjj APPKey 137 CNLiveNetworking.setupSignRequestKey("ae3a7ad3e4b9beb7cfe2078db648ebb89aa249ca2e82ac")//CNLiveMCEnvironmentManager.shared.appKey)//APPKey_wjj APPKey
130 138
131 - CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveMCEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in 139 + CNLiveNetworking.requestNetwork(with: .POST, urlString: "\(CNLiveMCEnvironmentManager.shared.img_token_url)/vod_epg/getUploadAuthForApp", param: newParam as! [String : String], cacheType: .networkOnly) { task, result, error in
132 hiddenLoading() 140 hiddenLoading()
133 141
134 if (error == nil) { 142 if (error == nil) {