|
@@ -14,7 +14,7 @@ import RealmSwift
|
|
|
|
|
|
public class BFRecordScreenViewModel: NSObject {
|
|
|
/// 取文本转语言 token
|
|
|
- /// - Parameter completeHander: <#completeHander description#>
|
|
|
+ /// - Parameter completeHander: completeHander description
|
|
|
public class func getNlsAccessToken(completeHander: @escaping (_ token: String, _ appkey: String) -> Void) {
|
|
|
|
|
|
let currentLanguage = BFLocalizedUtil.currentLanguage()
|
|
@@ -46,17 +46,23 @@ public class BFRecordScreenViewModel: NSObject {
|
|
|
}
|
|
|
|
|
|
// 取发音人列表数据
|
|
|
- class func getAllVoiceCates(completeHander: @escaping (_ voices: [String: Any]) -> Void) {
|
|
|
+ class func getAllVoiceCates(completeHander: @escaping (_ categorys:[BFVoiceCategoryModel],_ voices: Dictionary<String, [PQVoiceModel]>) -> Void) {
|
|
|
BFNetRequestAdaptor.getRequestData(url: PQENVUtil.shared.clipapiapi + listAllCateVoicesUrl, parames: nil, commonParams: commonParams()) { response, _, _, _ in
|
|
|
|
|
|
- var voicesData: [PQVoiceModel] = Array()
|
|
|
- var voccesDic: [String: Any] = Dictionary()
|
|
|
+
|
|
|
+ var categorys:[BFVoiceCategoryModel] = Array()
|
|
|
+ var voccesDic: Dictionary<String, [PQVoiceModel]> = Dictionary()
|
|
|
if response != nil, !(response is NSNull) {
|
|
|
for voices in response as! [[String: Any]] {
|
|
|
|
|
|
+ var voicesData: [PQVoiceModel] = Array()
|
|
|
let cateName = voices["cateName"] as? String ?? ""
|
|
|
let cateId = voices["cateId"] as? Int ?? 0
|
|
|
BFLog(message: "cateName is \(cateName) cateId is \(cateId)")
|
|
|
+ let category = BFVoiceCategoryModel.init()
|
|
|
+ category.cateName = cateName
|
|
|
+ category.cateID = cateId
|
|
|
+ categorys.append(category)
|
|
|
for voice in voices["voiceDatas"] as! [[String: Any]] {
|
|
|
if voice.keys.contains("channel"), "\(voice["channel"] ?? "")" == "aliyun", voice.keys.contains("appEnable"), "\(voice["appEnable"] ?? "")" == "1" {
|
|
|
let voiceModel = PQVoiceModel()
|
|
@@ -89,15 +95,16 @@ public class BFRecordScreenViewModel: NSObject {
|
|
|
}
|
|
|
}
|
|
|
voicesData.append(voiceModel)
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
voccesDic[cateName] = voicesData
|
|
|
}
|
|
|
- completeHander(voccesDic)
|
|
|
+ completeHander(categorys,voccesDic)
|
|
|
|
|
|
} else {
|
|
|
- completeHander(voccesDic)
|
|
|
+ completeHander(categorys,voccesDic)
|
|
|
}
|
|
|
}
|
|
|
}
|