package cn.flightfeather.thirdappmodule.repository
|
|
import cn.flightfeather.thirdappmodule.common.net.NetWorkProgressListener
|
import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
|
import cn.flightfeather.thirdappmodule.common.net.RetrofitFactory
|
import cn.flightfeather.thirdappmodule.httpservice.SearchService
|
import cn.flightfeather.thirdappmodule.model.bean.ExcelConfigVo
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.schedulers.Schedulers
|
import okhttp3.ResponseBody
|
import retrofit2.Response
|
|
/**
|
* @author riku
|
* Date: 2020/6/15
|
*/
|
class SearchRepository {
|
|
fun getExcel(excelConfigVo: ExcelConfigVo, resultCallBack: ResultCallBack<Response<ResponseBody>>, listener: NetWorkProgressListener? = null) {
|
val service = RetrofitFactory.withProgressListeningRetrofit(listener).create(SearchService::class.java)
|
.getExcel(excelConfigVo)
|
.subscribeOn(Schedulers.io())
|
.observeOn(AndroidSchedulers.mainThread())
|
.subscribe({
|
resultCallBack.onSuccess(it)
|
},{
|
resultCallBack.onFailure()
|
})
|
}
|
}
|