This commit is contained in:
parent
44420e6cab
commit
bd60edb681
|
|
@ -65,7 +65,10 @@ class AppContextManager: NSObject {
|
||||||
|
|
||||||
/// 会员 1:非会员 2:普通会员 3:终身会员
|
/// 会员 1:非会员 2:普通会员 3:终身会员
|
||||||
var vip: Int {
|
var vip: Int {
|
||||||
account?.vip ?? 1
|
guard AppContextManager.shared.systemConfig?.isIntercept == false else {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
return account?.vip ?? 1
|
||||||
}
|
}
|
||||||
/// 状态:0、无状态 1、SOS 2、气泡等
|
/// 状态:0、无状态 1、SOS 2、气泡等
|
||||||
var status: Int {
|
var status: Int {
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,12 @@ extension ApiManager {
|
||||||
}
|
}
|
||||||
let code = json["code"].int
|
let code = json["code"].int
|
||||||
let success: Bool? = json["success"].bool
|
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
|
// 接口code
|
||||||
switch code {
|
switch code {
|
||||||
|
|
@ -124,12 +128,12 @@ extension ApiManager {
|
||||||
/// 统一提示错误
|
/// 统一提示错误
|
||||||
let code = GatewayStatusCode(rawValue: code ?? -9999) ?? .unknownError
|
let code = GatewayStatusCode(rawValue: code ?? -9999) ?? .unknownError
|
||||||
if code == .unknownError, handle {
|
if code == .unknownError, handle {
|
||||||
DLToast.show(text: combineMessage)
|
DLToast.show(text: message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return .failure(handleError(with: code,
|
return .failure(handleError(with: code,
|
||||||
domain: "Data Error",
|
domain: "Data Error",
|
||||||
message: combineMessage,
|
message: message,
|
||||||
isShowTip: code != GatewayStatusCode.needVip.rawValue,
|
isShowTip: code != GatewayStatusCode.needVip.rawValue,
|
||||||
data: response))
|
data: response))
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
|
|
@ -185,13 +189,8 @@ extension ApiManager {
|
||||||
|
|
||||||
// MARK: - 需开通VIP
|
// MARK: - 需开通VIP
|
||||||
private func handleNeedVip(_ msg: String) {
|
private func handleNeedVip(_ msg: String) {
|
||||||
let message = msg
|
|
||||||
.split(separator: ",", maxSplits: 1, omittingEmptySubsequences: false)
|
|
||||||
.first
|
|
||||||
.map(String.init)?
|
|
||||||
.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
|
||||||
MainAsync {
|
MainAsync {
|
||||||
UIViewController.showConfirmPop(title: "温馨提示", message: message, confirmText: "去开通", confirmBlock: {
|
UIViewController.showConfirmPop(title: "温馨提示", message: msg, confirmText: "去开通", confirmBlock: {
|
||||||
AppRouter.push(Route.vipRecharge)
|
AppRouter.push(Route.vipRecharge)
|
||||||
}, cancelText: "取消")
|
}, cancelText: "取消")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -573,10 +573,6 @@ final class GroupChatVC: BaseViewController {
|
||||||
|
|
||||||
// MARK: - Actions
|
// MARK: - Actions
|
||||||
private var isVipUnlocked: Bool {
|
private var isVipUnlocked: Bool {
|
||||||
guard AppContextManager.shared.systemConfig?.isIntercept == false else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return AppContextManager.shared.vip > 1
|
return AppContextManager.shared.vip > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,10 +95,6 @@ class CreateBubbleVC: BaseViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private var isVipUnlocked: Bool {
|
private var isVipUnlocked: Bool {
|
||||||
guard AppContextManager.shared.systemConfig?.isIntercept == false else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return AppContextManager.shared.vip > 1
|
return AppContextManager.shared.vip > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,7 @@ enum LoginSessionHandler {
|
||||||
NotificationCenter.default.post(name: .RefreshUserConfigNotification, object: nil)
|
NotificationCenter.default.post(name: .RefreshUserConfigNotification, object: nil)
|
||||||
}
|
}
|
||||||
}, onError: { error in
|
}, onError: { error in
|
||||||
DLToast.dismiss()
|
DLToast.showError(text: error.localizedDescription)
|
||||||
DLToast.showError(text: "登录失败,请重试")
|
|
||||||
}).disposed(by: disposeBag)
|
}).disposed(by: disposeBag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue