import Foundation /// 登录相关接口,对齐后端 app/api/v1/auth.py。jverify 一键登录首版不做(只短信)。 struct AuthService { private var api: APIClient { .shared } /// 发短信验证码(SMS_MOCK 下不真发,60s 冷却)。 func smsSend(phone: String) async throws -> SmsSendResponse { try await api.post("api/v1/auth/sms/send", body: SmsSendRequest(phone: phone), auth: false) } /// 短信登录(mock 下任意 6 位过)。返回 token + user。 func smsLogin(phone: String, code: String) async throws -> TokenWithUserDTO { try await api.post("api/v1/auth/sms/login", body: SmsLoginRequest(phone: phone, code: code), auth: false) } /// 当前用户资料。 func me() async throws -> UserDTO { try await api.get("api/v1/auth/me") } /// 退出(后端占位,不真正吊销 token)。 func logout() async throws -> LogoutResponse { try await api.post("api/v1/auth/logout") } }