Commit 2c6730bc authored by mengcuiguang's avatar mengcuiguang

0元支付宝签约成功后逻辑优化

parent 292f3144
......@@ -66,7 +66,6 @@ android {
buildConfigField "String", "GROMORE_VIDEO_CODE", GROMORE_VIDEO_CODE
buildConfigField "String", "GROMORE_DRAW_CODE", GROMORE_DRAW_CODE
buildConfigField "String", "GROMORE_EXPRESS_CODE", GROMORE_EXPRESS_CODE
buildConfigField "String", "GROMORE_MAIN_EXPRESS_CODE", GROMORE_MAIN_EXPRESS_CODE
buildConfigField "String", "GROMORE_BANNER_CODE", GROMORE_BANNER_CODE
buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID
buildConfigField "String", "RELEASE_TALKING_DATA_KEY", RELEASE_TALKING_DATA_KEY
......@@ -90,7 +89,6 @@ android {
buildConfigField "String", "GROMORE_VIDEO_CODE", GROMORE_VIDEO_CODE
buildConfigField "String", "GROMORE_DRAW_CODE", GROMORE_DRAW_CODE
buildConfigField "String", "GROMORE_EXPRESS_CODE", GROMORE_EXPRESS_CODE
buildConfigField "String", "GROMORE_MAIN_EXPRESS_CODE", GROMORE_MAIN_EXPRESS_CODE
buildConfigField "String", "GROMORE_BANNER_CODE", GROMORE_BANNER_CODE
buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID
buildConfigField "String", "RELEASE_TALKING_DATA_KEY", RELEASE_TALKING_DATA_KEY
......
......@@ -209,4 +209,42 @@ class VipPresenter : BasePresenter<VipView>() {
}
})
}
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.VipBean
import com.duben.xixifree.mvp.model.WxPayParamBean
......@@ -7,4 +8,6 @@ interface VipView : BaseView {
fun getVipProductSuc(data: VipBean)
fun getVipPayParamsSuc(payChannel:String,data: WxPayParamBean)
fun queryVipOrderSuc(isPay:Boolean)
fun getUserSuc(data: UserBean)
}
\ No newline at end of file
......@@ -32,6 +32,7 @@ import com.duben.xixifree.ui.activitys.base.BaseActivity
import com.duben.xixifree.ui.adapter.VipAdapter
import com.duben.xixifree.ui.widgets.*
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.xixifree.mvp.model.UserBean
import com.duben.xixifree.utils.AppPreferencesManager
import kotlinx.android.synthetic.main.activity_vip.*
import kotlinx.android.synthetic.main.header_layout.*
......@@ -64,6 +65,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
private var vipList: MutableList<VipBean.ListBean>? = null
private var isCheckAgreeFlag: Boolean = true
private var isGuide: Boolean = false// 从启动页进入vip界面,返回时要回到首页
private var isClickAlipayZero: Boolean = false// 是否点击0元支付宝
private var payType = ALIPAY// 支付类型
private var vedioId = ""
private var thirdId = ""
......@@ -97,6 +99,14 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
initListener()
}
override fun onResume() {
super.onResume()
if (isClickAlipayZero) {
isClickAlipayZero = false
vipPresenter.getMyInfo()
}
}
override fun finish() {
super.finish()
//关闭窗体动画显示
......@@ -135,14 +145,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
private fun setVipContent(bean: VipBean.ListBean) {
if (bean.trial == 0) {
//0-没签约 无0.01
ll_vip_alipay.visibility = View.GONE
ll_vip_wx.visibility = View.VISIBLE
payType = WEIXIN_PAY
iv_vip_wx.setImageResource(R.mipmap.ic_vip_enable_blue)
iv_vip_alipay.setImageResource(R.mipmap.ic_vip_none)
}else{
} else {
ll_vip_alipay.visibility = View.VISIBLE
ll_vip_wx.visibility = View.GONE
payType = ALIPAY
......@@ -218,6 +226,23 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
}
}
override fun getUserSuc(data: UserBean) {
if (isFinishing) return
if (data.expireTime > 0) {
UserManager.getInstance().vipFlag = true
showToast("支付成功")
if (!UserManager.getInstance().userIsLogin()) {
val b = Bundle()
b.putString(MobileLoginActivity.TYPE, "vip")
readyGoThenKill(MobileLoginActivity::class.java, b)
} else {
readyGoThenKill(MainActivity::class.java)
}
}
}
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
when (keyCode) {
KeyEvent.KEYCODE_BACK -> {
......@@ -294,7 +319,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
vipBean.pid, isAliPayInstalled()
)
} else if (TextUtils.equals(payType, ALIPAY)) {
if(!isAliPayInstalled()){
if (!isAliPayInstalled()) {
showToast("请安装支付宝")
return
}
......@@ -410,6 +435,8 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
try {
// 自动签约付费
if (wxParanBean.params.isSign) {
isClickAlipayZero = true
openAutoAlipay(wxParanBean.params.params)
}
} catch (e: Exception) {
......@@ -500,7 +527,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
vipBean.pid, isAliPayInstalled()
)
} else if (TextUtils.equals(payType, ALIPAY)) {
if(!isAliPayInstalled()){
if (!isAliPayInstalled()) {
showToast("请安装支付宝")
return
}
......@@ -558,7 +585,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
vipBean.pid, isAliPayInstalled()
)
} else if (TextUtils.equals(payType, ALIPAY)) {
if(!isAliPayInstalled()){
if (!isAliPayInstalled()) {
showToast("请安装支付宝")
return
}
......@@ -612,7 +639,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, VipAdapter.On
vipBean.pid, isAliPayInstalled()
)
} else if (TextUtils.equals(payType, ALIPAY)) {
if(!isAliPayInstalled()){
if (!isAliPayInstalled()) {
showToast("请安装支付宝")
return
}
......
......@@ -44,14 +44,12 @@ WEIXIN_APP_SECRET =93add1e49825bd4992ba8b6792630a7d
RELEASE_UMENG_KEY=64b8de13a1a164591b5133df
#TalkingData
RELEASE_TALKING_DATA_KEY="2E0D42A54FCD4C059EAF9EFDDEA9FBCE"
RELEASE_TALKING_DATA_KEY="15DEBB2C366A4911A0BA5326A071B579"
GROMORE_APP_ID="5423461"
GROMORE_SPLASH_CODE="102418768"
GROMORE_VIDEO_CODE="102418861"
GROMORE_EXPRESS_CODE="102419307"
GROMORE_MYEXPRESS_CODE="102418862"
GROMORE_MAIN_EXPRESS_CODE="102413160"
GROMORE_DRAW_CODE="102418862"
GROMORE_BANNER_CODE="102418767"
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