From 19e3fd5eecfa5fdf1b16b60e3462a5a61de1136e Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期二, 26 十一月 2024 18:47:27 +0800
Subject: [PATCH] fix BUG

---
 XQMuse/Root/PayMusicView/PayMusicVC.swift                               |   10 
 /dev/null                                                               |    0 
 XQMuse/Root/Me/VC/InviteVC.swift                                        |    7 
 XQMuse/Root/Me/VC/VIPCenterVC.swift                                     |   24 +-
 XQMuse/Root/Me/VC/WalletRechargeVC.swift                                |    9 
 XQMuse/Root/Network/Models.swift                                        |    6 
 XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/Contents.json |    4 
 XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/新手冥想指南 1.jpg  |    0 
 XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/新手冥想指南.jpg    |    0 
 XQMuse/SceneDelegate.swift                                              |    4 
 XQMuse/Root/Home/VC/PaymentOrderVC.swift                                |  334 +++++++++++++++++++++++++++++++----------------
 XQMuse/Root/Network/Services.swift                                      |    2 
 12 files changed, 256 insertions(+), 144 deletions(-)

diff --git a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/Contents.json b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/Contents.json
index 2ba0785..4f1ef28 100644
--- a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/Contents.json
+++ b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/Contents.json
@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "组 20@2x.png",
+      "filename" : "新手冥想指南.jpg",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "组 20@3x.png",
+      "filename" : "新手冥想指南 1.jpg",
       "idiom" : "universal",
       "scale" : "3x"
     }
diff --git "a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\346\226\260\346\211\213\345\206\245\346\203\263\346\214\207\345\215\227 1.jpg" "b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\346\226\260\346\211\213\345\206\245\346\203\263\346\214\207\345\215\227 1.jpg"
new file mode 100644
index 0000000..3528026
--- /dev/null
+++ "b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\346\226\260\346\211\213\345\206\245\346\203\263\346\214\207\345\215\227 1.jpg"
Binary files differ
diff --git "a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\346\226\260\346\211\213\345\206\245\346\203\263\346\214\207\345\215\227.jpg" "b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\346\226\260\346\211\213\345\206\245\346\203\263\346\214\207\345\215\227.jpg"
new file mode 100644
index 0000000..3528026
--- /dev/null
+++ "b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\346\226\260\346\211\213\345\206\245\346\203\263\346\214\207\345\215\227.jpg"
Binary files differ
diff --git "a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\347\273\204 20@2x.png" "b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\347\273\204 20@2x.png"
deleted file mode 100644
index 409ea6a..0000000
--- "a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\347\273\204 20@2x.png"
+++ /dev/null
Binary files differ
diff --git "a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\347\273\204 20@3x.png" "b/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\347\273\204 20@3x.png"
deleted file mode 100644
index f19db9d..0000000
--- "a/XQMuse/Assets.xcassets/Placeholder/bg_guide_home.imageset/\347\273\204 20@3x.png"
+++ /dev/null
Binary files differ
diff --git a/XQMuse/Root/Home/VC/PaymentOrderVC.swift b/XQMuse/Root/Home/VC/PaymentOrderVC.swift
index d838b04..5d45939 100644
--- a/XQMuse/Root/Home/VC/PaymentOrderVC.swift
+++ b/XQMuse/Root/Home/VC/PaymentOrderVC.swift
@@ -16,6 +16,9 @@
     case t1
     case t2 //z__f__b
     case t3 //w__x
+    case t1t2//组合
+    case t1t3//组合
+    case none
 }
 
 class PaymentOrderVC: BaseVC {
@@ -59,10 +62,41 @@
     @IBOutlet weak var img_action_2: UIImageView!
     @IBOutlet weak var img_action_3: UIImageView!
 
-    private var tapType:TapType?
+    private var price:Double = 0
+
+    private var tapType:TapType = .none{
+        didSet{
+            switch tapType {
+                case .t1:
+                    img_action_1.image = UIImage(named: "icon_choose_small_s")
+                    img_action_2.image = UIImage(named: "icon_choose_small_1")
+                    img_action_3.image = UIImage(named: "icon_choose_small_1")
+                case .t2:
+                    img_action_1.image = UIImage(named: "icon_choose_small_1")
+                    img_action_2.image = UIImage(named: "icon_choose_small_s")
+                    img_action_3.image = UIImage(named: "icon_choose_small_1")
+                case .t3:
+                    img_action_1.image = UIImage(named: "icon_choose_small_1")
+                    img_action_2.image = UIImage(named: "icon_choose_small_1")
+                    img_action_3.image = UIImage(named: "icon_choose_small_s")
+                case .t1t2:
+                    img_action_1.image = UIImage(named: "icon_choose_small_s")
+                    img_action_2.image = UIImage(named: "icon_choose_small_s")
+                    img_action_3.image = UIImage(named: "icon_choose_small_1")
+                case .t1t3:
+                    img_action_1.image = UIImage(named: "icon_choose_small_s")
+                    img_action_2.image = UIImage(named: "icon_choose_small_1")
+                    img_action_3.image = UIImage(named: "icon_choose_small_s")
+                case .none:
+                    img_action_1.image = UIImage(named: "icon_choose_small_1")
+                    img_action_2.image = UIImage(named: "icon_choose_small_1")
+                    img_action_3.image = UIImage(named: "icon_choose_small_1")
+            }
+        }
+    }
 
     private var isShowMore:Bool = false
-    private var discountByCoin:Bool = false
+//    private var discountByCoin:Bool = true
 
     private var museItemModel:MeditationModel?
     private var courseItemModel:CourseModel?
@@ -99,8 +133,6 @@
         view_searchUserInput.isHidden = !giftToOther
         img_action_1.image = UIImage(named: "icon_choose_small_s")
 
-        getBalance()
-
         let btn = UIButton(type: .custom)
         btn.setTitle("取消订单", for: .normal)
         btn.setTitleColor(UIColor(hexString: "#353535"), for: .normal)
@@ -115,6 +147,7 @@
             Services.getCourseDetail(courseId: courseItemModel!.id).subscribe(onNext: {data in
                 if let m = data.data{
                     self.courseModel = m
+                    self.price = m.iosPrice
                     self.image_cover.sd_setImage(with: URL(string: m.coverUrl.components(separatedBy: ",").first?.jq_urlEncoded()))
                     self.label_courseName.text = m.courseTitle
 
@@ -130,6 +163,7 @@
                         self.label_orderPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
                         self.label_totalPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
                     }
+                    self.getBalance()
                 }
             }).disposed(by: disposeBag)
         }
@@ -139,23 +173,26 @@
                 self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn)
             }
 
-            Services.getMeditationDetail(id: museItemModel!.id).subscribe(onNext: {data in
+            Services.getMeditationDetail(id: museItemModel!.id).subscribe(onNext: {[weak self] data in
+                guard let weakSelf = self else { return }
                 if let m = data.data{
-                    self.museModel = m
-                    self.image_cover.sd_setImage(with: URL(string: m.coverUrl.components(separatedBy: ",").first?.jq_urlEncoded()))
-                    self.label_courseName.text = m.meditationTitle
-                    self.label_teacher.text = ""
-                    self.label_paymentCount.text = "x1"
+                    weakSelf.museModel = m
+                    weakSelf.price = m.iosPrice
+                    weakSelf.image_cover.sd_setImage(with: URL(string: m.coverUrl.components(separatedBy: ",").first?.jq_urlEncoded()))
+                    weakSelf.label_courseName.text = m.meditationTitle
+                    weakSelf.label_teacher.text = ""
+                    weakSelf.label_paymentCount.text = "x1"
 
-                    if self.isShowMore{
-                        self.label_price.text = "¥\(m.iosPrice.jq_formatFloat)"
-                        self.label_orderPrice.text = "¥\(m.iosPrice.jq_formatFloat)"
-                        self.label_totalPrice.text = "¥\(m.iosPrice.jq_formatFloat)"
+                    if weakSelf.isShowMore{
+                        weakSelf.label_price.text = "¥\(m.iosPrice.jq_formatFloat)"
+                        weakSelf.label_orderPrice.text = "¥\(m.iosPrice.jq_formatFloat)"
+                        weakSelf.label_totalPrice.text = "¥\(m.iosPrice.jq_formatFloat)"
                     }else{
-                        self.label_price.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
-                        self.label_orderPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
-                        self.label_totalPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
+                        weakSelf.label_price.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
+                        weakSelf.label_orderPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
+                        weakSelf.label_totalPrice.text = "愈疗币\(m.iosPrice.jq_formatFloat)"
                     }
+                    weakSelf.getBalance()
                 }
             }).disposed(by: disposeBag)
         }
@@ -193,45 +230,55 @@
     }
 
     override func setRx() {
-        NotificationCenter.default.rx.notification(Refreh_PaymentWallet_Noti).take(until: self.rx.deallocated).subscribe(onNext: {_ in
-            self.getBalance()
+        NotificationCenter.default.rx.notification(Refreh_PaymentWallet_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] _ in
+            self?.getBalance()
         }).disposed(by: disposeBag)
 
 
         NotificationCenter.default.rx.notification(UIApplication.didBecomeActiveNotification).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] _ in
             guard let weakSelf = self else { return }
-            if weakSelf.isShowMore && weakSelf.orderId != nil{
-                Services.queryPayment(orderId: weakSelf.orderId!).subscribe(onNext: {data in
-                    if let str = data.data{
-                        switch str{
-                            case "succeeded":
-                                alertSuccess(msg: "购买成功")
-                                var id = 0
-                                var money:Double = 0
-                                switch weakSelf.type {
-                                    case .muse:
-                                        id = weakSelf.museModel!.id
-                                        money = weakSelf.museModel!.iosPrice
-                                    case .course:
-                                        id = weakSelf.courseModel!.id
-                                        money = weakSelf.courseModel!.iosPrice
-                                    default:break
-                                }
 
-                                let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money)
-                                weakSelf.push(vc: vc)
-                            case "failed":
-                                alertError(msg: "购买失败")
-                            case "closed":
-                                alertError(msg: "交易已关闭")
-                            case "refunded":
-                                alertError(msg: "全额退款")
-                            case "pending":
-                                alertError(msg: "待支付")
-                            default:break
+            showHUD("正在查询支付结果...")
+            DispatchQueue.main.asyncAfter(delay: 2.5) {
+                if weakSelf.isShowMore && weakSelf.orderId != nil{
+                    Services.queryPayment(orderId: weakSelf.orderId!).subscribe(onNext: {data in
+                        if let str = data.data{
+                            switch str{
+                                case "succeeded":
+                                    hiddenHUD()
+                                    alertSuccess(msg: "购买成功")
+                                    var id = 0
+                                    var money:Double = 0
+                                    switch weakSelf.type {
+                                        case .muse:
+                                            id = weakSelf.museModel!.id
+                                            money = weakSelf.museModel!.iosPrice
+                                        case .course:
+                                            id = weakSelf.courseModel!.id
+                                            money = weakSelf.courseModel!.iosPrice
+                                        default:break
+                                    }
+
+                                    let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money)
+                                    weakSelf.push(vc: vc)
+                                case "failed":
+                                    hiddenHUD()
+                                    alertError(msg: "购买失败")
+                                case "closed":
+                                    hiddenHUD()
+                                    alertError(msg: "交易已关闭")
+                                case "refunded":
+                                    hiddenHUD()
+                                    alertError(msg: "全额退款")
+                                case "pending":
+                                    showHUD("正在支付...")
+                                default:break
+                            }
                         }
-                    }
-                }).disposed(by: weakSelf.disposeBag)
+                    }).disposed(by: weakSelf.disposeBag)
+                }else{
+                    hiddenHUD()
+                }
             }
         }).disposed(by: disposeBag)
 
@@ -257,61 +304,100 @@
         }
     }
 
-    private func getBalance(){
-        Services.getUserBalance().subscribe(onNext: {data in
-            self.balance = data.data ?? 0
-            if self.isShowMore{
-                self.label_walletBalance.text = String(format: "当前可用 ¥%@", data.data?.jq_formatFloat ?? "0")
-            }else{
-                self.label_walletBalance.text = String(format: "当前可用 %@疗愈币", data.data?.jq_formatFloat ?? "0")
+    private func getBalance() {
+        Services.getUserBalance().subscribe(onNext: { [weak self] data in
+            guard let weakSelf = self else { return }
+            
+            // 解包数据并更新余额
+            if let balanceData = data.data {
+                weakSelf.balance = balanceData
+                let formattedBalance = balanceData.jq_formatFloat
+                
+                // 更新 UI
+                if weakSelf.isShowMore {
+                    weakSelf.img_action_1.image = balanceData > 0 ? UIImage(named: "icon_choose_small_s") : UIImage(named: "icon_choose_small_1")
+                    weakSelf.label_walletBalance.text = "当前可用 ¥\(formattedBalance)"
+                    
+                    if balanceData > weakSelf.price {
+                        weakSelf.tapType = .t1
+                    }
+                } else {
+                    weakSelf.label_walletBalance.text = "当前可用 \(formattedBalance)疗愈币"
+                    weakSelf.tapType = .t1
+                }
+            } else {
+                weakSelf.balance = 0
+                weakSelf.label_walletBalance.text = "当前可用 0疗愈币"
+                weakSelf.tapType = .t1
             }
         }).disposed(by: disposeBag)
     }
 
 
     @IBAction func discountByCoinAction(_ sender: TapBtn) {
-        discountByCoin.toggle()
-        if discountByCoin{
-            img_action_1.image = UIImage(named: "icon_choose_small_s")
+
+        guard balance > 0 else {return}
+        //是否能全部抵扣
+        let allDiscount = balance > price
+
+        if allDiscount{
+            tapType = .t1
         }else{
-            img_action_1.image = UIImage(named: "icon_choose_small_1")
+            switch tapType {
+                case .t2:self.tapType = .t1t2
+                case .t3:self.tapType = .t1t3
+                case .t1t2:
+                    self.tapType = .t2
+                case .t1t3:
+                    self.tapType = .t3
+                default:break
+            }
         }
 
+        print(tapType)
 
+//        label_totalPrice.text = "¥" + price.jq_formatFloat
+    }
+
+    @IBAction func chooseAction(_ sender: TapBtn) {
         var price:Double = 0
-
         switch type {
             case .course:
-                if discountByCoin{
-                    price = max((courseModel?.iosPrice ?? 0) - balance,0)
-                }else{
-                    price = courseModel?.iosPrice ?? 0
-                }
+                price = courseModel?.iosPrice ?? 0
             case .muse:
-                if discountByCoin{
-                    price = max((museModel?.iosPrice ?? 0) - balance,0)
-                }else{
-                    price = museModel?.iosPrice ?? 0
-                }
+                price = courseModel?.iosPrice ?? 0
             default:break
         }
 
 
-        label_totalPrice.text = "¥" + price.jq_formatFloat
-    }
+        //是否能全部抵扣
+        let allDiscount = balance > price
 
-    @IBAction func chooseAction(_ sender: TapBtn) {
         switch sender.tag {
             case 2001:
-                tapType = .t2
-                img_action_2.image = UIImage(named: "icon_choose_small_s")
-                img_action_3.image = UIImage(named: "icon_choose_small_1")
+                if allDiscount {
+                    tapType = .t2
+                }else{
+                    if img_action_1.image == UIImage(named: "icon_choose_small_s"){
+                        tapType = .t1t2
+                    }else{
+                        tapType = .t2
+                    }
+                }
             case 2002:
-                tapType = .t3
-                img_action_2.image = UIImage(named: "icon_choose_small_1")
-                img_action_3.image = UIImage(named: "icon_choose_small_s")
+                if allDiscount{
+                    tapType = .t3
+                }else{
+                    if img_action_1.image == UIImage(named: "icon_choose_small_s"){
+                        tapType = .t1t3
+                    }else{
+                        tapType = .t3
+                    }
+
+                }
             default: break
         }
+        print(tapType)
     }
 
     @IBAction func invateRegisterAction(_ sender: UIButton) {
@@ -377,17 +463,12 @@
 
     @IBAction func completeAction(_ sender: UIButton) {
 
-
-        var money:Double = 0
         var id:Int = 0
-
         if let m = courseModel{
-            money = m.iosPrice
             id = m.id
         }
 
         if let m = museModel{
-            money = m.iosPrice
             id = m.id
 
             guard id != UserViewModel.getAvatarInfo().id else {
@@ -410,33 +491,46 @@
         }
 
         if isShowMore{
-            guard tapType != nil else {alertError(msg: "请选择支付方式");return}
-
-            var price:Double = 0
+            guard tapType != .none else {alertError(msg: "请选择支付方式");return}
             var targetId:Int = 0
             switch type {
                 case .course:
-                    price = courseModel!.iosPrice
                     targetId = courseModel!.id
                 case .muse:
-                    price = museModel!.iosPrice
                     targetId = museModel!.id
                 default:break
             }
 
-            if discountByCoin && balance < price{
+            if balance < price && tapType == .t1{
                 alertError(msg: "抵扣余额不足");return
             }
 
-            Services.placeOrder(orderForm: type, payType: tapType == .t2 ? 2:1, amount: nil, balanceFlag: discountByCoin ? 1:2, orderId: nil, receiverId: giftUserId, targetId: targetId, vipType: nil).subscribe(onNext: { [self] data in
-                if let m = data.data{
-                    self.orderId = m.orderId
+            //进行抵扣
+            var discountByCoin = 2
+            if tapType == .t1 || tapType == .t1t2 || tapType == .t1t3{
+                discountByCoin = 1
+            }
 
-                    if self.tapType == .t2{
+            var payType = 1
+            if tapType == .t1t2 || tapType == .t2{
+                payType = 2
+            }
+
+            if tapType == .t1{
+                paymentByCoin(id: id);return
+            }
+
+            Services.placeOrder(orderForm: type, payType: payType, amount: nil, balanceFlag: discountByCoin, orderId: nil, receiverId: giftUserId, targetId: targetId, vipType: nil).subscribe(onNext: { [weak self] data in
+                guard let weakSelf = self else { return }
+                if let m = data.data{
+                    weakSelf.orderId = m.orderId
+
+                    if weakSelf.tapType == .t2 || weakSelf.tapType == .t1t2{
+                        guard  m.qrcodeUrl?.isEmpty == false else{alertError(msg: "QRCode 为空");return}
                         UIApplication.shared.open(URL(string: m.qrcodeUrl!)!)
                     }
 
-                    if self.tapType == .t3{
+                    if weakSelf.tapType == .t3 || weakSelf.tapType == .t1t3{
                         let miniProgram =  WXLaunchMiniProgramReq.object()
                         miniProgram.miniProgramType = .release
                         miniProgram.userName = m.orgId!
@@ -451,38 +545,44 @@
             }).disposed(by: disposeBag)
 
         }else{
-            guard balance > money else{
-                CommonAlertView.show(title: "提示", content: "当前余额不足,请先充值", cancelStr: "暂不充值", completeStr: "去充值", isSingle: false) {[weak self] state in
-                    if state{
-                        let vc = WalletRechargeVC()
-                        self?.push(vc: vc)
-                    }
-                }
-                return
-            }
+            paymentByCoin(id: id)
+        }
+    }
 
-            if businessId != nil{
-                Services.gvieCourseAgain(orderForm: type, id: businessId!).subscribe(onNext: {[weak self]data in
-                    guard let weakSelf = self else { return }
-                    self?.museItemModel?.isBuy = .yes
-                    self?.courseItemModel?.isBuy = .yes
-                    self?.museModel?.isBuy = .yes
-                    self?.courseModel?.isBuy = .yes
-                    let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money)
+    private func paymentByCoin(id:Int){
+
+
+        guard balance > price else{
+            CommonAlertView.show(title: "提示", content: "当前余额不足,请先充值", cancelStr: "暂不充值", completeStr: "去充值", isSingle: false) {[weak self] state in
+                if state{
+                    let vc = WalletRechargeVC()
                     self?.push(vc: vc)
-                }).disposed(by: disposeBag)
-                return
+                }
             }
+            return
+        }
 
-            Services.gvieCourse(orderForm: type, targetId: id,receiverId: giftUserId).subscribe(onNext: {[weak self]data in
+        if businessId != nil{
+            Services.gvieCourseAgain(orderForm: type, id: businessId!).subscribe(onNext: {[weak self]data in
                 guard let weakSelf = self else { return }
                 self?.museItemModel?.isBuy = .yes
                 self?.courseItemModel?.isBuy = .yes
                 self?.museModel?.isBuy = .yes
                 self?.courseModel?.isBuy = .yes
-                let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: money)
+                let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: weakSelf.price)
                 self?.push(vc: vc)
             }).disposed(by: disposeBag)
+            return
         }
+
+        Services.gvieCourse(orderForm: type, targetId: id,receiverId: giftUserId).subscribe(onNext: {[weak self]data in
+            guard let weakSelf = self else { return }
+            self?.museItemModel?.isBuy = .yes
+            self?.courseItemModel?.isBuy = .yes
+            self?.museModel?.isBuy = .yes
+            self?.courseModel?.isBuy = .yes
+            let vc = PaymentOrderResultVC(type: weakSelf.type, id: id, price: weakSelf.price)
+            self?.push(vc: vc)
+        }).disposed(by: disposeBag)
     }
 }
diff --git a/XQMuse/Root/Me/VC/InviteVC.swift b/XQMuse/Root/Me/VC/InviteVC.swift
index 16453a2..6dd84cf 100644
--- a/XQMuse/Root/Me/VC/InviteVC.swift
+++ b/XQMuse/Root/Me/VC/InviteVC.swift
@@ -41,7 +41,12 @@
         btn_share.jq_cornerRadius = 21.25
 
 
-        view_role.jq_gradientColor(colorArr: [UIColor(hexString: "#eafbeb")!.cgColor,UIColor.white.cgColor], cornerRadius: 20, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: nil, locations: nil)
+//        view_role.jq_gradientColor(colorArr: [UIColor(hexString: "#eafbeb")!.cgColor,UIColor.white.cgColor], cornerRadius: 20, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: nil, locations: nil)
+    }
+
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+        view_role.jq_gradientColor(colorArr: [UIColor(hexString: "#eafbeb")!.cgColor,UIColor.white.cgColor], cornerRadius: 20, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: nil, locations: nil,clear: true)
     }
 
     @IBAction func shareAction(_ sender: UIButton) {
diff --git a/XQMuse/Root/Me/VC/VIPCenterVC.swift b/XQMuse/Root/Me/VC/VIPCenterVC.swift
index 6e0b38c..f5a994c 100644
--- a/XQMuse/Root/Me/VC/VIPCenterVC.swift
+++ b/XQMuse/Root/Me/VC/VIPCenterVC.swift
@@ -353,23 +353,23 @@
 
     func isSelect(_ state:Bool,indexPath:IndexPath,vipContentModel:VIPContentModel){
 
-        var price:Int = 0
+        var formartPrice:String = ""
         switch indexPath.row{
             case 0:
-                price = vipContentModel.monthlyVipIos
+//                price = vipContentModel.monthlyVipIos
                 label_title.text = "月度会员"
-                label_price.text = "¥" + vipContentModel.monthlyVipIos.string
-                lable_priorDay.text = String(format: "¥%.2lf/天", vipContentModel.monthlyVipIos.double / 30.0)
+                formartPrice =  vipContentModel.monthlyVipIos.jq_formatFloat
+                lable_priorDay.text = String(format: "¥%.2lf/天", vipContentModel.monthlyVipIos / 30.0)
             case 1:
-                price = vipContentModel.quarterlyVipIos
+//                price = vipContentModel.quarterlyVipIos
                label_title.text = "半年会员"
-               label_price.text = "¥" + vipContentModel.quarterlyVipIos.string
-               lable_priorDay.text = String(format: "¥%.2lf/天", vipContentModel.quarterlyVipIos.double / 30.0)
+                formartPrice = vipContentModel.quarterlyVipIos.jq_formatFloat
+               lable_priorDay.text = String(format: "¥%.2lf/天", vipContentModel.quarterlyVipIos / 30.0)
             case 2:
-                price = vipContentModel.annualVipIos
+//                price = vipContentModel.annualVipIos
                 label_title.text = "年度会员"
-                label_price.text = "¥" + vipContentModel.annualVipIos.string
-                lable_priorDay.text = String(format: "¥%.2lf/天", vipContentModel.annualVipIos.double / 30.0)
+                formartPrice = vipContentModel.annualVipIos.jq_formatFloat
+                lable_priorDay.text = String(format: "¥%.2lf/天", vipContentModel.annualVipIos / 30.0)
             default:break
         }
 
@@ -377,12 +377,12 @@
             contentView.backgroundColor = UIColor(hexString: "#A6C586")
             label_title.textColor = .white
             lable_priorDay.textColor = .white
-            label_price.attributedText = AttributedStringbuilder.build().add(string: "¥", withFont: .systemFont(ofSize: 15, weight:.heavy), withColor: .white).add(string: "\(price)", withFont: .systemFont(ofSize: 20, weight:.heavy), withColor: .white).mutableAttributedString
+            label_price.attributedText = AttributedStringbuilder.build().add(string: "¥", withFont: .systemFont(ofSize: 15, weight:.heavy), withColor: .white).add(string: formartPrice, withFont: .systemFont(ofSize: 20, weight:.heavy), withColor: .white).mutableAttributedString
         }else{
             contentView.backgroundColor = UIColor(hexString: "#EFF2F2")
             label_title.textColor = UIColor(hexString: "#353535")
             lable_priorDay.textColor = UIColor(hexString: "#B7B7B7")
-            label_price.attributedText = AttributedStringbuilder.build().add(string: "¥", withFont: .systemFont(ofSize: 15, weight:.heavy), withColor: UIColor(hexString: "#353535")!).add(string: "\(price)", withFont: .systemFont(ofSize: 20, weight:.heavy), withColor: UIColor(hexString: "#353535")!).mutableAttributedString
+            label_price.attributedText = AttributedStringbuilder.build().add(string: "¥", withFont: .systemFont(ofSize: 15, weight:.heavy), withColor: UIColor(hexString: "#353535")!).add(string: formartPrice, withFont: .systemFont(ofSize: 20, weight:.heavy), withColor: UIColor(hexString: "#353535")!).mutableAttributedString
         }
     }
 
diff --git a/XQMuse/Root/Me/VC/WalletRechargeVC.swift b/XQMuse/Root/Me/VC/WalletRechargeVC.swift
index 1a0d3d4..4811ab9 100644
--- a/XQMuse/Root/Me/VC/WalletRechargeVC.swift
+++ b/XQMuse/Root/Me/VC/WalletRechargeVC.swift
@@ -100,11 +100,14 @@
                             case "failed":
                                 alertError(msg: "购买失败")
                             case "closed":
-                                alertError(msg: "交易已关闭")
+                                break
+//                                alertError(msg: "交易已关闭")
                             case "refunded":
-                                alertError(msg: "全额退款")
+                                break
+//                                alertError(msg: "全额退款")
                             case "pending":
-                                alertError(msg: "待支付")
+                                break
+//                                alertError(msg: "待支付")
                             default:break
                         }
                     }
diff --git a/XQMuse/Root/Network/Models.swift b/XQMuse/Root/Network/Models.swift
index ed3a321..060c255 100644
--- a/XQMuse/Root/Network/Models.swift
+++ b/XQMuse/Root/Network/Models.swift
@@ -512,9 +512,9 @@
 }
 
 struct VIPContentModel:HandyJSON{
-    var annualVipIos:Int = 0
-    var monthlyVipIos:Int = 0
-    var quarterlyVipIos:Int = 0
+    var annualVipIos:Double = 0
+    var monthlyVipIos:Double = 0
+    var quarterlyVipIos:Double = 0
 }
 
 struct PaymentResultModel:HandyJSON{
diff --git a/XQMuse/Root/Network/Services.swift b/XQMuse/Root/Network/Services.swift
index 4020bb2..7261ee7 100644
--- a/XQMuse/Root/Network/Services.swift
+++ b/XQMuse/Root/Network/Services.swift
@@ -18,6 +18,7 @@
 //let All_Url = "https://mock.apipost.net/mock/31b303c60464000"
 #else
 let All_Url = "https://xq.xqzhihui.com/api"
+//let All_Url = "http://192.168.110.64:9000"
 #endif
 
 let ShareUrl = "http://113.45.158.158/share/#/pages"
@@ -380,6 +381,7 @@
             .append(key: "receiverId", value: receiverId)
             .append(key: "targetId", value: targetId)
             .append(key: "vipType", value: vipType)
+            .append(key: "type", value: 1)
         return NetworkRequest.request(params: params, method: .post, progress: true)
     }
 
diff --git a/XQMuse/Root/PayMusicView/PayMusicVC.swift b/XQMuse/Root/PayMusicView/PayMusicVC.swift
index 7480392..0aba4e9 100644
--- a/XQMuse/Root/PayMusicView/PayMusicVC.swift
+++ b/XQMuse/Root/PayMusicView/PayMusicVC.swift
@@ -310,7 +310,7 @@
         NotificationCenter.default.addObserver(forName: ChangeMasterVoice_Noti, object: nil, queue: .main) { noti in
             if let value = noti.object as? Float{
                 print("--->进入")
-//                self.masterPlayer?.volume = value
+                self.masterPlayer?.volume = value
                 self.bgmPlayer?.volume = value
             }
         }
@@ -411,10 +411,10 @@
 												}
 												self.bgmPlayer = AVPlayer(url: self.urls[firstPlayIndex])
 
-//												if masterUrl != nil{
-//																self.masterPlayer = AVPlayer(url: masterUrl!)
-//                self.masterPlayer?.volume = Float(UserDefaultSettingViewModel.getSetting()?.masterVolume ?? 0.5)
-//            }
+												if masterUrl != nil{
+																self.masterPlayer = AVPlayer(url: masterUrl!)
+                self.masterPlayer?.volume = Float(UserDefaultSettingViewModel.getSetting()?.masterVolume ?? 0.5)
+            }
 								}
 
 								self.bgmPlayer?.addPeriodicTimeObserver(forInterval: CMTimeMake(value: 1, timescale: 1), queue: DispatchQueue.main) { [weak self](time) in
diff --git a/XQMuse/SceneDelegate.swift b/XQMuse/SceneDelegate.swift
index 04ee6b8..98e8459 100644
--- a/XQMuse/SceneDelegate.swift
+++ b/XQMuse/SceneDelegate.swift
@@ -190,7 +190,9 @@
     }
 
     func onResp(_ resp: BaseResp) {
-
+        if let minProgramResp = resp as? WXLaunchMiniProgramResp{
+            minProgramResp.description
+        }
     }
 
 }

--
Gitblit v1.7.1