package com.bc_chat.bc_base.presenter

import com.bc_chat.bc_base.contract.WalletContract
import com.bc_chat.bc_base.entity.wallet.WalletEntity
import com.bc_chat.bc_base.task.WalletTask
import com.zhaohaoting.framework.abs.presenter.BasePresenter
import com.zhaohaoting.framework.requset.NetWorkCallBack

/**
 * author：Created by zhaohaoting on 2019/7/19
 * email：526309416@qq.com
 * desc：
 */
class WalletPresenter<VIEW : WalletContract.View>(view: VIEW) : BasePresenter<VIEW>(view), WalletContract.Presenter {

    override fun getAccountMoney() {
        taskHelper.execute<Any>(WalletTask(), object : NetWorkCallBack<WalletEntity>() {
            override fun onPreExecute(task: Any?) {
                super.onPreExecute(task)
                view.showLoading(task)
            }

            override fun onPostExecuteSuccess(task: Any?, data: WalletEntity?) {
                view.dismissLoading(task)
                view.getAccountMoneySuccess(data);
            }

            override fun onPostExecuteFailure(task: Any?, exception: Exception?) {
                super.onPostExecuteFailure(task, exception)
                view.dismissLoading(task)
                view.getAccountMoneyFailure(exception)
            }
        })
    }

}
