Commit 70d24aa5 authored by mengcuiguang's avatar mengcuiguang

优化九宫格支付状态

parent bd0ca0f6
......@@ -12,8 +12,8 @@ android {
applicationId "com.duben.xixifree"
minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 17
versionName "1.1.6"
versionCode 18
versionName "1.1.7"
flavorDimensions "default"
// dex突破65535的限制
......
......@@ -6,6 +6,7 @@ import com.duben.xixifree.mvp.model.WxPayParamBean
import com.duben.xixifree.mvp.views.NinePayView
import com.duben.library.net.neterror.BaseSubscriber
import com.duben.library.net.neterror.Throwable
import com.duben.xixifree.mvp.model.UserBean
import java.util.HashMap
class NinePayPresenter : BasePresenter<NinePayView>() {
......@@ -93,6 +94,42 @@ class NinePayPresenter : BasePresenter<NinePayView>() {
}
})
}
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 -> {
view.getUserSuc(baseResponse.data)
}
else -> {
view.showToast(message)
}
}
}
})
}
}
\ No newline at end of file
package com.duben.xixifree.mvp.views
import com.duben.xixifree.mvp.model.UserBean
import com.duben.xixifree.mvp.model.WxPayParamBean
interface NinePayView : BaseView{
fun getVipPayParamsSuc(payChannel:String,data: WxPayParamBean)
fun getUserSuc(data: UserBean)
fun queryVipOrderSuc(isPay:Boolean)
}
......@@ -301,7 +301,7 @@ class NineActivity : BaseActivity(), View.OnClickListener, NineView {
nineShowBean?.let {
NineContinueDialog(
this@NineActivity,
it.need - it.complete - 1,
it.need - it.complete,
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
......
......@@ -18,6 +18,7 @@ import com.duben.xixifree.mvp.presenters.NinePayPresenter
import com.duben.xixifree.mvp.views.NinePayView
import com.duben.xixifree.ui.activitys.base.BaseActivity
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.xixifree.mvp.model.UserBean
import kotlinx.android.synthetic.main.activity_nine_pay.*
/**
......@@ -36,6 +37,7 @@ class NinePayActivity : BaseActivity(), View.OnClickListener, NinePayView {
private var pid = ""
private var title = ""
private var type = ""
private var isClickAlipayZero: Boolean = false
override fun isApplyKitKatTranslucency() = false
......@@ -70,6 +72,14 @@ class NinePayActivity : BaseActivity(), View.OnClickListener, NinePayView {
}
}
override fun onResume() {
super.onResume()
if (isClickAlipayZero) {
isClickAlipayZero = false
ninePayPresenter.getMyInfo()
}
}
override fun finish() {
super.finish()
overridePendingTransition(0, R.anim.scale_out)
......@@ -98,6 +108,17 @@ class NinePayActivity : BaseActivity(), View.OnClickListener, NinePayView {
}
}
override fun getUserSuc(data: UserBean) {
if (isFinishing) return
if (data.expireTime > 0) {
UserManager.getInstance().vipFlag = true
showToast("支付成功")
finish()
}
}
override fun getVipPayParamsSuc(payChannel: String, paramsBean: WxPayParamBean) {
if (!isFinishing) {
if (paramsBean.params == null) {
......@@ -113,6 +134,7 @@ class NinePayActivity : BaseActivity(), View.OnClickListener, NinePayView {
try {
// 自动签约付费
if (wxParanBean.params.isSign) {
isClickAlipayZero = true
openAutoAlipay(wxParanBean.params.params)
return
}
......
......@@ -385,7 +385,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
nineShowBean?.let {
NineContinueDialog(
requireActivity(),
it.need - it.complete - 1,
it.need - it.complete,
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
......
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