Bläddra i källkod

【会员系统】DMG 订单相关API数据结构修改

zenghong 1 vecka sedan
förälder
incheckning
22732ca580

+ 4 - 4
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -928,7 +928,7 @@ class KMMemberCenterManager: NSObject {
                 dic = (info as? NSDictionary) ?? [:]
             }
             let code: Int = dic["code"] as? Int ?? 0
-            let result_Array: [NSDictionary] = dic["result"] as? [NSDictionary] ?? [[:]]
+            let result_Array: [NSDictionary] = [dic["result"]] as? [NSDictionary] ?? [[:]]
             let message: String = dic["msg"] as? String ?? ""
             
             var results: [KMListingProductsModel] = []
@@ -978,7 +978,7 @@ class KMMemberCenterManager: NSObject {
         
         let urlString = configuration.activityBaseURL() + "/pdf-office-website/web/getBatchProductPrice"
         let params: [String: Any] = ["productId": productId,
-                                     "num": num]
+                                     "num": NSNumber(value: Int32(num))]
         KMRequestServer.requestServer.request(urlString: urlString, method: .get, params: params) { requestSerializer in
             
         } completion: { [weak self] (task, responseObject, error) in
@@ -1198,7 +1198,7 @@ class KMMemberCenterManager: NSObject {
      @param num                      批量购买数量
      @param complete 回调
      */
-    func createOrder(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
+    func createOrder(productId: String, paymentMethod: Int, price: NSNumber, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
         let token: String = KMMemberInfo.shared.access_token
         if token == "" {
             complete(false, nil)
@@ -1257,7 +1257,7 @@ class KMMemberCenterManager: NSObject {
      @param num                      批量购买数量
      @param complete 回调
      */
-    func createSubscriber(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
+    func createSubscriber(productId: String, paymentMethod: Int, price: NSNumber, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
         let token: String = KMMemberInfo.shared.access_token
         if token == "" {
             complete(false, nil)

+ 20 - 5
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -118,9 +118,24 @@ class KMProductModel: ObservableObject {
         }
         
         if KMMemberInfo.shared.isLogin {
-            getDMGProductPriceInfosForMember(productId: "SP2024102100002", isEducation: 0) { [weak self] success, result in
-                
-            }
+//            getDMGProductPriceInfosForMember(productId: "SP2024102100002", isEducation: 0) { [weak self] success, result in
+//                
+//                
+//            }
+            
+//            getDMGBatchProductPriceInfosForMember(productId: "SP2024102100002", num: 10) { [weak self] success, result in
+//                
+//                
+//            }
+            
+//            creatOrder(productId: "SP2024102300003", paymentMethod: 0, price: NSNumber(value: 119.99), discountFlag: 0, couponCode: "", num: 1) { [weak self] success, result in
+//
+//            }
+            
+//            createSubscriber(productId: "SP2024102300003", paymentMethod: 0, price: NSNumber(value: 119.99), discountFlag: 0, couponCode: "", num: 1) { [weak self] success, result in
+//
+//            }
+            
         }
         
     }
@@ -222,7 +237,7 @@ class KMProductModel: ObservableObject {
      @param num                      批量购买数量
      @param complete 回调
      */
-    func creatOrder(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
+    func creatOrder(productId: String, paymentMethod: Int, price: NSNumber, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
         checkConnectionAvailable()
         KMMemberCenterManager.manager.createOrder(productId: productId, paymentMethod: paymentMethod, price: price, discountFlag: discountFlag, couponCode: couponCode, num: num) { [weak self] success, result in
             if success {
@@ -248,7 +263,7 @@ class KMProductModel: ObservableObject {
      @param num                      批量购买数量
      @param complete 回调
      */
-    func createSubscriber(productId: String, paymentMethod: Int, price: String, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
+    func createSubscriber(productId: String, paymentMethod: Int, price: NSNumber, discountFlag: Int, couponCode: String, num: Int, _ complete: @escaping KMMemberProductComplete) {
         checkConnectionAvailable()
         KMMemberCenterManager.manager.createSubscriber(productId: productId, paymentMethod: paymentMethod, price: price, discountFlag: discountFlag, couponCode: couponCode, num: num) { [weak self] success, result in
             if success {