| | |
| | | package cn.flightfeather.thirdapp.common.net |
| | | |
| | | import android.accounts.NetworkErrorException |
| | | import cn.flightfeather.thirdapp.model.bean.BaseResponse |
| | | import io.reactivex.Observer |
| | | import io.reactivex.disposables.Disposable |
| | | import retrofit2.Response |
| | |
| | | var currentPage = -1 |
| | | var totalPage = -1 |
| | | try { |
| | | currentPage = response.headers().get("currentPage")?.toInt() ?: -1 |
| | | totalPage = response.headers().get("totalPage")?.toInt() ?: -1 |
| | | val body = response.body() |
| | | if (body is BaseResponse<*>) { |
| | | currentPage = body.head?.page ?: -1 |
| | | totalPage = body.head?.totalPage ?: -1 |
| | | } |
| | | } catch (e: Exception) { |
| | | e.printStackTrace() |
| | | } |