package cn.flightfeather.thirdapp.repository
|
|
import cn.flightfeather.thirdapp.bean.entity.Userinfo
|
import cn.flightfeather.thirdapp.common.net.ResponseBodyCallBack
|
import cn.flightfeather.thirdapp.common.net.ResultCallBack
|
import cn.flightfeather.thirdapp.common.net.RetrofitFactory
|
import cn.flightfeather.thirdapp.httpservice.UserInfoService
|
|
/**
|
* @author riku
|
* Date: 2021/7/21
|
*/
|
class UserInfoRepository private constructor(){
|
|
companion object {
|
@JvmStatic
|
val instance: UserInfoRepository by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { UserInfoRepository()}
|
}
|
|
private val retrofit = RetrofitFactory.instance.retrofit
|
|
/**
|
* 自动创建监管场景账户
|
* @param sceneId 场景id
|
*/
|
fun createAccount(sceneId: String, resultCallBack: ResultCallBack<Userinfo>) {
|
retrofit.create(UserInfoService::class.java).createAccount(sceneId)
|
.enqueue(ResponseBodyCallBack(resultCallBack))
|
}
|
|
/**
|
* 获取场景对应的账户信息
|
* @param sceneId 场景id
|
*/
|
fun getByScene(sceneId: String, resultCallBack: ResultCallBack<Userinfo?>) {
|
retrofit.create(UserInfoService::class.java).getByScene(sceneId)
|
.enqueue(ResponseBodyCallBack(resultCallBack))
|
}
|
}
|