1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()
                })
    }
}