package com.zxhl.main.page.presenter


import android.util.Log
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.main.page.contract.LogisticsContract

class LogisticsPresenter : LogisticsContract.Presenter {
    private val mView: LogisticsContract.View


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

    override fun feedback(content: String, mobile: String) {
        ApiClient.homeApi.feedBack(content, mobile)
            .compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<Any>() {
                override fun onSuccess(result: Any?) {
                    if (result != null) {
                        mView.postSuc("成功")
                    }
                }

                override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
                    mView.PostFail()
                    Log.e("MXL", "ERROR" + code + errorMsg + e)
                }
            })
    }
}