From: liangzhenying <867174124@qq.com> Date: Mon, 29 Jul 2024 07:54:03 +0000 (+0800) Subject: 新增dt、isAuth参数 X-Git-Tag: deepseek~13 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=78e775976dc53e21af3ab9d4a17419528580981b;p=mirrors%2FMixSdk-iOS.git 新增dt、isAuth参数 --- diff --git a/MixSdk/MixSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate b/MixSdk/MixSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate index 486b258..cd20d4b 100644 Binary files a/MixSdk/MixSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate and b/MixSdk/MixSdk.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MixSdk/MixSdk/MixSdk/MSAigc.swift b/MixSdk/MixSdk/MixSdk/MSAigc.swift index 18a4640..bf89e55 100644 --- a/MixSdk/MixSdk/MixSdk/MSAigc.swift +++ b/MixSdk/MixSdk/MixSdk/MSAigc.swift @@ -28,7 +28,7 @@ public class MSAigc{ completeHandler(nil,.unauthorised) return } - let url = MSConfig.httpUrl(api: "aigc/get-style") + let url = MSConfig.aigcUrl(api: "aigc/get-style") let params = [ "type":type, ] @@ -65,7 +65,7 @@ public class MSAigc{ completeHandler(nil,.unauthorised) return } - let url = MSConfig.httpUrl(api: "aigc/get-result") + let url = MSConfig.aigcUrl(api: "aigc/get-result") let params:[String:Any] = [ "task_id":task.task_id, "bit_depth":task.bit_depth, @@ -112,7 +112,7 @@ public class MSAigc{ completeHandler(nil,MSError.invalidRequest) return } - let url = MSConfig.httpUrl(api: "aigc/create-image") + let url = MSConfig.aigcUrl(api: "aigc/create-image") Logger.log(url,params) HTTP.POST(url,parameters: params,requestSerializer: JSONParameterSerializer()){ response in diff --git a/MixSdk/MixSdk/MixSdk/MSAuth.swift b/MixSdk/MixSdk/MixSdk/MSAuth.swift index a6f9362..75708ed 100644 --- a/MixSdk/MixSdk/MixSdk/MSAuth.swift +++ b/MixSdk/MixSdk/MixSdk/MSAuth.swift @@ -21,10 +21,6 @@ public class MSAuth { var deviceToken = "" - func getUrl(_ api:String)->String{ - return "http://180.184.206.142/bz-api/" + api - } - /// 注册 /// - Parameters: /// - productId: 产品id @@ -43,7 +39,7 @@ public class MSAuth { "sign":signValue, "timeStamp":timeStamp, ] - let url = getUrl("dev/auth/active") + let url = MSConfig.authUrl(api:"dev/auth/active") Logger.log(value,productKey,signValue) Logger.log(url,params) @@ -96,7 +92,7 @@ public class MSAuth { "password":pwd, "nonce":nonce, ] - let url = getUrl("dev/auth/sign_in") + let url = MSConfig.authUrl(api:"dev/auth/sign_in") Logger.log(url,params) HTTP.POST(url,parameters: params,requestSerializer: JSONParameterSerializer()){ response in diff --git a/MixSdk/MixSdk/MixSdk/MSStt.swift b/MixSdk/MixSdk/MixSdk/MSStt.swift index c85ddb8..577a645 100644 --- a/MixSdk/MixSdk/MixSdk/MSStt.swift +++ b/MixSdk/MixSdk/MixSdk/MSStt.swift @@ -88,7 +88,7 @@ public class MSStt { return } - var url = MSConfig.httpUrl(api: "asr/sentence-recognize?") + var url = MSConfig.asr(api: "asr/sentence-recognize") if let value = format{ url += "format=\(value)&" } @@ -194,12 +194,12 @@ public extension MSStt{ extension MSStt:WebSocketDelegate{ func webSocketOpen() { -// Logger.log("MSStt webSocketOpen") + Logger.log("MSStt webSocketOpen") connectStateCallBack?(.connected) } func webSocketClose(_ code: Int, reason: String, wasClean: Bool) { -// Logger.log("MSStt webSocketClose",code,reason,wasClean) + Logger.log("MSStt webSocketClose",code,reason,wasClean) connectStateCallBack?(.disConnected) } diff --git a/MixSdk/MixSdk/MixSdk/MSTranslate.swift b/MixSdk/MixSdk/MixSdk/MSTranslate.swift index 429e594..b222a27 100644 --- a/MixSdk/MixSdk/MixSdk/MSTranslate.swift +++ b/MixSdk/MixSdk/MixSdk/MSTranslate.swift @@ -25,7 +25,7 @@ public class MSTranslate { completeHandler(nil,.unauthorised) return } - let url = MSConfig.httpUrl(api: "translate/general") + let url = MSConfig.translateUrl(api: "translate/general") let params = [ "sl":"auto", "tl":lang.code, @@ -59,7 +59,7 @@ public class MSTranslate { completeHandler(nil,.unauthorised) return } - let url = MSConfig.httpUrl(api: "translate/languages") + let url = MSConfig.translateUrl(api: "translate/languages") Logger.log(url) HTTP.POST(url,requestSerializer: JSONParameterSerializer()){ response in diff --git a/MixSdk/MixSdk/MixSdk/MSTts.swift b/MixSdk/MixSdk/MixSdk/MSTts.swift index 19269c2..55b5f0c 100644 --- a/MixSdk/MixSdk/MixSdk/MSTts.swift +++ b/MixSdk/MixSdk/MixSdk/MSTts.swift @@ -162,12 +162,12 @@ public extension MSTts{ extension MSTts:WebSocketDelegate{ func webSocketOpen() { -// Logger.log("MSTts webSocketOpen") + Logger.log("MSTts webSocketOpen") connectStateCallBack?(.connected) } func webSocketClose(_ code: Int, reason: String, wasClean: Bool) { -// Logger.log("MSTts webSocketClose",code,reason,wasClean) + Logger.log("MSTts webSocketClose",code,reason,wasClean) connectStateCallBack?(.disConnected) } diff --git a/MixSdk/MixSdk/MixSdk/MixSdk.swift b/MixSdk/MixSdk/MixSdk/MixSdk.swift index 9e27665..8a4c303 100644 --- a/MixSdk/MixSdk/MixSdk/MixSdk.swift +++ b/MixSdk/MixSdk/MixSdk/MixSdk.swift @@ -25,26 +25,37 @@ import Foundation class MSConfig{ static let wsBaseURL = "ws://amp.raisound.com/" static let httpBaseURL = "https://amp.raisound.com/" + static let authBaseURL = "http://180.184.206.142/bz-api/" static let wsHeartBeatTime = 2.0 -// static func add(api:String)->String{ -// return "?platform=aliyun&is_auth=false" -// return api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&tu=\(MixSdk.shared.auth.deviceToken)" -// return "" -// } - - static func httpUrl(api:String)->String{ +// static func http(api:String)->String{ +// return httpBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" // return httpBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" - return httpBaseURL + api + "" +// return httpBaseURL + api + "" +// } + static func authUrl(api:String)->String{ + return authBaseURL + api + } + static func aigcUrl(api:String)->String{ + return httpBaseURL + api + "?platform=aliyun&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" + // return httpBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" + // return httpBaseURL + api + "" + } + static func translateUrl(api:String)->String{ + return httpBaseURL + api + "?platform=raisound&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" + // return httpBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" + // return httpBaseURL + api + "" + } + static func asr(api:String)->String{ + return httpBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" } static func webSocketUrl(api:String,addPlatform:Bool)->String{ if addPlatform{ - return wsBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)" + return wsBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" } else{ - return wsBaseURL + api + return wsBaseURL + api + "?platform=aliyun&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" } -// return wsBaseURL + api + "?platform=\(MixSdk.shared.aiPlatform.value)&is_auth=1&dt=\(MixSdk.shared.auth.deviceToken)" } } @@ -85,7 +96,6 @@ public enum MSPlatform { /// SDK 管理类 public class MixSdk:NSObject { - public static let shared = MixSdk() private override init() {