package com.zxbw.modulemain.presenter

import android.content.Context
import android.text.TextUtils
import android.util.Log
import com.zxbw.modulemain.contract.HomeRecommendContract
import com.zxbw.modulemain.contract.LoginContract
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.SettingPreference
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.qy.JgqQyEntity
import com.zxhl.cms.net.model.uc.UserInfo
import com.zxhl.cms.utils.EventUtils
import com.zxhl.cms.utils.UserDataUtils

/**
 * 推荐
 */
class HomeRecommendPresenter:HomeRecommendContract.Presenter {

    private val mView: HomeRecommendContract.View

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

    override fun getQyCardList() {
        ApiClient.homeApi.getQyJgqCardList().compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<List<JgqQyEntity>>() {
                override fun onSuccess(result: List<JgqQyEntity>?) {
                    if(!result.isNullOrEmpty()){
                        mView.setQyCardList(result)
                    }
                }

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

                }
            })
    }
}