Commit 8a9b5254 authored by mengcuiguang's avatar mengcuiguang

更新个人信息接口

parent 8ad0271a
......@@ -277,4 +277,42 @@ class HomePresenter : BasePresenter<HomeView>() {
}
})
}
fun getMyInfo() {
val vo = HashMap<String, Any>()
vo["os"] = "android"
AppHttpManager.getInstance(loanApplication)
.call(loanService.getMyInfo(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() {
override fun onCompleted() {
if (isLinkView)
return
view.hideLoading()
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
if (isLinkView) return
val code: Int = baseResponse.status
val message: String = baseResponse.message
when (code) {
200 -> {
UserManager.getInstance().saveUserInfo(baseResponse.data)
}
else -> {
view.showToast(message)
}
}
}
})
}
}
\ No newline at end of file
......@@ -129,6 +129,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
//获取游客登录数据
homePresenter.userLogin()
} else {
homePresenter.getMyInfo()
homePresenter.topTabs()
homePresenter.orders()
TrackManager.getInstance().getMyInfo()
......
......@@ -10,14 +10,22 @@ import com.google.android.material.tabs.TabLayoutMediator
import com.xinfu.helivideo.R
import com.xinfu.helivideo.common.AppConfig
import com.xinfu.helivideo.common.Constant
import com.xinfu.helivideo.manager.AppHttpManager
import com.xinfu.helivideo.manager.UserManager
import com.xinfu.helivideo.mvp.model.BaseResponse
import com.xinfu.helivideo.mvp.model.OrderRecordBean
import com.xinfu.helivideo.mvp.model.UserBean
import com.xinfu.helivideo.ui.activitys.MainActivity
import com.xinfu.helivideo.ui.adapter.RecommendPageAdapter
import com.xinfu.helivideo.ui.fragment.base.BaseFragment
import com.xinfu.helivideo.video.csj.DramaTabFragment
import com.xinfu.helivideo.video.tx.TxVideoFragment
import com.xinfu.library.net.neterror.BaseSubscriber
import com.xinfu.library.net.neterror.Throwable
import com.xinfu.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_order_record.*
import kotlinx.android.synthetic.main.fragment_recommend.*
import kotlinx.android.synthetic.main.header_layout.*
/**
* @author Assen
......@@ -147,9 +155,29 @@ class RecommendFragment : BaseFragment(), View.OnClickListener {
// 重置状态
initVp2()
}
getData()
}
}
private fun getData() {
val vo = HashMap<String, Any>()
vo["os"] = "android"
AppHttpManager.getInstance(baseApplication)
.call(baseApplication.loanService.getMyInfo(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() {
override fun onError(e: Throwable) {
}
override fun onNext(t: BaseResponse<UserBean>) {
if (t.status == 200) {
UserManager.getInstance().saveUserInfo(t.data)
}
}
})
}
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment