diff --git a/app/src/main/java/com/sw/inbound/model/response/InboundApiResponse.kt b/app/src/main/java/com/sw/inbound/model/response/InboundApiResponse.kt index 88b9488..4067690 100644 --- a/app/src/main/java/com/sw/inbound/model/response/InboundApiResponse.kt +++ b/app/src/main/java/com/sw/inbound/model/response/InboundApiResponse.kt @@ -7,9 +7,9 @@ import com.google.gson.annotations.SerializedName * 与旧 ApiResponse 区别:code 为 Int,200 表示成功 */ data class InboundApiResponse( - @SerializedName("code") val code: Int = -1, + @SerializedName("code") val code: String? = null, @SerializedName("msg") val msg: String? = null, @SerializedName("data") val data: T? = null ) { - fun isSuccess(): Boolean = code == 200 + fun isSuccess(): Boolean = code == "00000" } diff --git a/app/src/main/java/com/sw/inbound/repository/InboundRepository.kt b/app/src/main/java/com/sw/inbound/repository/InboundRepository.kt index 8fe0cef..06d368c 100644 --- a/app/src/main/java/com/sw/inbound/repository/InboundRepository.kt +++ b/app/src/main/java/com/sw/inbound/repository/InboundRepository.kt @@ -67,7 +67,7 @@ class InboundRepository @Inject constructor( is IOException -> "网络IO错误: ${e.message}" else -> "未知错误: ${e.message}" } - InboundApiResponse(code = -1, msg = msg) + InboundApiResponse(code = "-1", msg = msg) } } }