package com.ym.userinfo.module.presenter

import com.ym.library.module.WithdrawEntity
import com.ym.library.net.BaseObserver
import com.ym.library.net.RxSchedulers
import com.ym.userinfo.module.contract.WithdrawalsRecordContract
import com.ym.userinfo.module.net.UserApiClient

/**
 *Craeted by ${junqi.li}
 *Craeted by 2020/8/27
 */
class WithdrawalsRecordPresenter : WithdrawalsRecordContract.Presenter {

    private val mView: WithdrawalsRecordContract.View

    constructor(mView: WithdrawalsRecordContract.View) {
        this.mView = mView
    }

    override fun requestWithdrawalsRecord() {
        UserApiClient.userApi.getUserhiWithdrawHistory()
            .compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<List<WithdrawEntity>>() {
                override fun onSuccess(result: List<WithdrawEntity>) {
                    //常规提现
                    mView.updataSuccess(result)
                }

                override fun onFailure(e: Throwable, code: String, errorMsg: String?) {

                }
            })
    }
}