From bd60edb681b1914fd891ba364e7851184d9fc108 Mon Sep 17 00:00:00 2001 From: linshujie Date: Fri, 11 Sep 2026 10:18:43 +0800 Subject: [PATCH] - --- .../Manager/Account/AppContextManager.swift | 5 ++++- QuickLocation/Manager/App/ApiManager.swift | 19 +++++++++---------- .../Section/Group/GroupChat/GroupChatVC.swift | 4 ---- .../Section/Home/Bubble/CreateBubbleVC.swift | 4 ---- .../Section/Login/LoginViewModel.swift | 3 +-- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/QuickLocation/Manager/Account/AppContextManager.swift b/QuickLocation/Manager/Account/AppContextManager.swift index 10f59056..bc9e50ef 100644 --- a/QuickLocation/Manager/Account/AppContextManager.swift +++ b/QuickLocation/Manager/Account/AppContextManager.swift @@ -65,7 +65,10 @@ class AppContextManager: NSObject { /// 会员 1:非会员 2:普通会员 3:终身会员 var vip: Int { - account?.vip ?? 1 + guard AppContextManager.shared.systemConfig?.isIntercept == false else { + return 2 + } + return account?.vip ?? 1 } /// 状态:0、无状态 1、SOS 2、气泡等 var status: Int { diff --git a/QuickLocation/Manager/App/ApiManager.swift b/QuickLocation/Manager/App/ApiManager.swift index 3e07a123..ad997872 100644 --- a/QuickLocation/Manager/App/ApiManager.swift +++ b/QuickLocation/Manager/App/ApiManager.swift @@ -88,8 +88,12 @@ extension ApiManager { } let code = json["code"].int let success: Bool? = json["success"].bool - let message = json["message"].string - let combineMessage = message ?? "请检查网络连接" + + let message = json["message"].string? + .split(separator: ",", maxSplits: 1, omittingEmptySubsequences: false) + .first + .map(String.init)? + .trimmingCharacters(in: .whitespacesAndNewlines) ?? "请检查网络连接" // 接口code switch code { @@ -124,12 +128,12 @@ extension ApiManager { /// 统一提示错误 let code = GatewayStatusCode(rawValue: code ?? -9999) ?? .unknownError if code == .unknownError, handle { - DLToast.show(text: combineMessage) + DLToast.show(text: message) } } return .failure(handleError(with: code, domain: "Data Error", - message: combineMessage, + message: message, isShowTip: code != GatewayStatusCode.needVip.rawValue, data: response)) case let .failure(error): @@ -185,13 +189,8 @@ extension ApiManager { // MARK: - 需开通VIP private func handleNeedVip(_ msg: String) { - let message = msg - .split(separator: ",", maxSplits: 1, omittingEmptySubsequences: false) - .first - .map(String.init)? - .trimmingCharacters(in: .whitespacesAndNewlines) ?? "" MainAsync { - UIViewController.showConfirmPop(title: "温馨提示", message: message, confirmText: "去开通", confirmBlock: { + UIViewController.showConfirmPop(title: "温馨提示", message: msg, confirmText: "去开通", confirmBlock: { AppRouter.push(Route.vipRecharge) }, cancelText: "取消") } diff --git a/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift b/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift index a712594d..f349868f 100644 --- a/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift +++ b/QuickLocation/Section/Group/GroupChat/GroupChatVC.swift @@ -573,10 +573,6 @@ final class GroupChatVC: BaseViewController { // MARK: - Actions private var isVipUnlocked: Bool { - guard AppContextManager.shared.systemConfig?.isIntercept == false else { - return false - } - return AppContextManager.shared.vip > 1 } diff --git a/QuickLocation/Section/Home/Bubble/CreateBubbleVC.swift b/QuickLocation/Section/Home/Bubble/CreateBubbleVC.swift index 36ad1e62..438e7540 100644 --- a/QuickLocation/Section/Home/Bubble/CreateBubbleVC.swift +++ b/QuickLocation/Section/Home/Bubble/CreateBubbleVC.swift @@ -95,10 +95,6 @@ class CreateBubbleVC: BaseViewController { } private var isVipUnlocked: Bool { - guard AppContextManager.shared.systemConfig?.isIntercept == false else { - return false - } - return AppContextManager.shared.vip > 1 } diff --git a/QuickLocation/Section/Login/LoginViewModel.swift b/QuickLocation/Section/Login/LoginViewModel.swift index 89c8178d..f93c8f4b 100644 --- a/QuickLocation/Section/Login/LoginViewModel.swift +++ b/QuickLocation/Section/Login/LoginViewModel.swift @@ -43,8 +43,7 @@ enum LoginSessionHandler { NotificationCenter.default.post(name: .RefreshUserConfigNotification, object: nil) } }, onError: { error in - DLToast.dismiss() - DLToast.showError(text: "登录失败,请重试") + DLToast.showError(text: error.localizedDescription) }).disposed(by: disposeBag) } }