From d59d55575d913646b7a90fca651904ab889c6723 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 18 二月 2022 16:30:53 +0800
Subject: [PATCH] ### 一、任务模块相关
---
app/src/main/java/cn/flightfeather/thirdappmodule/repository/SearchRepository.kt | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdappmodule/repository/SearchRepository.kt b/app/src/main/java/cn/flightfeather/thirdappmodule/repository/SearchRepository.kt
index 4e1b569..bdf08bd 100644
--- a/app/src/main/java/cn/flightfeather/thirdappmodule/repository/SearchRepository.kt
+++ b/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()
+ }
+ })
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3