MuseHttp.kt 912 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
package com.yidianling.home.http

import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.muse.bean.MuseModuleBean
import io.reactivex.Observable

/**
 * @author jiucheng
 * @描述:首页接口实现类
 * @Copyright Copyright (c) 2018
 * @Company 壹点灵
 * @date 2018/8/22
 */
class MuseHttp {

    companion object {
        fun getInstance(): MuseHttp {
            return Holder.INSTANCE
        }
    }

    object Holder {
        val INSTANCE = MuseHttp()
    }

    private var museApi: MusePagerApi? = null

    private fun getMusePagerApi(): MusePagerApi {
        if (museApi == null) {
            museApi = YDLHttpUtils.obtainApi(MusePagerApi::class.java)
        }
        return museApi!!
    }

    //壹点冥想
    fun newMuseRequest(): Observable<BaseAPIResponse<MuseModuleBean>> {
        return getMusePagerApi().getMuseData()
    }
}