Commit 31d876fc authored by mengcuiguang2's avatar mengcuiguang2

添加支付宝小程序跳转,添加支付宝渠道

parent 87f5c72d
...@@ -10,8 +10,8 @@ android { ...@@ -10,8 +10,8 @@ android {
applicationId "com.duben.speedplayletu" applicationId "com.duben.speedplayletu"
minSdkVersion rootProject.ext.androidMinSdkVersion minSdkVersion rootProject.ext.androidMinSdkVersion
targetSdkVersion rootProject.ext.androidTargetSdkVersion targetSdkVersion rootProject.ext.androidTargetSdkVersion
versionCode 712 versionCode 713
versionName "7.1.2" versionName "7.1.3"
flavorDimensions "default" flavorDimensions "default"
// dex突破65535的限制 // dex突破65535的限制
......
...@@ -33,6 +33,7 @@ public class VipBean implements Serializable { ...@@ -33,6 +33,7 @@ public class VipBean implements Serializable {
private String title; private String title;
private String topTitle; private String topTitle;
private String buttonText; private String buttonText;
private int payToModel;//0 app内部,1.只签约转支付宝浏览器支付 2.带uid转支付宝小程序(暂定只有一个小程序)
public String getButtonText() { public String getButtonText() {
return buttonText; return buttonText;
...@@ -113,5 +114,13 @@ public class VipBean implements Serializable { ...@@ -113,5 +114,13 @@ public class VipBean implements Serializable {
public int getTrial() { public int getTrial() {
return trial; return trial;
} }
public int getPayToModel() {
return payToModel;
}
public void setPayToModel(int payToModel) {
this.payToModel = payToModel;
}
} }
} }
...@@ -40,6 +40,7 @@ import com.jobo.wxpay.WXPay ...@@ -40,6 +40,7 @@ import com.jobo.wxpay.WXPay
import com.jobo.wxpay.WXPayInfoImpl import com.jobo.wxpay.WXPayInfoImpl
import com.youth.banner.listener.OnPageChangeListener import com.youth.banner.listener.OnPageChangeListener
import kotlinx.android.synthetic.main.activity_new_vip.* import kotlinx.android.synthetic.main.activity_new_vip.*
import java.net.URLEncoder
/** /**
...@@ -226,8 +227,23 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -226,8 +227,23 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
return return
} }
if (vipList != null && vipList!!.size > 0) {
val vipBean = vipList!![vipAdapter.getPosition()]
val payToModel=vipBean.payToModel
//0 app内部,1.只签约转支付宝浏览器支付 2.带uid转支付宝小程序(暂定只有一个小程序)
when(payToModel){
0 ->{
alipay(paramsBean) alipay(paramsBean)
} }
1 ->{
openAutoAlipay(paramsBean.params.params)
}
2 ->{
openAlipayApp()
}
}
}
}
} }
} }
...@@ -442,18 +458,6 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -442,18 +458,6 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
} }
fun alipay(wxParanBean: WxPayParamBean) { fun alipay(wxParanBean: WxPayParamBean) {
try {
// 自动签约付费
if (wxParanBean.params.isSign) {
AppConfig.enterAlipay = true
openAutoAlipay(wxParanBean.params.params)
return
}
} catch (e: Exception) {
e.printStackTrace()
}
//实例化支付宝支付策略 //实例化支付宝支付策略
val aliPay = AliPay() val aliPay = AliPay()
//构造支付宝订单实体。一般都是由服务端直接返回。 //构造支付宝订单实体。一般都是由服务端直接返回。
...@@ -520,6 +524,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -520,6 +524,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
* 自动续费 * 自动续费
*/ */
fun openAutoAlipay(url: String) { fun openAutoAlipay(url: String) {
AppConfig.enterAlipay = true
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent) startActivity(intent)
} }
...@@ -764,4 +769,24 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -764,4 +769,24 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}) })
timer!!.start() timer!!.start()
} }
/**
* 跳转支付宝小程序
*/
private fun openAlipayApp() {
AppConfig.enterAlipay = true
try {
val alipayAppId = "2021004157617228"
val path = "app_uid=" + UserManager.getInstance().userID//这里是传的参数
val link = URLEncoder.encode(path, "UTF-8")//这里是encode传的参数
val url =
// "alipays://platformapi/startapp?appId=2021004129666486&page=pages/loading&query=" + link
"alipays://platformapi/startapp?appId=" + alipayAppId + "&page=pages/loading&query=" + link
val uri = Uri.parse(url) // url为你要链接的地址
val intent = Intent(Intent.ACTION_VIEW, uri)
startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
}
}
} }
\ No newline at end of file
...@@ -149,21 +149,21 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -149,21 +149,21 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
private fun loginStatus(consumer: UserBean) { private fun loginStatus(consumer: UserBean) {
// 1-匹配用户 // 1-匹配用户
if (consumer.activiteFlag == 1) { // if (consumer.activiteFlag == 1) {
// 匹配 // // 匹配
ll_my_vip.visibility = View.VISIBLE // ll_my_vip.visibility = View.VISIBLE
ll_my_payrecord.visibility = View.VISIBLE // ll_my_payrecord.visibility = View.VISIBLE
ll_contactus.visibility = View.VISIBLE // ll_contactus.visibility = View.VISIBLE
line_my_payrecord.visibility = View.VISIBLE // line_my_payrecord.visibility = View.VISIBLE
line_my_contactus.visibility = View.VISIBLE // line_my_contactus.visibility = View.VISIBLE
} else { // } else {
// 未匹配 // // 未匹配
ll_my_vip.visibility = View.GONE // ll_my_vip.visibility = View.GONE
ll_my_payrecord.visibility = View.GONE // ll_my_payrecord.visibility = View.GONE
ll_contactus.visibility = View.GONE // ll_contactus.visibility = View.GONE
line_my_payrecord.visibility = View.GONE // line_my_payrecord.visibility = View.GONE
line_my_contactus.visibility = View.GONE // line_my_contactus.visibility = View.GONE
} // }
// 2-是否有手机号 // 2-是否有手机号
if (!TextUtils.isEmpty(userManager.mobile)) { if (!TextUtils.isEmpty(userManager.mobile)) {
......
...@@ -95,8 +95,7 @@ ...@@ -95,8 +95,7 @@
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="@mipmap/bg_my_vip" android:background="@mipmap/bg_my_vip"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="24dp" android:paddingLeft="24dp">
android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_my_vip" android:id="@+id/tv_my_vip"
...@@ -241,8 +240,7 @@ ...@@ -241,8 +240,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="15dp" android:paddingEnd="15dp">
android:visibility="gone">
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
...@@ -305,8 +303,7 @@ ...@@ -305,8 +303,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="15dp" android:paddingEnd="15dp">
android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_contact" android:id="@+id/tv_contact"
......
...@@ -44,7 +44,7 @@ WEIXIN_APP_SECRET =c7ae162c83efbb8449d576fa9b85a07e ...@@ -44,7 +44,7 @@ WEIXIN_APP_SECRET =c7ae162c83efbb8449d576fa9b85a07e
RELEASE_UMENG_KEY=64b8de13a1a164591b5133df RELEASE_UMENG_KEY=64b8de13a1a164591b5133df
#TalkingData #TalkingData
RELEASE_TALKING_DATA_KEY="3510E9DDC0E74A44A2BBA904A8345918 " RELEASE_TALKING_DATA_KEY="3510E9DDC0E74A44A2BBA904A8345918"
GROMORE_APP_ID="5566629" GROMORE_APP_ID="5566629"
......
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