riku
2025-10-27 0f58aa8ea118c3bd0b28396febc58fdbd94eef75
app/src/main/java/cn/flightfeather/thirdappmodule/repository/SearchRepository.kt
@@ -1,9 +1,12 @@
package cn.flightfeather.thirdappmodule.repository
import cn.flightfeather.thirdappmodule.bean.entity.Subtask
import cn.flightfeather.thirdappmodule.common.net.NetWorkProgressListener
import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
import cn.flightfeather.thirdappmodule.common.net.ResultObserver
import cn.flightfeather.thirdappmodule.common.net.RetrofitFactory
import cn.flightfeather.thirdappmodule.httpservice.SearchService
import cn.flightfeather.thirdappmodule.model.bean.BaseResponse
import cn.flightfeather.thirdappmodule.model.bean.ExcelConfigVo
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
@@ -16,6 +19,8 @@
 */
class SearchRepository {
    val retrofit = RetrofitFactory.instance.retrofit
    fun getExcel(excelConfigVo: ExcelConfigVo, resultCallBack: ResultCallBack<Response<ResponseBody>>, listener: NetWorkProgressListener? = null) {
        val service = RetrofitFactory.withProgressListeningRetrofit(listener).create(SearchService::class.java)
                .getExcel(excelConfigVo)
@@ -27,4 +32,23 @@
                    resultCallBack.onFailure()
                })
    }
    fun searchSubtask(userId: String, keyword: String, page: Int, resultCallBack: ResultCallBack<List<Subtask>>) {
        val service = retrofit.create(SearchService::class.java).searchSubtask(userId, keyword, page)
        RetrofitFactory.executeResult(service, object : ResultObserver<BaseResponse<List<Subtask>>>() {
            override fun onSuccess(result: BaseResponse<List<Subtask>>?) {
                resultCallBack.onSuccess(result?.data)
            }
            override fun onPage(current: Int, total: Int) {
                super.onPage(current, total)
                resultCallBack.onPage(current, total)
            }
            override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
                resultCallBack.onFailure()
            }
        })
    }
}