package com.zxhl.main.page.view

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.cms.net.model.chat.OneChatUpEntity


class AccostPresenter : AccostContract.Presenter {
    private val mView: AccostContract.View


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

    override fun onClickChatUp(ids:String) {
        ApiClient.homeApi.oneclickChatUp(ids)
            .compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<OneChatUpEntity>() {
                override fun onSuccess(result: OneChatUpEntity?) {
                    mView.chatUpfinish(result)
                }

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

}