You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package com.common.commonlibtest.manager
|
|
|
|
|
|
|
|
import com.common.commonlib.net.BaseObserve
|
|
|
|
import com.common.commonlib.net.RequestCallBack
|
|
|
|
import com.common.commonlibtest.bean.LoginResponse
|
|
|
|
import io.reactivex.rxjava3.core.Observable
|
|
|
|
import okhttp3.Interceptor
|
|
|
|
import retrofit2.http.*
|
|
|
|
|
|
|
|
class LoginLoader(interceptors: List<Interceptor>) :
|
|
|
|
BaseObserve<LoginLoader.LoginApi>() {
|
|
|
|
private val api: LoginApi
|
|
|
|
|
|
|
|
init {
|
|
|
|
api = initService(LoginApi::class.java, interceptors)
|
|
|
|
}
|
|
|
|
|
|
|
|
fun login(userName: String, pwd: String, callBack: RequestCallBack<LoginResponse>) {
|
|
|
|
observe(api.login(userName, pwd), callBack)
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LoginApi {
|
|
|
|
@FormUrlEncoded
|
|
|
|
@Headers("baseurl:debug1")
|
|
|
|
@POST("/user/login")
|
|
|
|
fun login(
|
|
|
|
@Field("username") userName: String,
|
|
|
|
@Field("password") pwd: String
|
|
|
|
): Observable<LoginResponse>
|
|
|
|
}
|
|
|
|
}
|