From fdb1d18a0b4b941b986d55f66c589e29836494eb Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期二, 06 五月 2025 20:23:55 +0800 Subject: [PATCH] fix --- DolphinEnglishLearnStudent/Base/BaseTabBarVC.swift | 3 DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift | 24 ++++- DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift | 98 +++++++++++++----------- DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.xib | 14 +-- DolphinEnglishLearnStudent/Other/UIView/VoiceHandleView.swift | 9 +- DolphinEnglishLearnStudent/Services/InPurchaseManager.swift | 41 +++++----- DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift | 2 DolphinEnglishLearnStudent/Services/Services.swift | 10 ++ DolphinEnglishLearnStudent/Login/LoginVC.swift | 6 + DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift | 2 DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift | 4 11 files changed, 124 insertions(+), 89 deletions(-) diff --git a/DolphinEnglishLearnStudent/Base/BaseTabBarVC.swift b/DolphinEnglishLearnStudent/Base/BaseTabBarVC.swift index 88019de..aa24617 100644 --- a/DolphinEnglishLearnStudent/Base/BaseTabBarVC.swift +++ b/DolphinEnglishLearnStudent/Base/BaseTabBarVC.swift @@ -14,5 +14,8 @@ tabBar.backgroundColor = .white tabBar.tintColor = Config.ThemeColor + if #available(iOS 17.0, *) { + traitOverrides.horizontalSizeClass = .compact + } } } diff --git a/DolphinEnglishLearnStudent/Login/LoginVC.swift b/DolphinEnglishLearnStudent/Login/LoginVC.swift index 27decfd..35a200d 100644 --- a/DolphinEnglishLearnStudent/Login/LoginVC.swift +++ b/DolphinEnglishLearnStudent/Login/LoginVC.swift @@ -77,6 +77,12 @@ @IBAction func loginAction(_ sender: UIButton) { +// DispatchQueue.global().async { +// Task{ +// await InPurchaseManager.testrefundRequest(for: 2000000680173869) +// } +// } + guard authInputPhone() else {return} guard authInputCode() else {return} diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.xib b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.xib index a5641ef..e24fa6c 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.xib +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.xib @@ -1,16 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <device id="ipad10_9rounded" orientation="portrait" layout="fullscreen" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> - <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="_ListenFight_lesson_1_CCell" id="gTV-IL-0wX" customClass="ListenFight_lesson_1_CCell" customModule="DolphinEnglishLearnStudent" customModuleProvider="target"> + <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="" id="gTV-IL-0wX" customClass="ListenFight_lesson_1_CCell" customModule="DolphinEnglishLearnStudent" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="445" height="379"/> <autoresizingMask key="autoresizingMask"/> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> @@ -41,7 +40,7 @@ <rect key="frame" x="5" y="45" width="435" height="329"/> </imageView> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kkd-SI-bwq"> - <rect key="frame" x="172.5" y="141.5" width="100" height="100"/> + <rect key="frame" x="172.5" y="139.5" width="100" height="100"/> <constraints> <constraint firstAttribute="width" constant="100" id="LTx-TZ-bFM"/> <constraint firstAttribute="height" constant="100" id="yDa-rf-HIO"/> @@ -49,15 +48,14 @@ </imageView> </subviews> </view> - <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <constraints> <constraint firstItem="bdL-d4-7NQ" firstAttribute="top" secondItem="JdK-rh-KJI" secondAttribute="bottom" id="4oo-KH-5Tx"/> - <constraint firstItem="kkd-SI-bwq" firstAttribute="centerY" secondItem="ZTg-uK-7eu" secondAttribute="centerY" id="78d-bY-KVe"/> + <constraint firstItem="kkd-SI-bwq" firstAttribute="centerY" secondItem="gTV-IL-0wX" secondAttribute="centerY" id="78d-bY-KVe"/> <constraint firstAttribute="trailing" secondItem="bdL-d4-7NQ" secondAttribute="trailing" constant="5" id="CTn-Yp-I4m"/> <constraint firstItem="JdK-rh-KJI" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="5" id="H2K-rm-Njk"/> <constraint firstAttribute="trailing" secondItem="JdK-rh-KJI" secondAttribute="trailing" constant="5" id="HaX-d6-Ou6"/> - <constraint firstItem="kkd-SI-bwq" firstAttribute="centerX" secondItem="ZTg-uK-7eu" secondAttribute="centerX" id="NVR-Eo-GGe"/> + <constraint firstItem="kkd-SI-bwq" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="NVR-Eo-GGe"/> <constraint firstAttribute="bottom" secondItem="bdL-d4-7NQ" secondAttribute="bottom" constant="5" id="d7u-Rd-bRk"/> <constraint firstItem="JdK-rh-KJI" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="5" id="g3Z-CO-Any"/> <constraint firstItem="bdL-d4-7NQ" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="5" id="yCf-NO-CuB"/> diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift index a7591b1..2b4a6af 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift @@ -20,6 +20,7 @@ private var playedIndex = Set<Int>() //已经播放过的view private var voicePlayer = VoicePlayer.share() private var isAnsterModel = Set<Listen1SubModel>() + private var isOpen:Bool = false //是否展示标题文本 private lazy var stackView:UIStackView = { let stackView = UIStackView() @@ -55,6 +56,12 @@ override func viewDidLoad() { super.viewDidLoad() navigationItem.titleView = UIView() + + Services.getIsOpen().subscribe(onNext: {data in + self.isOpen = data.data ?? false + self.collectionView.reloadData() + }).disposed(by: disposeBag) + //回传记录,始终保持答题进度 if let team = teamScheduleModel{ @@ -310,11 +317,12 @@ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_lesson_1_CCell", for: indexPath) as! ListenFight_lesson_1_CCell cell.jq_addShadows(shadowColor: .black.withAlphaComponent(0.31), corner: 5, radius: 5, offset: CGSize(width: 0, height: 1), opacity: 1) cell.backgroundColor = .white - if viewModel.selectIndex.value?.row == indexPath.row{ - cell.label_title.isHidden = false - }else{ - cell.label_title.isHidden = true - } + + if viewModel.selectIndex.value?.row == indexPath.row && isOpen{ + cell.label_title.isHidden = false + }else{ + cell.label_title.isHidden = true + } cell.setListen1SubModel(listenNewModel.subjectList[page][indexPath.row]) cell.label_title.text = listenNewModel.subjectList[page][indexPath.row].name @@ -324,6 +332,10 @@ func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return listenNewModel.subjectList[page].count } + + func numberOfSections(in collectionView: UICollectionView) -> Int { + return 1 + } } extension HomeListenFight_lesson_2_VC:VoicePlayerDelegate{ @@ -368,7 +380,7 @@ sub.btn_choose.isEnabled = false } - DispatchQueue.main.asyncAfter(deadline: .now()+3) { + DispatchQueue.main.asyncAfter(deadline: .now()+2) { self.resetStackView() diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift index e16fb30..f97fe42 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift @@ -304,11 +304,11 @@ tempSubV?.img_state.alpha = 1 }completion: { _ in - UIView.animate(withDuration: 0.4, delay: 3.0) { + UIView.animate(withDuration: 0.4, delay: 2.0) { tempSubV?.img_state.alpha = 0 } - DispatchQueue.main.asyncAfter(deadline: .now()+3.2) { + DispatchQueue.main.asyncAfter(deadline: .now()+2) { self.setAnswerStackView() self.view.isUserInteractionEnabled = true } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift index a43cc66..fae2e30 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift @@ -113,7 +113,7 @@ self.currentAnswer = self.answerSet.randomElement() //随机 if self.timer == nil{self.startTimer()} }else{ - DispatchQueue.main.asyncAfter(deadline: .now()+3) { + DispatchQueue.main.asyncAfter(deadline: .now()+2) { self.currentAnswer = self.answerSet.randomElement() //随机 if self.timer == nil{self.startTimer()} } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift index 7da88aa..ac0d776 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift @@ -173,7 +173,7 @@ UIView.animate(withDuration: 0.5) { handleView.btn_state.alpha = 1 } - DispatchQueue.main.asyncAfter(deadline:.now()+3) { + DispatchQueue.main.asyncAfter(deadline:.now()+2) { UIView.animate(withDuration: 0.5) { handleView.btn_state.alpha = 0 handleView.btn_choose.isSelected = false diff --git a/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift b/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift index 01e62b5..43a8483 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift @@ -75,52 +75,60 @@ } @objc func becomeVIPAction(){ + #if DEBUG + toPay() + #else ParentVerifiyView.show {[unowned self] in - guard let userId = UserViewModel.getUserInfo()?.user?.id.string else {alert(msg: "请先登录");return} - guard let product = products.first else {alert(msg: "获取内购失败");return} - - Services.orderStudent(count: 12, price: product.price.doubleValue).subscribe(onNext: {[unowned self] data in - if let m = data.data{ - showHUD("正在购买") - InPurchaseManager.purchaseProduct(ID: ProductMemberID, applicationUsername: userId) {[unowned self] model in - let transactionIdentifier = model.receipt?.in_app.first?.original_transaction_id ?? "" - - hiddenHUD() - Services.pay(orderId: m.orderId, transactionIdentifier: transactionIdentifier).subscribe(onNext: {[unowned self] data in - var count = 0 - showHUD("正在查询支付结果") - let t = Timer(timeInterval: 2.0, repeats: true) {[unowned self] timer in - Services.queryOrderState(orderId: m.orderId).subscribe(onNext: {[unowned self]status in - if status.data == true{ - alertSuccess(msg: "购买成功") - DispatchQueue.main.asyncAfter(deadline: .now()+1) {[unowned self] in - navigationController?.popViewController() - NotificationCenter.default.post(name: MeUserInfoUpdate_Noti, object: nil) - } - timer.invalidate() - return - } - count += 1 - if count >= 15{ - hiddenHUD() - print("循环结束") - showHUD("查询结果失败,请联系客服") - timer.invalidate() - } - },onError: {error in - timer.invalidate() - }).disposed(by: disposeBag) - } - t.fire() - RunLoop.current.add(t, forMode: .common) - }).disposed(by: disposeBag) - - } errorClouse: { error in - hiddenHUD() - alert(msg: error.localizedDescription) - } - } - }).disposed(by: disposeBag) + self.toPay() } + #endif + } + + private func toPay(){ + guard let userId = UserViewModel.getUserInfo()?.user?.id.string else {alert(msg: "请先登录");return} + guard let product = products.first else {alert(msg: "获取内购失败");return} + + Services.orderStudent(count: 12, price: product.price.doubleValue).subscribe(onNext: {[unowned self] data in + if let m = data.data{ + showHUD("正在购买") + InPurchaseManager.purchaseProduct(ID: ProductMemberID, applicationUsername: userId) {[unowned self] model in + let transactionIdentifier = model.receipt?.in_app.first?.original_transaction_id ?? "" + + hiddenHUD() + Services.pay(orderId: m.orderId, transactionIdentifier: transactionIdentifier).subscribe(onNext: {[unowned self] data in + var count = 0 + showHUD("正在查询支付结果") + let t = Timer(timeInterval: 2.0, repeats: true) {[unowned self] timer in + Services.queryOrderState(orderId: m.orderId).subscribe(onNext: {[unowned self]status in + if status.data == true{ + alertSuccess(msg: "购买成功") + DispatchQueue.main.asyncAfter(deadline: .now()+1) {[unowned self] in + navigationController?.popViewController() + NotificationCenter.default.post(name: MeUserInfoUpdate_Noti, object: nil) + } + timer.invalidate() + return + } + count += 1 + if count >= 15{ + hiddenHUD() + print("循环结束") + showHUD("查询结果失败,请联系客服") + timer.invalidate() + } + },onError: {error in + timer.invalidate() + }).disposed(by: disposeBag) + } + t.fire() + RunLoop.current.add(t, forMode: .common) + }).disposed(by: disposeBag) + + } errorClouse: { error in + hiddenHUD() + alert(msg: error.localizedDescription) + } + } + }).disposed(by: disposeBag) } } diff --git a/DolphinEnglishLearnStudent/Other/UIView/VoiceHandleView.swift b/DolphinEnglishLearnStudent/Other/UIView/VoiceHandleView.swift index 489802f..694071e 100644 --- a/DolphinEnglishLearnStudent/Other/UIView/VoiceHandleView.swift +++ b/DolphinEnglishLearnStudent/Other/UIView/VoiceHandleView.swift @@ -10,19 +10,19 @@ class VoiceHandleView: UIView { private lazy var img_hint:UIImageView = { - let img = UIImageView(image: UIImage(named: "icon_play_1")) + let img = UIImageView(image: UIImage(named: "icon_play_1")?.themeGreen) return img }() private lazy var img_hint_playing:UIImageView = { - let img = UIImageView(image: UIImage(named: "icon_playing")) + let img = UIImageView(image: UIImage(named: "icon_playing")?.themeGreen) img.isHidden = true return img }() private lazy var btn_play:UIButton = { let btn = UIButton(type: .custom) - btn.setImage(UIImage(named: "icon_play"), for: .normal) + btn.setImage(UIImage(named: "icon_play")?.themeGreen, for: .normal) return btn }() @@ -42,7 +42,8 @@ } private func setUI(){ - backgroundColor = UIColor(hexString: "#41A2EB") +// backgroundColor = UIColor(hexString: "#41A2EB") + backgroundColor = UIColor.white jq_cornerRadius = 8 addSubview(img_hint_playing) addSubview(img_hint) diff --git a/DolphinEnglishLearnStudent/Services/InPurchaseManager.swift b/DolphinEnglishLearnStudent/Services/InPurchaseManager.swift index 821194a..6fb09c4 100644 --- a/DolphinEnglishLearnStudent/Services/InPurchaseManager.swift +++ b/DolphinEnglishLearnStudent/Services/InPurchaseManager.swift @@ -110,27 +110,28 @@ } } - // func getIPAPrice(_ price:Int,clouse:@escaping (SKProduct)->Void){ - // var ipaId = "" - // switch price { - // case 98: ipaId = "com.jkfitness.a.price.1" - // case 298:ipaId = "com.jkfitness.a.price.2" - // case 488:ipaId = "com.jkfitness.a.price.3" - // case 698:ipaId = "com.jkfitness.a.price.4" - // case 998:ipaId = "com.jkfitness.a.price.5" - // default:break - // } - // - // var productIds = Set<String>() - // productIds.insert(ipaId) - // - // InPurchaseManager.instance().setProductList(productIds) {products in - // if let product = products.first{ - // clouse(product) - // } - // } - // } + static func testrefundRequest(for transactionID:UInt64) async{ + do{ + if #available(iOS 15.0, *) { + let windowScene = await UIApplication.shared.connectedScenes.first + let result = try await StoreKit.Transaction.beginRefundRequest(for: transactionID, in: windowScene as! UIWindowScene) + switch result { + case .success: + alert(msg: "退款申请发起成功") + case .userCancelled:break + @unknown default:break + } + } else { + // Fallback on earlier versions + } + }catch{ error + + print(error) + + + } + } func dismiss(){ InPurchaseManager._sharedInstance = nil diff --git a/DolphinEnglishLearnStudent/Services/Services.swift b/DolphinEnglishLearnStudent/Services/Services.swift index 17bc847..6979701 100644 --- a/DolphinEnglishLearnStudent/Services/Services.swift +++ b/DolphinEnglishLearnStudent/Services/Services.swift @@ -13,9 +13,9 @@ #if DEBUG //let All_Url = "http://192.168.110.237:9000" -let All_Url = "http://1.95.15.237:9000" +let All_Url = "https://dollearn.com/api" #else -let All_Url = "http://1.95.15.237:9000" +let All_Url = "https://dollearn.com/api" #endif class Services: NSObject { @@ -433,6 +433,12 @@ return NetworkRequest.request(params: params, method: .post, progress: false) } + class func getIsOpen()->Observable<BaseResponse<Bool>>{ + let params = ParamsAppender.build(url: All_Url) + params.interface(url: "/management/tSysSet/getIsOpen") + return NetworkRequest.request(params: params, method: .get, progress: false) + } + } extension Services{ -- Gitblit v1.7.1