|
@@ -69,6 +69,22 @@ class KMMemberCenterManager: NSObject {
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // MARK: 拼接URL(为Get类型)
|
|
|
|
+ func constructURLString(baseURLString: String, parameters: [String: Any]) -> String? {
|
|
|
|
+ // Ensure the base URL is valid
|
|
|
|
+ guard var components = URLComponents(string: baseURLString) else {
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Convert parameters to query items
|
|
|
|
+ components.queryItems = parameters.map { key, value in
|
|
|
|
+ URLQueryItem(name: key, value: "\(value)")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Return the complete URL as a string
|
|
|
|
+ return components.url?.absoluteString
|
|
|
|
+ }
|
|
|
|
+
|
|
// MARK: 登录模块
|
|
// MARK: 登录模块
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -832,7 +848,7 @@ class KMMemberCenterManager: NSObject {
|
|
|
|
|
|
#if VERSION_DMG
|
|
#if VERSION_DMG
|
|
// DMG
|
|
// DMG
|
|
- platformId = "1"
|
|
|
|
|
|
+ platformId = "2"
|
|
#else
|
|
#else
|
|
// AppStore 免费版本
|
|
// AppStore 免费版本
|
|
#endif
|
|
#endif
|
|
@@ -840,63 +856,68 @@ class KMMemberCenterManager: NSObject {
|
|
// AppStore 付费版
|
|
// AppStore 付费版
|
|
platformId = "5"
|
|
platformId = "5"
|
|
#endif
|
|
#endif
|
|
- let params: [String: Any] = ["isEducation": isEducation,
|
|
|
|
|
|
+ let params: [String: Any] = ["isEducation": NSNumber(value: Int32(isEducation)),
|
|
"platformId": platformId]
|
|
"platformId": platformId]
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
-
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- let result_Array: [NSDictionary] = dic["result"] as? [NSDictionary] ?? [[:]]
|
|
|
|
- let message: String = dic["msg"] as? String ?? ""
|
|
|
|
-
|
|
|
|
- var results: [KMListingProductsModel] = []
|
|
|
|
- for dict1 in result_Array {
|
|
|
|
- var id = ""
|
|
|
|
- var productName = ""
|
|
|
|
- var price = NSNumber(value: 0.0)
|
|
|
|
- var maxDeviceNum = 0
|
|
|
|
- var levels = ""
|
|
|
|
- var platforms = ""
|
|
|
|
- var productLineId = 0
|
|
|
|
- var paymentModel = 0
|
|
|
|
- var cycle = 0
|
|
|
|
- var code = ""
|
|
|
|
- var cnyPrice = NSNumber(value: 0.0)
|
|
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ let result_Array: [NSDictionary] = dic["result"] as? [NSDictionary] ?? [[:]]
|
|
|
|
+ let message: String = dic["msg"] as? String ?? ""
|
|
|
|
|
|
- if let token = dict1["id"] { id = token as? String ?? id }
|
|
|
|
- if let token = dict1["productName"] { productName = token as? String ?? productName }
|
|
|
|
- if let token = dict1["price"] { price = token as? NSNumber ?? price }
|
|
|
|
- if let token = dict1["maxDeviceNum"] { maxDeviceNum = token as? Int ?? maxDeviceNum }
|
|
|
|
- if let token = dict1["levels"] { levels = token as? String ?? levels }
|
|
|
|
- if let token = dict1["platforms"] { platforms = token as? String ?? platforms }
|
|
|
|
- if let token = dict1["productLineId"] { productLineId = token as? Int ?? productLineId }
|
|
|
|
- if let token = dict1["paymentModel"] { paymentModel = token as? Int ?? paymentModel }
|
|
|
|
- if let token = dict1["cycle"] { cycle = token as? Int ?? cycle }
|
|
|
|
- if let token = dict1["code"] { code = token as? String ?? code }
|
|
|
|
- if let token = dict1["cnyPrice"] { cnyPrice = token as? NSNumber ?? cnyPrice }
|
|
|
|
|
|
+ var results: [KMListingProductsModel] = []
|
|
|
|
+ for dict1 in result_Array {
|
|
|
|
+ var id = ""
|
|
|
|
+ var productName = ""
|
|
|
|
+ var price = NSNumber(value: 0.0)
|
|
|
|
+ var maxDeviceNum = 0
|
|
|
|
+ var levels = ""
|
|
|
|
+ var platforms = ""
|
|
|
|
+ var productLineId = 0
|
|
|
|
+ var paymentModel = 0
|
|
|
|
+ var cycle = 0
|
|
|
|
+ var code = ""
|
|
|
|
+ var cnyPrice = NSNumber(value: 0.0)
|
|
|
|
+
|
|
|
|
+ if let token = dict1["id"] { id = token as? String ?? id }
|
|
|
|
+ if let token = dict1["productName"] { productName = token as? String ?? productName }
|
|
|
|
+ if let token = dict1["price"] { price = token as? NSNumber ?? price }
|
|
|
|
+ if let token = dict1["maxDeviceNum"] { maxDeviceNum = token as? Int ?? maxDeviceNum }
|
|
|
|
+ if let token = dict1["levels"] { levels = token as? String ?? levels }
|
|
|
|
+ if let token = dict1["platforms"] { platforms = token as? String ?? platforms }
|
|
|
|
+ if let token = dict1["productLineId"] { productLineId = token as? Int ?? productLineId }
|
|
|
|
+ if let token = dict1["paymentModel"] { paymentModel = token as? Int ?? paymentModel }
|
|
|
|
+ if let token = dict1["cycle"] { cycle = token as? Int ?? cycle }
|
|
|
|
+ if let token = dict1["code"] { code = token as? String ?? code }
|
|
|
|
+ if let token = dict1["cnyPrice"] { cnyPrice = token as? NSNumber ?? cnyPrice }
|
|
|
|
|
|
- let products = KMListingProductsModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, code: code, cnyPrice: cnyPrice)
|
|
|
|
- results.append(products)
|
|
|
|
- }
|
|
|
|
|
|
+ let products = KMListingProductsModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, code: code, cnyPrice: cnyPrice)
|
|
|
|
+ results.append(products)
|
|
|
|
+ }
|
|
|
|
|
|
- let result = KMMemberProductResult(code: code, msg: message, listingProducts: results)
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, result)
|
|
|
|
- } else {
|
|
|
|
- complete(false, result)
|
|
|
|
|
|
+ let result = KMMemberProductResult(code: code, msg: message, listingProducts: results)
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, result)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, result)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ print("Invalid URL")
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -912,60 +933,66 @@ class KMMemberCenterManager: NSObject {
|
|
let params: [String: Any] = ["productId": productId,
|
|
let params: [String: Any] = ["productId": productId,
|
|
"isEducation": isEducation,
|
|
"isEducation": isEducation,
|
|
"userId": userId]
|
|
"userId": userId]
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
-
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
|
|
+ }
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ let result_Array: [NSDictionary] = [dic["result"]] as? [NSDictionary] ?? [[:]]
|
|
|
|
+ let message: String = dic["msg"] as? String ?? ""
|
|
|
|
+
|
|
|
|
+ var results: [KMListingProductsModel] = []
|
|
|
|
+ for dict1 in result_Array {
|
|
|
|
+ var id = ""
|
|
|
|
+ var productName = ""
|
|
|
|
+ var price = NSNumber(value: 0.0)
|
|
|
|
+ var maxDeviceNum = 0
|
|
|
|
+ var levels = ""
|
|
|
|
+ var platforms = ""
|
|
|
|
+ var productLineId = 0
|
|
|
|
+ var paymentModel = 0
|
|
|
|
+ var cycle = 0
|
|
|
|
+ var code = ""
|
|
|
|
+ var cnyPrice = NSNumber(value: 0.0)
|
|
|
|
+ if let token = dict1["id"] { id = token as? String ?? id }
|
|
|
|
+ if let token = dict1["productName"] { productName = token as? String ?? productName}
|
|
|
|
+ if let token = dict1["price"] { price = token as? NSNumber ?? price }
|
|
|
|
+ if let token = dict1["maxDeviceNum"] { maxDeviceNum = token as? Int ?? maxDeviceNum}
|
|
|
|
+ if let token = dict1["levels"] { levels = token as? String ?? levels}
|
|
|
|
+ if let token = dict1["platforms"] { platforms = token as? String ?? platforms}
|
|
|
|
+ if let token = dict1["productLineId"] { productLineId = token as? Int ?? productLineId}
|
|
|
|
+ if let token = dict1["paymentModel"] { paymentModel = token as? Int ?? paymentModel}
|
|
|
|
+ if let token = dict1["cycle"] { cycle = token as? Int ?? cycle}
|
|
|
|
+ if let token = dict1["code"] { code = token as? String ?? code}
|
|
|
|
+ if let token = dict1["cnyPrice"] { cnyPrice = token as? NSNumber ?? cnyPrice}
|
|
|
|
+ let products = KMListingProductsModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, code: code, cnyPrice: cnyPrice)
|
|
|
|
+ results.append(products)
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- let result_Array: [NSDictionary] = [dic["result"]] as? [NSDictionary] ?? [[:]]
|
|
|
|
- let message: String = dic["msg"] as? String ?? ""
|
|
|
|
-
|
|
|
|
- var results: [KMListingProductsModel] = []
|
|
|
|
- for dict1 in result_Array {
|
|
|
|
- var id = ""
|
|
|
|
- var productName = ""
|
|
|
|
- var price = NSNumber(value: 0.0)
|
|
|
|
- var maxDeviceNum = 0
|
|
|
|
- var levels = ""
|
|
|
|
- var platforms = ""
|
|
|
|
- var productLineId = 0
|
|
|
|
- var paymentModel = 0
|
|
|
|
- var cycle = 0
|
|
|
|
- var code = ""
|
|
|
|
- var cnyPrice = NSNumber(value: 0.0)
|
|
|
|
- if let token = dict1["id"] { id = token as! String }
|
|
|
|
- if let token = dict1["productName"] { productName = token as! String }
|
|
|
|
- if let token = dict1["price"] { price = token as! NSNumber }
|
|
|
|
- if let token = dict1["maxDeviceNum"] { maxDeviceNum = token as! Int }
|
|
|
|
- if let token = dict1["levels"] { levels = token as! String }
|
|
|
|
- if let token = dict1["platforms"] { platforms = token as! String }
|
|
|
|
- if let token = dict1["productLineId"] { productLineId = token as! Int }
|
|
|
|
- if let token = dict1["paymentModel"] { paymentModel = token as! Int }
|
|
|
|
- if let token = dict1["cycle"] { cycle = token as! Int }
|
|
|
|
- if let token = dict1["code"] { code = token as! String }
|
|
|
|
- if let token = dict1["cnyPrice"] { cnyPrice = token as! NSNumber }
|
|
|
|
- let products = KMListingProductsModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, code: code, cnyPrice: cnyPrice)
|
|
|
|
- results.append(products)
|
|
|
|
- }
|
|
|
|
|
|
|
|
- let result = KMMemberProductResult(code: code, msg: message, listingProducts: results)
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, result)
|
|
|
|
- } else {
|
|
|
|
- complete(false, result)
|
|
|
|
|
|
+ let result = KMMemberProductResult(code: code, msg: message, listingProducts: results)
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, result)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, result)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ print("Invalid URL")
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -979,47 +1006,51 @@ class KMMemberCenterManager: NSObject {
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/web/getBatchProductPrice"
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/web/getBatchProductPrice"
|
|
let params: [String: Any] = ["productId": productId,
|
|
let params: [String: Any] = ["productId": productId,
|
|
"num": NSNumber(value: Int32(num))]
|
|
"num": NSNumber(value: Int32(num))]
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
-
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
- let message: String = dic["msg"] as? String ?? ""
|
|
|
|
-
|
|
|
|
- var productId = ""
|
|
|
|
- var totalPrice = ""
|
|
|
|
- var price = ""
|
|
|
|
- var batchPrice = ""
|
|
|
|
- var cnyPrice = ""
|
|
|
|
- var cnyBatchPrice = ""
|
|
|
|
- var cnyTotalPrice = ""
|
|
|
|
- if let token = result["productId"] { productId = token as! String }
|
|
|
|
- if let token = result["totalPrice"] { totalPrice = token as! String }
|
|
|
|
- if let token = result["price"] { price = token as! String }
|
|
|
|
- if let token = result["batchPrice"] { batchPrice = token as! String }
|
|
|
|
- if let token = result["cnyPrice"] { cnyPrice = token as! String }
|
|
|
|
- if let token = result["cnyBatchPrice"] { cnyBatchPrice = token as! String }
|
|
|
|
- if let token = result["cnyTotalPrice"] { cnyTotalPrice = token as! String }
|
|
|
|
- let products = KMBatchProductPriceModel(productId: productId, totalPrice: totalPrice, price: price, batchPrice: batchPrice, cnyPrice: cnyPrice, cnyBatchPrice: cnyBatchPrice, cnyTotalPrice: cnyTotalPrice)
|
|
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
+ let message: String = dic["msg"] as? String ?? ""
|
|
|
|
+
|
|
|
|
+ var productId = ""
|
|
|
|
+ var totalPrice = ""
|
|
|
|
+ var price = ""
|
|
|
|
+ var batchPrice = ""
|
|
|
|
+ var cnyPrice = ""
|
|
|
|
+ var cnyBatchPrice = ""
|
|
|
|
+ var cnyTotalPrice = ""
|
|
|
|
+ if let token = result["productId"] { productId = token as? String ?? productId}
|
|
|
|
+ if let token = result["totalPrice"] { totalPrice = token as? String ?? totalPrice}
|
|
|
|
+ if let token = result["price"] { price = token as? String ?? price}
|
|
|
|
+ if let token = result["batchPrice"] { batchPrice = token as? String ?? batchPrice}
|
|
|
|
+ if let token = result["cnyPrice"] { cnyPrice = token as? String ?? cnyPrice}
|
|
|
|
+ if let token = result["cnyBatchPrice"] { cnyBatchPrice = token as? String ?? cnyBatchPrice}
|
|
|
|
+ if let token = result["cnyTotalPrice"] { cnyTotalPrice = token as? String ?? cnyTotalPrice}
|
|
|
|
+ let products = KMBatchProductPriceModel(productId: productId, totalPrice: totalPrice, price: price, batchPrice: batchPrice, cnyPrice: cnyPrice, cnyBatchPrice: cnyBatchPrice, cnyTotalPrice: cnyTotalPrice)
|
|
|
|
|
|
- let result1 = KMMemberProductResult(code: code, msg: message, batchProductPrice: products)
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, result1)
|
|
|
|
- } else {
|
|
|
|
- complete(false, result1)
|
|
|
|
|
|
+ let result1 = KMMemberProductResult(code: code, msg: message, batchProductPrice: products)
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, result1)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, result1)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ print("Invalid URL")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1040,111 +1071,120 @@ class KMMemberCenterManager: NSObject {
|
|
let params: [String: Any] = ["productId": productId,
|
|
let params: [String: Any] = ["productId": productId,
|
|
"userId": userId,
|
|
"userId": userId,
|
|
"code": code]
|
|
"code": code]
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
- requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+ requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
- let message: String = dic["msg"] as? String ?? ""
|
|
|
|
-
|
|
|
|
- var id = ""
|
|
|
|
- var productName = ""
|
|
|
|
- var price = ""
|
|
|
|
- var maxDeviceNum = 0
|
|
|
|
- var displayPrice = ""
|
|
|
|
- var levels = ""
|
|
|
|
- var platforms = ""
|
|
|
|
- var productLineId = 0
|
|
|
|
- var paymentModel = 0
|
|
|
|
- var cycle = 0
|
|
|
|
- var cnyPrice = ""
|
|
|
|
- var displayCnyPrice = ""
|
|
|
|
- if let token = result["id"] { id = token as! String }
|
|
|
|
- if let token = result["productName"] { productName = token as! String }
|
|
|
|
- if let token = result["price"] { price = token as! String }
|
|
|
|
- if let token = result["maxDeviceNum"] { maxDeviceNum = token as! Int }
|
|
|
|
- if let token = result["displayPrice"] { displayPrice = token as! String }
|
|
|
|
- if let token = result["levels"] { levels = token as! String }
|
|
|
|
- if let token = result["platforms"] { platforms = token as! String }
|
|
|
|
- if let token = result["productLineId"] { productLineId = token as! Int }
|
|
|
|
- if let token = result["paymentModel"] { paymentModel = token as! Int }
|
|
|
|
- if let token = result["cycle"] { cycle = token as! Int }
|
|
|
|
- if let token = result["cnyPrice"] { cnyPrice = token as! String }
|
|
|
|
- if let token = result["displayCnyPrice"] { displayCnyPrice = token as! String }
|
|
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
+ let message: String = dic["msg"] as? String ?? ""
|
|
|
|
+
|
|
|
|
+ var id = ""
|
|
|
|
+ var productName = ""
|
|
|
|
+ var price = ""
|
|
|
|
+ var maxDeviceNum = 0
|
|
|
|
+ var displayPrice = ""
|
|
|
|
+ var levels = ""
|
|
|
|
+ var platforms = ""
|
|
|
|
+ var productLineId = 0
|
|
|
|
+ var paymentModel = 0
|
|
|
|
+ var cycle = 0
|
|
|
|
+ var cnyPrice = ""
|
|
|
|
+ var displayCnyPrice = ""
|
|
|
|
+ if let token = result["id"] { id = token as? String ?? id}
|
|
|
|
+ if let token = result["productName"] { productName = token as? String ?? productName}
|
|
|
|
+ if let token = result["price"] { price = token as? String ?? price}
|
|
|
|
+ if let token = result["maxDeviceNum"] { maxDeviceNum = token as? Int ?? maxDeviceNum}
|
|
|
|
+ if let token = result["displayPrice"] { displayPrice = token as? String ?? displayPrice}
|
|
|
|
+ if let token = result["levels"] { levels = token as? String ?? levels}
|
|
|
|
+ if let token = result["platforms"] { platforms = token as? String ?? platforms}
|
|
|
|
+ if let token = result["productLineId"] { productLineId = token as? Int ?? productLineId}
|
|
|
|
+ if let token = result["paymentModel"] { paymentModel = token as? Int ?? paymentModel}
|
|
|
|
+ if let token = result["cycle"] { cycle = token as? Int ?? cycle}
|
|
|
|
+ if let token = result["cnyPrice"] { cnyPrice = token as? String ?? cnyPrice}
|
|
|
|
+ if let token = result["displayCnyPrice"] { displayCnyPrice = token as? String ?? displayCnyPrice}
|
|
|
|
|
|
- let products = KMCheckCouponModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, displayPrice: displayPrice, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, cnyPrice: cnyPrice, displayCnyPrice: displayCnyPrice)
|
|
|
|
- let result1 = KMMemberProductResult(code: code, msg: message, checkCoupon: products)
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, result1)
|
|
|
|
- } else {
|
|
|
|
- complete(false, result1)
|
|
|
|
|
|
+ let products = KMCheckCouponModel(id: id, productName: productName, price: price, maxDeviceNum: maxDeviceNum, displayPrice: displayPrice, levels: levels, platforms: platforms, productLineId: productLineId, paymentModel: paymentModel, cycle: cycle, cnyPrice: cnyPrice, displayCnyPrice: displayCnyPrice)
|
|
|
|
+ let result1 = KMMemberProductResult(code: code, msg: message, checkCoupon: products)
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, result1)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, result1)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ print("Invalid URL")
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- @abstract 获取批量阶段购买价格
|
|
|
|
- @param productId 购买的产品id
|
|
|
|
- @param isEducation 是否教育优惠
|
|
|
|
|
|
+ @abstract 检查邮箱教育优惠资格
|
|
|
|
+ @param email 邮箱
|
|
@param complete 回调
|
|
@param complete 回调
|
|
*/
|
|
*/
|
|
func checkEducation(email: String, _ complete: @escaping KMMemberProductComplete) {
|
|
func checkEducation(email: String, _ complete: @escaping KMMemberProductComplete) {
|
|
|
|
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/web/checkEducation"
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/web/checkEducation"
|
|
let params: [String: Any] = ["email": email]
|
|
let params: [String: Any] = ["email": email]
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
-
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
- let message: String = dic["msg"] as? String ?? ""
|
|
|
|
-
|
|
|
|
- var productId = ""
|
|
|
|
- var totalPrice = ""
|
|
|
|
- var price = ""
|
|
|
|
- var batchPrice = ""
|
|
|
|
- var cnyPrice = ""
|
|
|
|
- var cnyBatchPrice = ""
|
|
|
|
- var cnyTotalPrice = ""
|
|
|
|
- if let token = result["productId"] { productId = token as! String }
|
|
|
|
- if let token = result["totalPrice"] { totalPrice = token as! String }
|
|
|
|
- if let token = result["price"] { price = token as! String }
|
|
|
|
- if let token = result["batchPrice"] { batchPrice = token as! String }
|
|
|
|
- if let token = result["cnyPrice"] { cnyPrice = token as! String }
|
|
|
|
- if let token = result["cnyBatchPrice"] { cnyBatchPrice = token as! String }
|
|
|
|
- if let token = result["cnyTotalPrice"] { cnyTotalPrice = token as! String }
|
|
|
|
- let products = KMBatchProductPriceModel(productId: productId, totalPrice: totalPrice, price: price, batchPrice: batchPrice, cnyPrice: cnyPrice, cnyBatchPrice: cnyBatchPrice, cnyTotalPrice: cnyTotalPrice)
|
|
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
+ let message: String = dic["msg"] as? String ?? ""
|
|
|
|
+
|
|
|
|
+ var productId = ""
|
|
|
|
+ var totalPrice = ""
|
|
|
|
+ var price = ""
|
|
|
|
+ var batchPrice = ""
|
|
|
|
+ var cnyPrice = ""
|
|
|
|
+ var cnyBatchPrice = ""
|
|
|
|
+ var cnyTotalPrice = ""
|
|
|
|
+ if let token = result["productId"] { productId = token as? String ?? productId}
|
|
|
|
+ if let token = result["totalPrice"] { totalPrice = token as? String ?? totalPrice}
|
|
|
|
+ if let token = result["price"] { price = token as? String ?? price}
|
|
|
|
+ if let token = result["batchPrice"] { batchPrice = token as? String ?? batchPrice}
|
|
|
|
+ if let token = result["cnyPrice"] { cnyPrice = token as? String ?? cnyPrice}
|
|
|
|
+ if let token = result["cnyBatchPrice"] { cnyBatchPrice = token as? String ?? cnyBatchPrice}
|
|
|
|
+ if let token = result["cnyTotalPrice"] { cnyTotalPrice = token as? String ?? cnyTotalPrice}
|
|
|
|
+ let products = KMBatchProductPriceModel(productId: productId, totalPrice: totalPrice, price: price, batchPrice: batchPrice, cnyPrice: cnyPrice, cnyBatchPrice: cnyBatchPrice, cnyTotalPrice: cnyTotalPrice)
|
|
|
|
|
|
- let result1 = KMMemberProductResult(code: code, msg: message, batchProductPrice: products)
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, result1)
|
|
|
|
- } else {
|
|
|
|
- complete(false, result1)
|
|
|
|
|
|
+ let result1 = KMMemberProductResult(code: code, msg: message, batchProductPrice: products)
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, result1)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, result1)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ print("Invalid URL")
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1164,27 +1204,33 @@ class KMMemberCenterManager: NSObject {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/getStateByOrderId"
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/getStateByOrderId"
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: nil) { requestSerializer in
|
|
|
|
- requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ let params: [String: Any] = ["orderId": orderId]
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+ requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
|
|
+ }
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, dic)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, dic)
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, dic)
|
|
|
|
- } else {
|
|
|
|
- complete(false, dic)
|
|
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ print("Invalid URL")
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1234,9 +1280,9 @@ class KMMemberCenterManager: NSObject {
|
|
var orderId = ""
|
|
var orderId = ""
|
|
var payHref = ""
|
|
var payHref = ""
|
|
if code == 200 {
|
|
if code == 200 {
|
|
- if let token = result["thirdOrderNo"] { thirdOrderNo = token as! String }
|
|
|
|
- if let token = result["orderId"] { orderId = token as! String }
|
|
|
|
- if let token = result["payHref"] { payHref = token as! String }
|
|
|
|
|
|
+ if let token = result["thirdOrderNo"] { thirdOrderNo = token as? String ?? thirdOrderNo}
|
|
|
|
+ if let token = result["orderId"] { orderId = token as? String ?? orderId}
|
|
|
|
+ if let token = result["payHref"] { payHref = token as? String ?? payHref}
|
|
let products = KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref)
|
|
let products = KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref)
|
|
let result1 = KMMemberProductResult(code: code, msg: message, createOrder: products)
|
|
let result1 = KMMemberProductResult(code: code, msg: message, createOrder: products)
|
|
complete(true, result1)
|
|
complete(true, result1)
|
|
@@ -1263,7 +1309,7 @@ class KMMemberCenterManager: NSObject {
|
|
complete(false, nil)
|
|
complete(false, nil)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/createOrder"
|
|
|
|
|
|
+ let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/createSubscription"
|
|
let params: [String: Any] = ["productId": productId,
|
|
let params: [String: Any] = ["productId": productId,
|
|
"paymentMethod": paymentMethod,
|
|
"paymentMethod": paymentMethod,
|
|
"price": price,
|
|
"price": price,
|
|
@@ -1293,9 +1339,9 @@ class KMMemberCenterManager: NSObject {
|
|
var orderId = ""
|
|
var orderId = ""
|
|
var payHref = ""
|
|
var payHref = ""
|
|
if code == 200 {
|
|
if code == 200 {
|
|
- if let token = result["thirdOrderNo"] { thirdOrderNo = token as! String }
|
|
|
|
- if let token = result["orderId"] { orderId = token as! String }
|
|
|
|
- if let token = result["payHref"] { payHref = token as! String }
|
|
|
|
|
|
+ if let token = result["thirdOrderNo"] { thirdOrderNo = token as? String ?? thirdOrderNo}
|
|
|
|
+ if let token = result["orderId"] { orderId = token as? String ?? orderId}
|
|
|
|
+ if let token = result["payHref"] { payHref = token as? String ?? payHref}
|
|
let products = KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref)
|
|
let products = KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref)
|
|
let result1 = KMMemberProductResult(code: code, msg: message, createOrder: products)
|
|
let result1 = KMMemberProductResult(code: code, msg: message, createOrder: products)
|
|
complete(true, result1)
|
|
complete(true, result1)
|
|
@@ -1311,7 +1357,7 @@ class KMMemberCenterManager: NSObject {
|
|
@param orderStatus 0全部1待支付
|
|
@param orderStatus 0全部1待支付
|
|
@param complete 回调
|
|
@param complete 回调
|
|
*/
|
|
*/
|
|
- func getOrderListByStatus(orderStatus: Int, _ complete: @escaping KMMemberProductComplete) {
|
|
|
|
|
|
+ func getOrderListByStatus(orderStatus: Int, _ complete: @escaping KMMemberRequestInfoComplete) {
|
|
let token: String = KMMemberInfo.shared.access_token
|
|
let token: String = KMMemberInfo.shared.access_token
|
|
if token == "" {
|
|
if token == "" {
|
|
complete(false, nil)
|
|
complete(false, nil)
|
|
@@ -1319,39 +1365,45 @@ class KMMemberCenterManager: NSObject {
|
|
}
|
|
}
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/getOrderListByStatus"
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/getOrderListByStatus"
|
|
let params: [String: Any] = ["orderStatus": orderStatus]
|
|
let params: [String: Any] = ["orderStatus": orderStatus]
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
- requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .get, params: nil) { requestSerializer in
|
|
|
|
+ requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, dic)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, dic)
|
|
|
|
+ }
|
|
|
|
+ // var thirdOrderNo = ""
|
|
|
|
+ // var orderId = ""
|
|
|
|
+ // var payHref = ""
|
|
|
|
+ // if code == 200 {
|
|
|
|
+ // if let token = result["thirdOrderNo"] { thirdOrderNo = token as! String }
|
|
|
|
+ // if let token = result["orderId"] { orderId = token as! String }
|
|
|
|
+ // if let token = result["payHref"] { payHref = token as! String }
|
|
|
|
+ // let products = KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref)
|
|
|
|
+ // let result1 = KMMemberProductResult(code: code, msg: message, createOrder: products)
|
|
|
|
+ // complete(true, result1)
|
|
|
|
+ // } else {
|
|
|
|
+ // let result1 = KMMemberProductResult(code: code, msg: message, createOrder: KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref))
|
|
|
|
+ // complete(false, result1)
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
- let result: NSDictionary = dic["result"] as? NSDictionary ?? [:]
|
|
|
|
- let message: String = dic["msg"] as? String ?? ""
|
|
|
|
-
|
|
|
|
-// var thirdOrderNo = ""
|
|
|
|
-// var orderId = ""
|
|
|
|
-// var payHref = ""
|
|
|
|
-// if code == 200 {
|
|
|
|
-// if let token = result["thirdOrderNo"] { thirdOrderNo = token as! String }
|
|
|
|
-// if let token = result["orderId"] { orderId = token as! String }
|
|
|
|
-// if let token = result["payHref"] { payHref = token as! String }
|
|
|
|
-// let products = KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref)
|
|
|
|
-// let result1 = KMMemberProductResult(code: code, msg: message, createOrder: products)
|
|
|
|
-// complete(true, result1)
|
|
|
|
-// } else {
|
|
|
|
-// let result1 = KMMemberProductResult(code: code, msg: message, createOrder: KMCreateOrderModel(thirdOrderNo: thirdOrderNo, orderId: orderId, payHref: payHref))
|
|
|
|
-// complete(false, result1)
|
|
|
|
-// }
|
|
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1367,28 +1419,33 @@ class KMMemberCenterManager: NSObject {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/closeOrder"
|
|
let urlString = configuration.activityBaseURL() + "/pdf-office-website/order/closeOrder"
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .post, params: nil) { requestSerializer in
|
|
|
|
- requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
- } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
- var dic: NSDictionary = [:]
|
|
|
|
- if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
- dic = responseObject
|
|
|
|
- } else {
|
|
|
|
- var info = responseObject
|
|
|
|
- if let error = error {
|
|
|
|
- if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
- info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
|
|
+ let params: [String: Any] = ["orderId": orderId]
|
|
|
|
+ if let urlNewString = constructURLString(baseURLString: urlString, parameters: params) {
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlNewString, method: .post, params: nil) { requestSerializer in
|
|
|
|
+ requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
|
|
+ } completion: { [weak self] (task, responseObject, error) in
|
|
|
|
+ var dic: NSDictionary = [:]
|
|
|
|
+ if error == nil, let responseObject = responseObject as? NSDictionary {
|
|
|
|
+ dic = responseObject
|
|
|
|
+ } else {
|
|
|
|
+ var info = responseObject
|
|
|
|
+ if let error = error {
|
|
|
|
+ if let data = error.userInfo["com.alamofire.serialization.response.error.data"] as? Data {
|
|
|
|
+ info = try? JSONSerialization.jsonObject(with: data, options: .mutableLeaves) as? NSDictionary
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ dic = (info as? NSDictionary) ?? [:]
|
|
}
|
|
}
|
|
- dic = (info as? NSDictionary) ?? [:]
|
|
|
|
- }
|
|
|
|
- let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
|
|
+ let code: Int = dic["code"] as? Int ?? 0
|
|
|
|
|
|
- if code == 200 {
|
|
|
|
- complete(true, dic)
|
|
|
|
- } else {
|
|
|
|
- complete(false, dic)
|
|
|
|
|
|
+ if code == 200 {
|
|
|
|
+ complete(true, dic)
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, dic)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ complete(false, nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1396,21 +1453,23 @@ class KMMemberCenterManager: NSObject {
|
|
|
|
|
|
/**
|
|
/**
|
|
@abstract APPstore 权益校验
|
|
@abstract APPstore 权益校验
|
|
- @param orderStatus 0全部1待支付
|
|
|
|
|
|
+ @param applePayProductId
|
|
|
|
+ @param transactionId
|
|
|
|
+ @param productCode
|
|
@param complete 回调
|
|
@param complete 回调
|
|
*/
|
|
*/
|
|
- func appStoreEquityVerification(orderStatus: Int, _ complete: @escaping KMMemberProductComplete) {
|
|
|
|
|
|
+ func appStoreEquityVerification(applePayProductId: String, transactionId: String, productCode: String, _ complete: @escaping KMMemberProductComplete) {
|
|
let token: String = KMMemberInfo.shared.access_token
|
|
let token: String = KMMemberInfo.shared.access_token
|
|
if token == "" {
|
|
if token == "" {
|
|
complete(false, nil)
|
|
complete(false, nil)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let urlString = configuration.activityBaseURL() + "/member-system-website/applePay/appStoreEquityVerification"
|
|
let urlString = configuration.activityBaseURL() + "/member-system-website/applePay/appStoreEquityVerification"
|
|
- let params: [String: Any] = ["userId": "",
|
|
|
|
- "applePayProductId": "",
|
|
|
|
- "transactionId": "",
|
|
|
|
- "productCode": ""]
|
|
|
|
- KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
|
|
|
|
|
|
+ let params: [String: Any] = ["userId": KMMemberInfo.shared.userID,
|
|
|
|
+ "applePayProductId": applePayProductId,
|
|
|
|
+ "transactionId": transactionId,
|
|
|
|
+ "productCode": productCode]
|
|
|
|
+ KMRequestServer.requestServer.request(urlString: urlString, method: .post, params: params) { requestSerializer in
|
|
requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
requestSerializer.setValue("Bearer " + token, forHTTPHeaderField: "Authorization")
|
|
} completion: { [weak self] (task, responseObject, error) in
|
|
} completion: { [weak self] (task, responseObject, error) in
|
|
var dic: NSDictionary = [:]
|
|
var dic: NSDictionary = [:]
|