// // LNHttpManager+Account.swift // Lanu // // Created by OneeChan on 2025/11/11. // import Foundation private let kNetPath_Login_Google = "/user/login/google/enter" private let kNetPath_Login_Email = "/user/login/email/enter" private let kNetPath_Login_Apple = "/user/login/apple/enter" private let kNetPath_Login_Phone = "/user/login/mobile/enter" private let kNetPath_Login_Refresh = "/user/renewalToken" private let kNetPath_Logout = "/user/logout" private let kNetPath_Login_Captcha = "/user/login/mobile/sendCode" private let kNetPath_Online_Heartbeat = "/user/online/heartbeat" extension LNHttpManager { func loginByPhone(code: String, num: String, captcha: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) { post(path: kNetPath_Login_Phone, params: [ "mobile": [ "code": code, "num": num ], "code": captcha ], completion: completion) } func loginByApple(token: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) { post(path: kNetPath_Login_Apple, params: ["data": token], completion: completion) } func loginByGoogle(token: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) { post(path: kNetPath_Login_Google, params: ["data": token], completion: completion) } #if DEBUG func loginByEmail(email: String, completion: @escaping (LNLoginResponse?, LNHttpError?) -> Void) { post(path: kNetPath_Login_Email, params: ["email": email], completion: completion) } #endif func refreshToken(completion: @escaping (LNRefreshTokenResponse?, LNHttpError?) -> Void) { post(path: kNetPath_Login_Refresh, completion: completion) } func logout(completion: @escaping (LNHttpError?) -> Void) { post(path: kNetPath_Logout, completion: completion) } func reportOnlineHeartbeat(completion: @escaping (LNHttpError?) -> Void) { post(path: kNetPath_Online_Heartbeat, completion: completion) } } extension LNHttpManager { func getLoginCaptcha(code: String, phone: String, completion: @escaping (LNHttpError?) -> Void) { post(path: kNetPath_Login_Captcha, params: [ "code": code, "num": phone ], completion: completion) } }