Commit 88657f98 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent bf0bf08a
...@@ -18,6 +18,7 @@ public class UserBean implements Serializable { ...@@ -18,6 +18,7 @@ public class UserBean implements Serializable {
private int activiteFlag=0;// 1-匹配用户 private int activiteFlag=0;// 1-匹配用户
private String openid; private String openid;
private boolean isForever;//true-永久会员 private boolean isForever;//true-永久会员
private boolean alipaySet;//支付宝授权
private long expireTime;// vip到期时间 0-非vip private long expireTime;// vip到期时间 0-非vip
private long pk_id;// 用户id private long pk_id;// 用户id
private long createTime;// 用户id private long createTime;// 用户id
...@@ -97,4 +98,12 @@ public class UserBean implements Serializable { ...@@ -97,4 +98,12 @@ public class UserBean implements Serializable {
public int getActiviteFlag() { public int getActiviteFlag() {
return activiteFlag; return activiteFlag;
} }
public boolean isAlipaySet() {
return alipaySet;
}
public void setAlipaySet(boolean alipaySet) {
this.alipaySet = alipaySet;
}
} }
...@@ -74,6 +74,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -74,6 +74,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
} }
var timer: CountDownTimerSupport? = null var timer: CountDownTimerSupport? = null
var userBean: UserBean? = null
private var breathAnim: YoYo.YoYoString? = null private var breathAnim: YoYo.YoYoString? = null
private var payAgreementDialog: PayAgreementDialog? = null private var payAgreementDialog: PayAgreementDialog? = null
...@@ -87,7 +88,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -87,7 +88,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
private var isGuide: Boolean = false// 从启动页进入vip界面,返回时要回到首页 private var isGuide: Boolean = false// 从启动页进入vip界面,返回时要回到首页
private var isMain: Boolean = false private var isMain: Boolean = false
private var isRecommend: Boolean = false private var isRecommend: Boolean = false
private var payType = WEIXIN_PAY// 支付类型 private var payType = ALIPAY// 支付类型
private var vedioId = "" private var vedioId = ""
private var thirdId = "" private var thirdId = ""
...@@ -235,10 +236,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -235,10 +236,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
return return
} }
if (true) { // 授权 支付
if (userBean?.isAlipaySet!!) {
alipay(paramsBean) alipay(paramsBean)
} else { } else {
alipayDialog(paramsBean) alipayLoginDialog(paramsBean)
} }
} }
} }
...@@ -272,6 +274,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -272,6 +274,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
} }
override fun getUserSuc(data: UserBean) { override fun getUserSuc(data: UserBean) {
this.userBean = data
if (data.expireTime > 0) { if (data.expireTime > 0) {
readyGo(MainActivity::class.java) readyGo(MainActivity::class.java)
val activity = val activity =
...@@ -801,11 +804,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -801,11 +804,11 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}) })
} }
private fun alipayDialog(wxParanBean: WxPayParamBean) { private fun alipayLoginDialog(wxParanBean: WxPayParamBean) {
DialogUtils.showDialog( DialogUtils.showDialog(
this, this,
SpanUtils() SpanUtils()
.append("请使用支付宝登录") .append("请使用支付宝登录")
.setForegroundColor(ContextCompat.getColor(this, R.color.main_mints)) .setForegroundColor(ContextCompat.getColor(this, R.color.main_mints))
.create(), .create(),
"提示", "提示",
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:id="@+id/ll_vip_wx" android:id="@+id/ll_vip_alipay"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_weight="1" android:layout_weight="1"
...@@ -161,17 +161,16 @@ ...@@ -161,17 +161,16 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableLeft="@mipmap/ic_call_wx" android:drawableLeft="@mipmap/ic_alipay"
android:drawablePadding="6dp" android:drawablePadding="6dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="微信支付" android:text="支付宝支付"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView <ImageView
android:id="@+id/iv_vip_wx" android:id="@+id/iv_vip_alipay"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:scaleType="center" android:scaleType="center"
...@@ -179,7 +178,7 @@ ...@@ -179,7 +178,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/ll_vip_alipay" android:id="@+id/ll_vip_wx"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_weight="1" android:layout_weight="1"
...@@ -190,16 +189,17 @@ ...@@ -190,16 +189,17 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableLeft="@mipmap/ic_alipay" android:drawableLeft="@mipmap/ic_call_wx"
android:drawablePadding="6dp" android:drawablePadding="6dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="支付宝支付" android:text="微信支付"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<ImageView <ImageView
android:id="@+id/iv_vip_alipay" android:id="@+id/iv_vip_wx"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:scaleType="center" android:scaleType="center"
...@@ -207,6 +207,8 @@ ...@@ -207,6 +207,8 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView
......
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