Commit 3c70e924 authored by David黄金龙's avatar David黄金龙

修改 几处错误代码

parent b15bc9a3
...@@ -18,7 +18,7 @@ class YHOneKeyLoginViewModel { ...@@ -18,7 +18,7 @@ class YHOneKeyLoginViewModel {
json, code in json, code in
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 { if json.code == 200 {
if let dic = json.data as? [String: Any], let sdkKey = dic["sdkKey"] as? String, !sdkKey.isEmpty { if let dic = json.data?.peel as? [String: Any], let sdkKey = dic["sdkKey"] as? String, !sdkKey.isEmpty {
completion?(sdkKey) completion?(sdkKey)
} else { } else {
......
...@@ -104,6 +104,38 @@ class YHButlerServiceManager: NSObject { ...@@ -104,6 +104,38 @@ class YHButlerServiceManager: NSObject {
extension YHButlerServiceManager { extension YHButlerServiceManager {
// MARK: - customActionConfig // MARK: - customActionConfig
private func handelMessageType(_ content : String?)->QYLinkClickActionPolicy {
if let dicData = content,let data = dicData.data(using: .utf8) {
do {
if let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
// 转换成功,jsonObject 是一个字典
print("JSON字符串转换为字典成功: \(jsonObject)")
/*
"{\"order_id\":151824,\"type\":27}"
*/
if !jsonObject.isEmpty {
let orderID : Int = jsonObject["order_id"] as? Int ?? -1
let type : Int = jsonObject["type"] as? Int ?? -1
if orderID > -1,type > -1 {
YHServiceOrderListView.jumpToMessageController(type: type, orderId: orderID)
return QYLinkClickActionPolicy.cancel
}
} else {
printLog("ddddd")
}
} else {
printLog("JSON字符串不是有效的字典格式")
}
} catch {
printLog("JSON解析错误: \(error)")
}
}
return QYLinkClickActionPolicy.open
}
private func updateActionConfig() { private func updateActionConfig() {
// 账号登录后是否拉取漫游消息 // 账号登录后是否拉取漫游消息
customActionConfig?.pullRoamMessage = true customActionConfig?.pullRoamMessage = true
...@@ -112,8 +144,9 @@ extension YHButlerServiceManager { ...@@ -112,8 +144,9 @@ extension YHButlerServiceManager {
customActionConfig?.linkClickBlock = { linkAddress in customActionConfig?.linkClickBlock = { linkAddress in
guard let linkAddress = linkAddress, (linkAddress.isValidHttpUrl || linkAddress.isValidHttpsUrl || linkAddress.isValidFileUrl), let url = URL(string: linkAddress) else { guard let linkAddress = linkAddress, (linkAddress.isValidHttpUrl || linkAddress.isValidHttpsUrl || linkAddress.isValidFileUrl), let url = URL(string: linkAddress) else {
return QYLinkClickActionPolicy.open return self.handelMessageType(linkAddress)
} }
let safariViewController = SFSafariViewController(url: url) let safariViewController = SFSafariViewController(url: url)
safariViewController.dismissButtonStyle = .close safariViewController.dismissButtonStyle = .close
safariViewController.modalPresentationStyle = .fullScreen safariViewController.modalPresentationStyle = .fullScreen
......
...@@ -227,18 +227,14 @@ class YHCerAppointViewModel: YHBaseViewModel { ...@@ -227,18 +227,14 @@ class YHCerAppointViewModel: YHBaseViewModel {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.AppointHK.isNeedGoHK let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.AppointHK.isNeedGoHK
let _ = YHNetRequest.getRequest(url: strUrl,params: ["order_id" : orderId]) { let _ = YHNetRequest.getRequest(url: strUrl,params: ["order_id" : orderId]) { json, code in
[weak self] json, code in
guard let self = self else { return }
printLog("model 是 ==> \(json)") printLog("model 是 ==> \(json)")
if json.code == 200 { if json.code == 200 {
// is_need_to_hk 1需要赴港 0不需要 2没有选择 // is_need_to_hk 1需要赴港 0不需要 2没有选择
// reservation_to_hk 0没有预约 1已经预約 // reservation_to_hk 0没有预约 1已经预約
var isNeedGoHK = 2 var isNeedGoHK = 2
var reserveToHK = 0 var reserveToHK = 0
if let dic = json.data as? [String:Any] { if let dic = json.data?.peel as? [String:Any] {
if let needGoHK = dic["is_need_to_hk"] as? Int { if let needGoHK = dic["is_need_to_hk"] as? Int {
isNeedGoHK = needGoHK isNeedGoHK = needGoHK
} }
...@@ -253,7 +249,7 @@ class YHCerAppointViewModel: YHBaseViewModel { ...@@ -253,7 +249,7 @@ class YHCerAppointViewModel: YHBaseViewModel {
} }
} else { } else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg) // let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
callback?(2, 0) callback?(2, 0)
} }
......
...@@ -90,7 +90,7 @@ class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate { ...@@ -90,7 +90,7 @@ class YHH5WebViewVC: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
var isNeedRefreshDataFlag : Bool = false var isNeedRefreshDataFlag : Bool = false
//webView内部返回 //webView内部返回
var isSupportWebviewInterBackFlag : Bool = true var isSupportWebviewInterBackFlag : Bool = false
override func backItemClick(_ sender: Any) { override func backItemClick(_ sender: Any) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment