jsdw_ios/QuickLocation/Service/UserService.swift

52 lines
1.5 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// UserService.swift
// QuickLocation
//
// Created by 八条 on 2026/5/28.
//
import RxSwift
import Moya
struct UserService {
static let disposeBag = DisposeBag()
/// 登录
/// - Parameters:
/// - type: weixin、phone、apple、onekey、device、alipay
/// - bind:1绑定 2解绑 为空是登录
static func login(type: String,
bind: String = "",
data: [String: Any]) -> Observable<UserLoginRespons> {
return APIProvider.request(token: UserAPI.login(type: type,
bind: bind,
data: data).multiTarget,
handle: false)
.map(UserLoginRespons.self)
.asObservable()
}
/// 用户信息
static func userInfo() -> Observable<UserConfigResponse> {
let api = UserAPI.userInfo.multiTarget
return APIProvider.request(token: api)
.map(UserConfigResponse.self)
.asObservable()
}
static func imToken() -> Observable<ResponseModel> {
let api = UserAPI.imToken.multiTarget
return APIProvider.request(token: api)
.map(ResponseModel.self)
.asObservable()
}
/// 退出登录
static func logout() -> Observable<ResponseModel> {
let api = UserAPI.logout.multiTarget
return APIProvider.request(token: api)
.map(ResponseModel.self)
.asObservable()
}
}