Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
e853fb0e
Commit
e853fb0e
authored
Aug 16, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
8175cb30
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
72 deletions
+106
-72
VipBean.java
.../main/java/com/duben/speedplayletu/mvp/model/VipBean.java
+15
-0
VipPresenter.kt
...va/com/duben/speedplayletu/mvp/presenters/VipPresenter.kt
+2
-2
VipView.kt
...rc/main/java/com/duben/speedplayletu/mvp/views/VipView.kt
+1
-1
VipActivity.kt
.../java/com/duben/speedplayletu/ui/activitys/VipActivity.kt
+88
-69
No files found.
video/app/src/main/java/com/duben/speedplayletu/mvp/model/VipBean.java
View file @
e853fb0e
...
...
@@ -35,6 +35,13 @@ public class VipBean implements Serializable {
private
String
buttonText
;
private
int
payToModel
;
//0 app内部,1.只签约转支付宝浏览器支付 2.带uid转支付宝小程序(暂定只有一个小程序)
//带uid转支付宝小程序 第一个小程序
private
String
payToModel2FirstAlipayAppid
;
//带uid转支付宝小程序 挽留用的第二个小程序
private
String
payToModel2SecondAlipayAppid
;
public
String
getButtonText
()
{
return
buttonText
;
}
...
...
@@ -122,5 +129,13 @@ public class VipBean implements Serializable {
public
void
setPayToModel
(
int
payToModel
)
{
this
.
payToModel
=
payToModel
;
}
public
String
getPayToModel2FirstAlipayAppid
()
{
return
payToModel2FirstAlipayAppid
;
}
public
String
getPayToModel2SecondAlipayAppid
()
{
return
payToModel2SecondAlipayAppid
;
}
}
}
video/app/src/main/java/com/duben/speedplayletu/mvp/presenters/VipPresenter.kt
View file @
e853fb0e
...
...
@@ -182,7 +182,7 @@ class VipPresenter : BasePresenter<VipView>() {
})
}
fun
getVipPayParams
(
payChannel
:
String
,
pid
:
String
,
isInstallAlipay
:
Boolean
)
{
fun
getVipPayParams
(
payChannel
:
String
,
pid
:
String
,
isInstallAlipay
:
Boolean
,
enter
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
// vo["payChannel"] = payChannel
vo
[
"payChannel"
]
=
"ALIPAY"
...
...
@@ -207,7 +207,7 @@ class VipPresenter : BasePresenter<VipView>() {
val
code
:
Int
=
baseResponse
.
getStatus
()
when
(
code
)
{
200
->
{
view
.
getVipPayParamsSuc
(
"ALIPAY"
,
baseResponse
.
data
)
view
.
getVipPayParamsSuc
(
"ALIPAY"
,
baseResponse
.
data
,
enter
)
}
else
->
{
view
.
showToast
(
baseResponse
.
getMessage
())
...
...
video/app/src/main/java/com/duben/speedplayletu/mvp/views/VipView.kt
View file @
e853fb0e
...
...
@@ -7,7 +7,7 @@ import com.duben.speedplayletu.mvp.model.WxPayParamBean
interface
VipView
:
BaseView
{
fun
getVipProductSuc
(
data
:
VipBean
)
fun
getVipPayParamsSuc
(
payChannel
:
String
,
data
:
WxPayParamBean
)
fun
getVipPayParamsSuc
(
payChannel
:
String
,
data
:
WxPayParamBean
,
enter
:
String
)
fun
queryVipOrderSuc
(
isPay
:
Boolean
)
fun
getUserSuc
(
data
:
UserBean
)
...
...
video/app/src/main/java/com/duben/speedplayletu/ui/activitys/VipActivity.kt
View file @
e853fb0e
...
...
@@ -63,6 +63,8 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
const
val
ALIPAY
=
"ALIPAY"
const
val
THIRD_ID
=
"THIRD_ID"
const
val
VEDIO_ID
=
"VEDIO_ID"
const
val
ENTER_TYPE_DIALOG
=
"ENTER_TYPE_DIALOG"
const
val
ENTER_TYPE_ACTIVITY
=
"ENTER_TYPE_ACTIVITY"
}
var
timer
:
CountDownTimerSupport
?
=
null
...
...
@@ -214,7 +216,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
}
}
override
fun
getVipPayParamsSuc
(
payChannel
:
String
,
paramsBean
:
WxPayParamBean
)
{
override
fun
getVipPayParamsSuc
(
payChannel
:
String
,
paramsBean
:
WxPayParamBean
,
enter
:
String
)
{
if
(!
isFinishing
)
{
if
(
TextUtils
.
equals
(
payChannel
,
"WEIXIN"
))
{
if
(
paramsBean
.
params
==
null
)
{
...
...
@@ -231,17 +233,21 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(
vipList
!=
null
&&
vipList
!!
.
size
>
0
)
{
val
vipBean
=
vipList
!!
[
vipAdapter
.
getPosition
()]
val
payToModel
=
vipBean
.
payToModel
val
payToModel
=
vipBean
.
payToModel
//0 app内部,1.只签约转支付宝浏览器支付 2.带uid转支付宝小程序(暂定只有一个小程序)
when
(
payToModel
)
{
0
->{
when
(
payToModel
)
{
0
->
{
alipay
(
paramsBean
)
}
1
->{
1
->
{
openAutoAlipay
(
paramsBean
.
params
.
params
)
}
2
->{
openAlipayApp
()
2
->
{
if
(
TextUtils
.
equals
(
ENTER_TYPE_ACTIVITY
,
enter
))
{
openAlipayApp
(
vipBean
.
payToModel2FirstAlipayAppid
)
}
else
{
openAlipayApp
(
vipBean
.
payToModel2SecondAlipayAppid
)
}
}
}
}
...
...
@@ -358,12 +364,14 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
}
...
...
@@ -557,12 +565,15 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
)
}
}
else
{
...
...
@@ -610,12 +621,14 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
...
...
@@ -659,12 +672,14 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
if
(
TextUtils
.
equals
(
payType
,
WEIXIN_PAY
))
{
vipPresenter
.
getVipPayParams
(
"WEIXIN"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
else
if
(
TextUtils
.
equals
(
payType
,
ALIPAY
))
{
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_ACTIVITY
)
}
}
...
...
@@ -740,7 +755,8 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
vipPresenter
.
getVipPayParams
(
"ALIPAY"
,
vipBean
.
pid
,
isAliPayInstalled
()
vipBean
.
pid
,
isAliPayInstalled
(),
ENTER_TYPE_DIALOG
)
}
})
...
...
@@ -775,11 +791,12 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
/**
* 跳转支付宝小程序
*/
private
fun
openAlipayApp
()
{
private
fun
openAlipayApp
(
alipayAppId
:
String
)
{
AppConfig
.
enterAlipay
=
true
try
{
val
alipayAppId
=
"2021004157617228"
val
path
=
"app_uid="
+
UserManager
.
getInstance
().
userID
+
"&package_app="
+
Constant
.
MINTS_PKG_NAME
//这里是传的参数
val
path
=
"app_uid="
+
UserManager
.
getInstance
().
userID
+
"&package_app="
+
Constant
.
MINTS_PKG_NAME
//这里是传的参数
val
link
=
URLEncoder
.
encode
(
path
,
"UTF-8"
)
//这里是encode传的参数
val
url
=
// "alipays://platformapi/startapp?appId=2021004129666486&page=pages/loading&query=" + link
...
...
@@ -799,8 +816,10 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
val
api
:
IWXAPI
=
WXAPIFactory
.
createWXAPI
(
context
,
appId
)
val
req
=
WXLaunchMiniProgram
.
Req
()
req
.
userName
=
"gh_439c32026e1b"
// 填小程序原始id
req
.
path
=
"/pages/loading?testApp1=mcg1&testApp2=mcg2"
////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
req
.
miniprogramType
=
WXLaunchMiniProgram
.
Req
.
MINIPTOGRAM_TYPE_RELEASE
// 可选打开 开发版,体验版和正式版
req
.
path
=
"/pages/loading?testApp1=mcg1&testApp2=mcg2"
////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
req
.
miniprogramType
=
WXLaunchMiniProgram
.
Req
.
MINIPTOGRAM_TYPE_RELEASE
// 可选打开 开发版,体验版和正式版
api
.
sendReq
(
req
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment