|
@@ -252,7 +252,7 @@ class KMUserInfoVCModel: ObservableObject {
|
|
|
/**
|
|
|
@abstract 注销账户申请 弹窗;
|
|
|
*/
|
|
|
- func closeAccountApplyWC(code: String) -> Void {
|
|
|
+ func closeAccountApplyWC(code: String,callback: ((Bool?, KMMemberCenterResult?)->Void)?) -> Void {
|
|
|
if KMMemberCenterManager.manager.isConnectionAvailable() == false {
|
|
|
let alert = NSAlert()
|
|
|
alert.alertStyle = .critical
|
|
@@ -260,53 +260,14 @@ class KMUserInfoVCModel: ObservableObject {
|
|
|
alert.informativeText = NSLocalizedString("Please make sure your internet connection is available.", comment: "")
|
|
|
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
alert.runModal()
|
|
|
+
|
|
|
+ callback?(false,nil)
|
|
|
return
|
|
|
}
|
|
|
KMMemberCenterManager.manager.userLogOffForUser(code: code) { success, result in
|
|
|
guard let result = result else { return }
|
|
|
- let resultDict = result as KMMemberCenterResult
|
|
|
- let msg = resultDict.msg
|
|
|
- if success {
|
|
|
- let logOff: KMMemberLogOff = resultDict.logOff!
|
|
|
- var currentTime = "0"
|
|
|
- var logOffTime = "0"
|
|
|
-
|
|
|
- let currentDate = Date()
|
|
|
- let calendar = Calendar.current
|
|
|
-
|
|
|
- if let token = logOff.currentTime {
|
|
|
- let dateFormatter = DateFormatter()
|
|
|
- dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
|
|
- // 将字符串转换为日期对象
|
|
|
- if let date = dateFormatter.date(from: token) {
|
|
|
- // 创建一个新的日期格式化器,用于只显示天
|
|
|
- let components = calendar.dateComponents([.day], from: currentDate, to: date)
|
|
|
-
|
|
|
- if let daysDifference = components.day {
|
|
|
- currentTime = String(daysDifference)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if let token = logOff.logOffTime {
|
|
|
- let dateFormatter = DateFormatter()
|
|
|
- dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
|
|
-
|
|
|
- // 将字符串转换为日期对象
|
|
|
- if let date = dateFormatter.date(from: token) {
|
|
|
- let components = calendar.dateComponents([.day], from: currentDate, to: date)
|
|
|
-
|
|
|
- if let daysDifference = components.day {
|
|
|
- logOffTime = String(daysDifference)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-// KMCloseApplyWC.shared.logOffTime = logOffTime
|
|
|
-// KMCloseApplyWC.shared.currentTime = currentTime
|
|
|
-
|
|
|
- KMCloseApplyWC.shared.showWindow(nil)
|
|
|
- } else {
|
|
|
- print(msg as Any)
|
|
|
- }
|
|
|
+ let resultDict = result as KMMemberCenterResult
|
|
|
+ callback?(success,resultDict)
|
|
|
}
|
|
|
}
|
|
|
|