[feedback]优化数据加载逻辑

This commit is contained in:
renwj
2022-03-21 14:48:55 +08:00
parent de51b9e399
commit 3d94eb482d
3 changed files with 4 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ internal class Repository {
net.get(if (isDriven) "被动" else "主动", itx, 1)
itx
.takeIf { it.isNotEmpty() }
?.sortedBy { it.sort }
?.also {
store.updateRecords(it, isDriven)
}

View File

@@ -25,7 +25,7 @@ internal class BadCaseNetModel {
}
?.body()?.also {
val data = it.data
if (data == null || it.total <= result.size) {
if (data == null || data.isEmpty() || it.total <= result.size) {
return@also
}
result += data

View File

@@ -15,6 +15,7 @@ internal class BadCaseResponse {
var id: String? = null
var reason: String? = null
var channel: String? = null
var sort: String? = null
/**
* 业务字段,不参与序列化和反序列化
@@ -23,7 +24,7 @@ internal class BadCaseResponse {
var isChecked: Boolean = false
override fun toString(): String {
return "Reason(id=$id, reason=$reason, channel=$channel, isChecked=$isChecked)"
return "Reason(id=$id, reason=$reason, channel=$channel, sort=$sort, isChecked=$isChecked)"
}
}
}