Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
X
xxsq
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
xxsq
Commits
7aa50b05
Commit
7aa50b05
authored
Aug 01, 2022
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :1.1.5 [实现方案] :加入杉德支付
parent
4f793565
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
45 changed files
with
1242 additions
and
289 deletions
+1242
-289
build.gradle
app/build.gradle
+1
-0
version.properties
app/version.properties
+2
-2
build.gradle
cms/build.gradle
+2
-0
paytypelibrary3.5.2.aar
cms/libs/paytypelibrary3.5.2.aar
+0
-0
NetConfig.java
cms/src/main/java/com/zxhl/cms/common/NetConfig.java
+2
-0
IUserInfoApi.java
cms/src/main/java/com/zxhl/cms/net/api/IUserInfoApi.java
+20
-3
H5PayUtil.kt
cms/src/main/java/com/zxhl/cms/pay/H5PayUtil.kt
+187
-2
PayContract.kt
cms/src/main/java/com/zxhl/cms/pay/PayContract.kt
+2
-0
PayDialog.kt
cms/src/main/java/com/zxhl/cms/pay/PayDialog.kt
+21
-0
PayPresenter.kt
cms/src/main/java/com/zxhl/cms/pay/PayPresenter.kt
+54
-1
PaymentConfig.kt
cms/src/main/java/com/zxhl/cms/pay/PaymentConfig.kt
+17
-0
AppUtils.java
cms/src/main/java/com/zxhl/cms/utils/AppUtils.java
+64
-0
ClipboardManagerUtil.kt
cms/src/main/java/com/zxhl/cms/utils/ClipboardManagerUtil.kt
+2
-3
Base64Utils.java
cms/src/main/java/com/zxhl/cms/utils/encry/Base64Utils.java
+268
-0
MD5Utils.java
cms/src/main/java/com/zxhl/cms/utils/encry/MD5Utils.java
+79
-0
RSAUtils.java
cms/src/main/java/com/zxhl/cms/utils/encry/RSAUtils.java
+64
-0
CenterDialog.kt
cms/src/main/java/com/zxhl/cms/widget/CenterDialog.kt
+23
-7
dialog_privacy_protocol_view.xml
cms/src/main/res/layout/dialog_privacy_protocol_view.xml
+2
-7
AndroidManifest.xml
moduleMain/src/main/AndroidManifest.xml
+14
-14
CardDetailActivity.kt
...n/java/com/zxbw/modulemain/activity/CardDetailActivity.kt
+38
-9
OpenMemberActivity.kt
...n/java/com/zxbw/modulemain/activity/OpenMemberActivity.kt
+7
-0
OpenMemberOrderActivity.kt
...a/com/zxbw/modulemain/activity/OpenMemberOrderActivity.kt
+37
-12
RechargeActivity.kt
...ain/java/com/zxbw/modulemain/activity/RechargeActivity.kt
+42
-7
RightsDetailActivity.kt
...java/com/zxbw/modulemain/activity/RightsDetailActivity.kt
+44
-115
ShopOrderActivity.kt
...in/java/com/zxbw/modulemain/activity/ShopOrderActivity.kt
+19
-31
SkillShopActivity.kt
...in/java/com/zxbw/modulemain/activity/SkillShopActivity.kt
+37
-5
TbGoodsDetailActivity.kt
...ava/com/zxbw/modulemain/activity/TbGoodsDetailActivity.kt
+5
-1
ToPaySkillGoodsActivity.kt
...a/com/zxbw/modulemain/activity/ToPaySkillGoodsActivity.kt
+38
-5
HomeBannerAdapter.kt
...ain/java/com/zxbw/modulemain/adapter/HomeBannerAdapter.kt
+9
-0
ItemVipOrderAdapter.kt
...n/java/com/zxbw/modulemain/adapter/ItemVipOrderAdapter.kt
+8
-1
MyOrderAdapter.kt
...c/main/java/com/zxbw/modulemain/adapter/MyOrderAdapter.kt
+1
-0
NewBoxGoodsDetailActivity.kt
...zxbw/modulemain/box/activity/NewBoxGoodsDetailActivity.kt
+5
-0
OrderDetailActivity.kt
...a/com/zxbw/modulemain/box/activity/OrderDetailActivity.kt
+22
-0
CardDetailContract.kt
...n/java/com/zxbw/modulemain/contract/CardDetailContract.kt
+1
-1
RechargeContract.kt
...ain/java/com/zxbw/modulemain/contract/RechargeContract.kt
+1
-0
RightsPayContract.kt
...in/java/com/zxbw/modulemain/contract/RightsPayContract.kt
+1
-1
MagicBoxOrderFragment.kt
...ava/com/zxbw/modulemain/fragment/MagicBoxOrderFragment.kt
+0
-3
CardDetailPresenter.kt
...java/com/zxbw/modulemain/presenter/CardDetailPresenter.kt
+26
-5
HomePresenter.kt
.../main/java/com/zxbw/modulemain/presenter/HomePresenter.kt
+12
-1
RechargePresenter.kt
...n/java/com/zxbw/modulemain/presenter/RechargePresenter.kt
+20
-4
RightsPayPresenter.kt
.../java/com/zxbw/modulemain/presenter/RightsPayPresenter.kt
+18
-22
img_banner_hf_bg.png
moduleMain/src/main/res/drawable-xhdpi/img_banner_hf_bg.png
+0
-0
img_open_vip_top_sh.png
...eMain/src/main/res/drawable-xhdpi/img_open_vip_top_sh.png
+0
-0
AdManager.kt
moduleZxAd/src/main/java/com/zx/ad/AdManager.kt
+1
-20
CSJAdManager.kt
...ZxAd/src/main/java/com/zx/ad/platform/csj/CSJAdManager.kt
+26
-7
No files found.
app/build.gradle
View file @
7aa50b05
...
@@ -86,6 +86,7 @@ android {
...
@@ -86,6 +86,7 @@ android {
mbt
{}
mbt
{}
baichuan
{}
baichuan
{}
huafei_h5
{}
huafei_h5
{}
sh
{}
}
}
productFlavors
.
all
{
productFlavors
.
all
{
...
...
app/version.properties
View file @
7aa50b05
PACKAGE_NAME
=
com.zxhl.shop
PACKAGE_NAME
=
com.zxhl.shop
VERSION_CODE
=
15
VERSION_CODE
=
16
VERSION_NAME
=
1.1.4
VERSION_NAME
=
1.1.5
\ No newline at end of file
\ No newline at end of file
cms/build.gradle
View file @
7aa50b05
...
@@ -85,6 +85,8 @@ dependencies {
...
@@ -85,6 +85,8 @@ dependencies {
implementation
'androidx.appcompat:appcompat:1.2.0'
implementation
'androidx.appcompat:appcompat:1.2.0'
implementation
'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation
'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation
(
name:
'alipaySdk-15.6.4-20190611174341'
,
ext:
'aar'
)
implementation
(
name:
'alipaySdk-15.6.4-20190611174341'
,
ext:
'aar'
)
//杉德支付
api
(
name:
'paytypelibrary3.5.2'
,
ext:
'aar'
)
api
'org.greenrobot:eventbus:3.2.0'
api
'org.greenrobot:eventbus:3.2.0'
//implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
//implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
api
'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
api
'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
...
...
cms/libs/paytypelibrary3.5.2.aar
0 → 100644
View file @
7aa50b05
File added
cms/src/main/java/com/zxhl/cms/common/NetConfig.java
View file @
7aa50b05
...
@@ -198,6 +198,8 @@ public class NetConfig {
...
@@ -198,6 +198,8 @@ public class NetConfig {
public
static
String
WEB_URL_PRIVACY
=
"https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xiaoxiangSaveMoney/privacy_app.html?appName="
+
AppContext
.
get
().
getResources
().
getString
(
R
.
string
.
app_name
)+
"APP&company=北京掌心互联科技有限公司&money=虚拟货币&webName="
+
AppContext
.
get
().
getResources
().
getString
(
R
.
string
.
app_name
);
public
static
String
WEB_URL_PRIVACY
=
"https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xiaoxiangSaveMoney/privacy_app.html?appName="
+
AppContext
.
get
().
getResources
().
getString
(
R
.
string
.
app_name
)+
"APP&company=北京掌心互联科技有限公司&money=虚拟货币&webName="
+
AppContext
.
get
().
getResources
().
getString
(
R
.
string
.
app_name
);
public
static
String
WEB_URL_RULE
=
"https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xiaoxiangSaveMoney/huafeiRule.html"
;
public
static
String
WEB_URL_ABOUT_US
=
"https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xingyunmohe/aboutMe.html?version="
+
Constant
.
Param
.
vn
+
"&appName="
+
AppContext
.
get
().
getResources
().
getString
(
R
.
string
.
app_name
)+
"&company=北京掌心互联科技有限公司"
;
public
static
String
WEB_URL_ABOUT_US
=
"https://newspool.zhangxinhulian.com/sspapiNovel/su/custom/xingyunmohe/aboutMe.html?version="
+
Constant
.
Param
.
vn
+
"&appName="
+
AppContext
.
get
().
getResources
().
getString
(
R
.
string
.
app_name
)+
"&company=北京掌心互联科技有限公司"
;
public
static
String
WEB_URL_CUSTOMER_SERVICE
=
"https://1568685.s4.udesk.cn/im_client/?web_plugin_id=35245"
;
public
static
String
WEB_URL_CUSTOMER_SERVICE
=
"https://1568685.s4.udesk.cn/im_client/?web_plugin_id=35245"
;
...
...
cms/src/main/java/com/zxhl/cms/net/api/IUserInfoApi.java
View file @
7aa50b05
...
@@ -80,6 +80,14 @@ public interface IUserInfoApi {
...
@@ -80,6 +80,14 @@ public interface IUserInfoApi {
@POST
(
NetConfig
.
User
.
URL_PAY_ORDER
)
@POST
(
NetConfig
.
User
.
URL_PAY_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
aliPay
(
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"voucherId"
)
String
voucherId
,
@Query
(
"appId"
)
String
appId
,
@Query
(
"payMode"
)
String
payMode
);
Observable
<
Response
<
AliPayEntity
>>
aliPay
(
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"voucherId"
)
String
voucherId
,
@Query
(
"appId"
)
String
appId
,
@Query
(
"payMode"
)
String
payMode
);
/**
* 杉德支付
*
* @return
*/
@POST
(
NetConfig
.
User
.
URL_PAY_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
sdPay
(
@Query
(
"returnUrl"
)
String
jumpScheme
,
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"voucherId"
)
String
voucherId
,
@Query
(
"appId"
)
String
appId
,
@Query
(
"payMode"
)
String
payMode
);
/**
/**
* 商城商品支付宝支付
* 商城商品支付宝支付
...
@@ -87,7 +95,7 @@ public interface IUserInfoApi {
...
@@ -87,7 +95,7 @@ public interface IUserInfoApi {
* @return
* @return
*/
*/
@POST
(
NetConfig
.
User
.
URL_PAY_SHOP_ORDER
)
@POST
(
NetConfig
.
User
.
URL_PAY_SHOP_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
shopaliPay
(
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"payMode"
)
String
payMode
,
@Query
(
"addressId"
)
String
addressId
,
@Query
(
"discount"
)
String
discount
,
@Query
(
"goodIds"
)
String
goodIds
,
@Query
(
"orderNotes"
)
String
orderNotes
);
Observable
<
Response
<
AliPayEntity
>>
shopaliPay
(
@Query
(
"
returnUrl"
)
String
returnUrl
,
@Query
(
"
goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"payMode"
)
String
payMode
,
@Query
(
"addressId"
)
String
addressId
,
@Query
(
"discount"
)
String
discount
,
@Query
(
"goodIds"
)
String
goodIds
,
@Query
(
"orderNotes"
)
String
orderNotes
);
/**
/**
* 商城微信支付
* 商城微信支付
...
@@ -154,13 +162,22 @@ public interface IUserInfoApi {
...
@@ -154,13 +162,22 @@ public interface IUserInfoApi {
Observable
<
Response
<
VideoProcessEntity
>>
freeReceive
(
@Query
(
"type"
)
int
type
);
Observable
<
Response
<
VideoProcessEntity
>>
freeReceive
(
@Query
(
"type"
)
int
type
);
// /**
// * 权益支付宝支付
// *
// * @return
// */
// @POST(NetConfig.User.URL_PAY_RIGHTS_ORDER)
// Observable<Response<AliPayEntity>> aliPayRights(@Query("goodsId") String goodsId, @Query("payType") String payType, @Query("phone") String phone,@Query("rechargeType") String rechargeType,@Query("skill") Boolean skill,@Query("outTradeNo") String outTradeNo);
/**
/**
* 权益支付宝支付
* 权益支付宝支付
*
*
* @return
* @return
*/
*/
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
aliPayRights
(
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
);
Observable
<
Response
<
AliPayEntity
>>
aliPayRights
(
@Query
(
"returnUrl"
)
String
returnUrl
,
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
);
/**
/**
* 权益支付宝支付
* 权益支付宝支付
...
@@ -168,6 +185,6 @@ public interface IUserInfoApi {
...
@@ -168,6 +185,6 @@ public interface IUserInfoApi {
* @return
* @return
*/
*/
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
@POST
(
NetConfig
.
User
.
URL_PAY_RIGHTS_ORDER
)
Observable
<
Response
<
AliPayEntity
>>
aliPayRights
(
@Query
(
"goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
,
@Query
(
"couponId"
)
String
couponId
,
@Query
(
"mobileOp"
)
String
mobileOp
);
Observable
<
Response
<
AliPayEntity
>>
aliPayRights
(
@Query
(
"
returnUrl"
)
String
returnUrl
,
@Query
(
"
goodsId"
)
String
goodsId
,
@Query
(
"payType"
)
String
payType
,
@Query
(
"phone"
)
String
phone
,
@Query
(
"rechargeType"
)
String
rechargeType
,
@Query
(
"skill"
)
Boolean
skill
,
@Query
(
"outTradeNo"
)
String
outTradeNo
,
@Query
(
"couponId"
)
String
couponId
,
@Query
(
"mobileOp"
)
String
mobileOp
);
}
}
cms/src/main/java/com/zxhl/cms/pay/H5PayUtil.kt
View file @
7aa50b05
This diff is collapsed.
Click to expand it.
cms/src/main/java/com/zxhl/cms/pay/PayContract.kt
View file @
7aa50b05
...
@@ -32,6 +32,7 @@ class PayContract {
...
@@ -32,6 +32,7 @@ class PayContract {
fun
requestMiniProgrom
(
goodsId
:
String
,
payType
:
String
,
payMode
:
String
)
fun
requestMiniProgrom
(
goodsId
:
String
,
payType
:
String
,
payMode
:
String
)
fun
requestWechatPayOrder
(
goodsId
:
String
,
payType
:
String
)
fun
requestWechatPayOrder
(
goodsId
:
String
,
payType
:
String
)
fun
requestAliPay
(
activity
:
Activity
,
goodsId
:
String
,
payType
:
String
,
payMode
:
String
)
fun
requestAliPay
(
activity
:
Activity
,
goodsId
:
String
,
payType
:
String
,
payMode
:
String
)
fun
requestSdPay
(
jumpScheme
:
String
,
activity
:
Activity
,
goodsId
:
String
,
payType
:
String
,
payMode
:
String
)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
...
@@ -52,6 +53,7 @@ class PayContract {
...
@@ -52,6 +53,7 @@ class PayContract {
)
)
fun
shoprequestAliPay
(
fun
shoprequestAliPay
(
jumpScheme
:
String
,
activity
:
Activity
,
activity
:
Activity
,
goodsId
:
String
,
goodsId
:
String
,
payType
:
String
,
payType
:
String
,
...
...
cms/src/main/java/com/zxhl/cms/pay/PayDialog.kt
View file @
7aa50b05
...
@@ -157,6 +157,13 @@ object PayDialog : PayContract.View {
...
@@ -157,6 +157,13 @@ object PayDialog : PayContract.View {
pay_type
.
toString
(),
pay_type
.
toString
(),
"6"
"6"
)
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
mPresenter
?.
requestSdPay
(
"xxsqshop://goodsdetail"
,
context
,
payPrice
,
pay_type
.
toString
(),
"6"
)
}
else
{
}
else
{
Utils
.
showToast
(
context
,
"暂不支持"
)
Utils
.
showToast
(
context
,
"暂不支持"
)
}
}
...
@@ -317,6 +324,20 @@ object PayDialog : PayContract.View {
...
@@ -317,6 +324,20 @@ object PayDialog : PayContract.View {
}
}
}
}
fun
onNewIntent
(
intent
:
Intent
?)
{
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
mPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
fun
OnResumeCheck
()
{
fun
OnResumeCheck
()
{
if
(
mDialog
==
null
)
{
if
(
mDialog
==
null
)
{
mLoading
?.
setResult
(
false
,
"取消支付"
,
1000
)
mLoading
?.
setResult
(
false
,
"取消支付"
,
1000
)
...
...
cms/src/main/java/com/zxhl/cms/pay/PayPresenter.kt
View file @
7aa50b05
...
@@ -3,6 +3,9 @@ package com.zxhl.cms.pay
...
@@ -3,6 +3,9 @@ package com.zxhl.cms.pay
import
android.app.Activity
import
android.app.Activity
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
com.pay.paytypelibrary.base.OnPayResultListener
import
com.pay.paytypelibrary.base.OrderInfo
import
com.pay.paytypelibrary.base.PayUtil
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.RxSchedulers
...
@@ -113,6 +116,7 @@ class PayPresenter : PayContract.Presenter {
...
@@ -113,6 +116,7 @@ class PayPresenter : PayContract.Presenter {
}
}
override
fun
shoprequestAliPay
(
override
fun
shoprequestAliPay
(
jumpScheme
:
String
,
activity
:
Activity
,
activity
:
Activity
,
goodsId
:
String
,
goodsId
:
String
,
payType
:
String
,
payType
:
String
,
...
@@ -123,6 +127,7 @@ class PayPresenter : PayContract.Presenter {
...
@@ -123,6 +127,7 @@ class PayPresenter : PayContract.Presenter {
orderNotes
:
String
orderNotes
:
String
)
{
)
{
ApiClient
.
userInfoAPi
.
shopaliPay
(
ApiClient
.
userInfoAPi
.
shopaliPay
(
jumpScheme
,
goodsId
,
goodsId
,
payType
,
payType
,
payMode
,
payMode
,
...
@@ -142,7 +147,10 @@ class PayPresenter : PayContract.Presenter {
...
@@ -142,7 +147,10 @@ class PayPresenter : PayContract.Presenter {
}
else
if
(
payType
==
"21"
)
{
}
else
if
(
payType
==
"21"
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
mView
.
requestH5OrderSuc
(
result
.
outTradeNo
?:
""
)
mView
.
requestH5OrderSuc
(
result
.
outTradeNo
?:
""
)
}
else
{
}
else
if
(
payType
==
PaymentConfig
.
SD_PAY
.
toString
())
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
PayUtil
.
CashierPaySingle
(
activity
,
result
.
wakeup
)
}
else
{
AlipayServer
.
payV2
(
activity
,
result
.
wakeup
!!
)
AlipayServer
.
payV2
(
activity
,
result
.
wakeup
!!
)
}
}
mView
?.
requestOrderSuc
()
mView
?.
requestOrderSuc
()
...
@@ -239,6 +247,45 @@ class PayPresenter : PayContract.Presenter {
...
@@ -239,6 +247,45 @@ class PayPresenter : PayContract.Presenter {
})
})
}
}
override
fun
requestSdPay
(
jumpScheme
:
String
,
activity
:
Activity
,
goodsId
:
String
,
payType
:
String
,
payMode
:
String
)
{
ApiClient
.
userInfoAPi
.
sdPay
(
jumpScheme
,
goodsId
,
payType
,
""
,
""
,
payMode
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
if
(
result
!=
null
)
{
mView
?.
setOrderNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
PayUtil
.
CashierPaySingle
(
activity
,
result
.
wakeup
,
object
:
OnPayResultListener
{
override
fun
onSuccess
(
p0
:
OrderInfo
?)
{
}
override
fun
onError
(
p0
:
String
?)
{
Log
.
e
(
"PayUtil"
,
"payError:${p0}"
)
}
})
mView
?.
requestOrderSuc
()
}
else
{
mView
?.
verifyOrderFail
(
"sd支付请求成功 数据为空"
)
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
mView
?.
verifyOrderFail
(
"sd支付请求失败 code:${code} msg:${errorMsg}"
)
}
})
}
override
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
{
override
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
{
try
{
try
{
...
@@ -271,6 +318,12 @@ class PayPresenter : PayContract.Presenter {
...
@@ -271,6 +318,12 @@ class PayPresenter : PayContract.Presenter {
}
else
{
}
else
{
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
}
}
}
else
if
(
payType
==
PaymentConfig
.
SD_PAY
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
else
{
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
mView
?.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:${e.cause} msg:${e.message}"
)
mView
?.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:${e.cause} msg:${e.message}"
)
...
...
cms/src/main/java/com/zxhl/cms/pay/PaymentConfig.kt
0 → 100644
View file @
7aa50b05
package
com.zxhl.cms.pay
/**
* @author (wangXuewei)
* @datetime 2022-07-26 11:29 GMT+8
* @detail :
*/
class
PaymentConfig
{
companion
object
{
const
val
ALI_PAY
=
1
//支付宝支付类型
const
val
WECHAT_PAY
=
2
//微信支付类型
const
val
MINI_PROGRAM
=
11
//微信支付类型
const
val
MIN_PAY_PROGRAM
=
13
//敏付
const
val
H5_PAY
=
21
//h5支付
const
val
SD_PAY
=
15
//杉德支付
}
}
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/utils/AppUtils.java
0 → 100644
View file @
7aa50b05
package
com
.
zxhl
.
cms
.
utils
;
import
android.content.Context
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.Random
;
public
class
AppUtils
{
public
static
String
getPackageName
(
Context
context
)
{
try
{
PackageManager
packageManager
=
context
.
getPackageManager
();
PackageInfo
packageInfo
=
packageManager
.
getPackageInfo
(
context
.
getPackageName
(),
0
);
return
packageInfo
.
packageName
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
static
String
getOrderNumber
()
{
SimpleDateFormat
simpleDateFormat
;
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
,
Locale
.
CHINA
);
String
date
=
simpleDateFormat
.
format
(
new
Date
());
Random
random
=
new
Random
();
int
ranNum
=
(
int
)
(
random
.
nextDouble
()
*
(
99999
-
10000
+
1
))
+
10000
;
return
date
+
ranNum
;
}
public
static
String
getOrderTime
()
{
SimpleDateFormat
simpleDateFormat
;
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
,
Locale
.
CHINA
);
String
date
=
simpleDateFormat
.
format
(
new
Date
());
return
date
;
}
public
static
String
getOrderExpireTime
()
{
SimpleDateFormat
simpleDateFormat
;
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
,
Locale
.
CHINA
);
Calendar
cal
=
Calendar
.
getInstance
();
try
{
Date
date
=
simpleDateFormat
.
parse
(
getOrderTime
());
if
(
date
!=
null
)
{
cal
.
setTime
(
date
);
cal
.
add
(
Calendar
.
MINUTE
,
30
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
String
date
=
simpleDateFormat
.
format
(
cal
.
getTime
());
return
date
;
}
}
cms/src/main/java/com/zxhl/cms/utils/ClipboardManagerUtil.kt
View file @
7aa50b05
...
@@ -96,7 +96,6 @@ object ClipboardManagerUtil {
...
@@ -96,7 +96,6 @@ object ClipboardManagerUtil {
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
copy
(
context
,
"11111111"
)
}
}
})
})
...
@@ -113,8 +112,8 @@ object ClipboardManagerUtil {
...
@@ -113,8 +112,8 @@ object ClipboardManagerUtil {
val
cm
:
ClipboardManager
=
val
cm
:
ClipboardManager
=
context
?.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
context
?.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
)
as
ClipboardManager
val
mClipData
:
ClipData
=
val
mClipData
:
ClipData
=
//
ClipData.newPlainText("Label", string)
ClipData
.
newPlainText
(
"Label"
,
string
)
ClipData
.
newIntent
(
"Label"
,
Intent
())
//
ClipData.newIntent("Label", Intent())
cm
.
setPrimaryClip
(
mClipData
)
cm
.
setPrimaryClip
(
mClipData
)
}
}
...
...
cms/src/main/java/com/zxhl/cms/utils/encry/Base64Utils.java
0 → 100644
View file @
7aa50b05
package
com
.
zxhl
.
cms
.
utils
.
encry
;
public
class
Base64Utils
{
private
static
final
int
BASELENGTH
=
128
;
private
static
final
int
LOOKUPLENGTH
=
64
;
private
static
final
int
TWENTYFOURBITGROUP
=
24
;
private
static
final
int
EIGHTBIT
=
8
;
private
static
final
int
SIXTEENBIT
=
16
;
private
static
final
int
FOURBYTE
=
4
;
private
static
final
int
SIGN
=
-
128
;
private
static
final
char
PAD
=
'='
;
private
static
final
boolean
fDebug
=
false
;
private
static
final
byte
[]
base64Alphabet
=
new
byte
[
BASELENGTH
];
private
static
final
char
[]
lookUpBase64Alphabet
=
new
char
[
LOOKUPLENGTH
];
static
{
for
(
int
i
=
0
;
i
<
BASELENGTH
;
++
i
)
{
base64Alphabet
[
i
]
=
-
1
;
}
for
(
int
i
=
'Z'
;
i
>=
'A'
;
i
--)
{
base64Alphabet
[
i
]
=
(
byte
)
(
i
-
'A'
);
}
for
(
int
i
=
'z'
;
i
>=
'a'
;
i
--)
{
base64Alphabet
[
i
]
=
(
byte
)
(
i
-
'a'
+
26
);
}
for
(
int
i
=
'9'
;
i
>=
'0'
;
i
--)
{
base64Alphabet
[
i
]
=
(
byte
)
(
i
-
'0'
+
52
);
}
base64Alphabet
[
'+'
]
=
62
;
base64Alphabet
[
'/'
]
=
63
;
for
(
int
i
=
0
;
i
<=
25
;
i
++)
{
lookUpBase64Alphabet
[
i
]
=
(
char
)
(
'A'
+
i
);
}
for
(
int
i
=
26
,
j
=
0
;
i
<=
51
;
i
++,
j
++)
{
lookUpBase64Alphabet
[
i
]
=
(
char
)
(
'a'
+
j
);
}
for
(
int
i
=
52
,
j
=
0
;
i
<=
61
;
i
++,
j
++)
{
lookUpBase64Alphabet
[
i
]
=
(
char
)
(
'0'
+
j
);
}
lookUpBase64Alphabet
[
62
]
=
(
char
)
'+'
;
lookUpBase64Alphabet
[
63
]
=
(
char
)
'/'
;
}
/**
* Encodes hex octects into Base64
*
* @param binaryData Array containing binaryData
* @return Encoded Base64 array
*/
public
static
String
encode
(
byte
[]
binaryData
)
{
if
(
binaryData
==
null
)
{
return
null
;
}
int
lengthDataBits
=
binaryData
.
length
*
EIGHTBIT
;
if
(
lengthDataBits
==
0
)
{
return
""
;
}
int
fewerThan24bits
=
lengthDataBits
%
TWENTYFOURBITGROUP
;
int
numberTriplets
=
lengthDataBits
/
TWENTYFOURBITGROUP
;
int
numberQuartet
=
fewerThan24bits
!=
0
?
numberTriplets
+
1
:
numberTriplets
;
char
[]
encodedData
=
new
char
[
numberQuartet
*
4
];
byte
k
=
0
,
l
=
0
,
b1
=
0
,
b2
=
0
,
b3
=
0
;
int
encodedIndex
=
0
;
int
dataIndex
=
0
;
if
(
fDebug
)
{
System
.
out
.
println
(
"number of triplets = "
+
numberTriplets
);
}
for
(
int
i
=
0
;
i
<
numberTriplets
;
i
++)
{
b1
=
binaryData
[
dataIndex
++];
b2
=
binaryData
[
dataIndex
++];
b3
=
binaryData
[
dataIndex
++];
if
(
fDebug
)
{
System
.
out
.
println
(
"b1= "
+
b1
+
", b2= "
+
b2
+
", b3= "
+
b3
);
}
l
=
(
byte
)
(
b2
&
0x0f
);
k
=
(
byte
)
(
b1
&
0x03
);
byte
val1
=
((
b1
&
SIGN
)
==
0
)
?
(
byte
)
(
b1
>>
2
)
:
(
byte
)
((
b1
)
>>
2
^
0xc0
);
byte
val2
=
((
b2
&
SIGN
)
==
0
)
?
(
byte
)
(
b2
>>
4
)
:
(
byte
)
((
b2
)
>>
4
^
0xf0
);
byte
val3
=
((
b3
&
SIGN
)
==
0
)
?
(
byte
)
(
b3
>>
6
)
:
(
byte
)
((
b3
)
>>
6
^
0xfc
);
if
(
fDebug
)
{
System
.
out
.
println
(
"val2 = "
+
val2
);
System
.
out
.
println
(
"k4 = "
+
(
k
<<
4
));
System
.
out
.
println
(
"vak = "
+
(
val2
|
(
k
<<
4
)));
}
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
val1
];
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
val2
|
(
k
<<
4
)];
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[(
l
<<
2
)
|
val3
];
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
b3
&
0x3f
];
}
// form integral number of 6-bit groups
if
(
fewerThan24bits
==
EIGHTBIT
)
{
b1
=
binaryData
[
dataIndex
];
k
=
(
byte
)
(
b1
&
0x03
);
if
(
fDebug
)
{
System
.
out
.
println
(
"b1="
+
b1
);
System
.
out
.
println
(
"b1<<2 = "
+
(
b1
>>
2
));
}
byte
val1
=
((
b1
&
SIGN
)
==
0
)
?
(
byte
)
(
b1
>>
2
)
:
(
byte
)
((
b1
)
>>
2
^
0xc0
);
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
val1
];
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
k
<<
4
];
encodedData
[
encodedIndex
++]
=
PAD
;
encodedData
[
encodedIndex
++]
=
PAD
;
}
else
if
(
fewerThan24bits
==
SIXTEENBIT
)
{
b1
=
binaryData
[
dataIndex
];
b2
=
binaryData
[
dataIndex
+
1
];
l
=
(
byte
)
(
b2
&
0x0f
);
k
=
(
byte
)
(
b1
&
0x03
);
byte
val1
=
((
b1
&
SIGN
)
==
0
)
?
(
byte
)
(
b1
>>
2
)
:
(
byte
)
((
b1
)
>>
2
^
0xc0
);
byte
val2
=
((
b2
&
SIGN
)
==
0
)
?
(
byte
)
(
b2
>>
4
)
:
(
byte
)
((
b2
)
>>
4
^
0xf0
);
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
val1
];
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
val2
|
(
k
<<
4
)];
encodedData
[
encodedIndex
++]
=
lookUpBase64Alphabet
[
l
<<
2
];
encodedData
[
encodedIndex
++]
=
PAD
;
}
return
new
String
(
encodedData
);
}
/**
* Decodes Base64 data into octects
*
* @param encodedData string containing Base64 data
* @return Array decoded data.
*/
public
static
byte
[]
decode
(
String
encodedData
)
{
if
(
encodedData
==
null
)
{
return
null
;
}
char
[]
base64Data
=
encodedData
.
toCharArray
();
// remove white spaces
int
len
=
removeWhiteSpace
(
base64Data
);
if
(
len
%
FOURBYTE
!=
0
)
{
return
null
;
// should be divisible by four
}
int
numberQuadruple
=
(
len
/
FOURBYTE
);
if
(
numberQuadruple
==
0
)
{
return
new
byte
[
0
];
}
byte
[]
decodedData
=
new
byte
[(
numberQuadruple
)
*
3
];
byte
b1
=
0
,
b2
=
0
,
b3
=
0
,
b4
=
0
;
char
d1
=
0
,
d2
=
0
,
d3
=
0
,
d4
=
0
;
int
encodedIndex
=
0
;
int
dataIndex
=
0
;
int
i
=
0
;
for
(;
i
<
numberQuadruple
-
1
;
i
++)
{
if
(!
isData
((
d1
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d2
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d3
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d4
=
base64Data
[
dataIndex
++])))
{
return
null
;
}
b1
=
base64Alphabet
[
d1
];
b2
=
base64Alphabet
[
d2
];
b3
=
base64Alphabet
[
d3
];
b4
=
base64Alphabet
[
d4
];
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
decodedData
[
encodedIndex
++]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b3
<<
6
|
b4
);
}
if
(!
isData
((
d1
=
base64Data
[
dataIndex
++]))
||
!
isData
((
d2
=
base64Data
[
dataIndex
++])))
{
return
null
;
// if found "no data" just return null
}
b1
=
base64Alphabet
[
d1
];
b2
=
base64Alphabet
[
d2
];
d3
=
base64Data
[
dataIndex
++];
d4
=
base64Data
[
dataIndex
++];
if
(!
isData
((
d3
))
||
!
isData
((
d4
)))
{
// Check if they are PAD characters
if
(
isPad
(
d3
)
&&
isPad
(
d4
))
{
if
((
b2
&
0xf
)
!=
0
)
{
// last 4 bits should be zero
return
null
;
}
byte
[]
tmp
=
new
byte
[
i
*
3
+
1
];
System
.
arraycopy
(
decodedData
,
0
,
tmp
,
0
,
i
*
3
);
tmp
[
encodedIndex
]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
return
tmp
;
}
else
if
(!
isPad
(
d3
)
&&
isPad
(
d4
))
{
b3
=
base64Alphabet
[
d3
];
if
((
b3
&
0x3
)
!=
0
)
{
// last 2 bits should be zero
return
null
;
}
byte
[]
tmp
=
new
byte
[
i
*
3
+
2
];
System
.
arraycopy
(
decodedData
,
0
,
tmp
,
0
,
i
*
3
);
tmp
[
encodedIndex
++]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
tmp
[
encodedIndex
]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
return
tmp
;
}
else
{
return
null
;
}
}
else
{
//No PAD e.g 3cQl
b3
=
base64Alphabet
[
d3
];
b4
=
base64Alphabet
[
d4
];
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b1
<<
2
|
b2
>>
4
);
decodedData
[
encodedIndex
++]
=
(
byte
)
(((
b2
&
0xf
)
<<
4
)
|
((
b3
>>
2
)
&
0xf
));
decodedData
[
encodedIndex
++]
=
(
byte
)
(
b3
<<
6
|
b4
);
}
return
decodedData
;
}
/**
* remove WhiteSpace from MIME containing encoded Base64 data.
*
* @param data the byte array of base64 data (with WS)
* @return the new length
*/
private
static
int
removeWhiteSpace
(
char
[]
data
)
{
if
(
data
==
null
)
{
return
0
;
}
// count characters that's not whitespace
int
newSize
=
0
;
int
len
=
data
.
length
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(!
isWhiteSpace
(
data
[
i
]))
{
data
[
newSize
++]
=
data
[
i
];
}
}
return
newSize
;
}
private
static
boolean
isWhiteSpace
(
char
octect
)
{
return
(
octect
==
0x20
||
octect
==
0xd
||
octect
==
0xa
||
octect
==
0x9
);
}
private
static
boolean
isPad
(
char
octect
)
{
return
(
octect
==
PAD
);
}
private
static
boolean
isData
(
char
octect
)
{
return
(
octect
<
BASELENGTH
&&
base64Alphabet
[
octect
]
!=
-
1
);
}
}
cms/src/main/java/com/zxhl/cms/utils/encry/MD5Utils.java
0 → 100644
View file @
7aa50b05
package
com
.
zxhl
.
cms
.
utils
.
encry
;
import
java.security.MessageDigest
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
public
class
MD5Utils
{
static
final
char
hexDigits
[]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
};
public
static
String
getMD5
(
String
s
)
{
try
{
MessageDigest
mdTemp
=
MessageDigest
.
getInstance
(
"MD5"
);
mdTemp
.
update
(
s
.
getBytes
());
byte
[]
md
=
mdTemp
.
digest
();
char
str
[]
=
new
char
[
md
.
length
*
2
];
for
(
int
i
=
0
,
k
=
0
;
i
<
md
.
length
;
i
++)
{
str
[
k
++]
=
hexDigits
[
md
[
i
]
>>>
4
&
0xf
];
str
[
k
++]
=
hexDigits
[
md
[
i
]
&
0xf
];
}
return
new
String
(
str
);
}
catch
(
Exception
e
)
{
}
return
null
;
}
public
static
String
getMD5
(
String
s
,
String
characterEncoder
)
{
try
{
MessageDigest
mdTemp
=
MessageDigest
.
getInstance
(
"MD5"
);
mdTemp
.
update
(
s
.
getBytes
(
characterEncoder
));
byte
[]
md
=
mdTemp
.
digest
();
char
str
[]
=
new
char
[
md
.
length
*
2
];
for
(
int
i
=
0
,
k
=
0
;
i
<
md
.
length
;
i
++)
{
str
[
k
++]
=
hexDigits
[
md
[
i
]
>>>
4
&
0xf
];
str
[
k
++]
=
hexDigits
[
md
[
i
]
&
0xf
];
}
return
new
String
(
str
);
}
catch
(
Exception
e
)
{
}
return
null
;
}
public
static
String
md5fdert
(
int
g
)
{
char
[]
kp
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
};
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
g
;
i
++)
{
Random
ra
=
new
Random
();
int
index
=
ra
.
nextInt
(
kp
.
length
);
sb
.
append
(
kp
[
index
]);
}
return
sb
.
toString
();
}
/**
*
* @Title: sortMap
* @Description: 对集合内的数据按key的字母顺序做排序
*/
public
static
List
<
Map
.
Entry
<
String
,
String
>>
sortMap
(
final
Map
<
String
,
String
>
map
)
{
final
List
<
Map
.
Entry
<
String
,
String
>>
info
=
new
ArrayList
<
Map
.
Entry
<
String
,
String
>>(
map
.
entrySet
());
// 重写集合的排序方法:按字母顺序
Collections
.
sort
(
info
,
new
Comparator
<
Map
.
Entry
<
String
,
String
>>()
{
@Override
public
int
compare
(
final
Map
.
Entry
<
String
,
String
>
o1
,
final
Map
.
Entry
<
String
,
String
>
o2
)
{
return
(
o1
.
getKey
().
toString
().
compareTo
(
o2
.
getKey
()));
}
});
return
info
;
}
}
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/utils/encry/RSAUtils.java
0 → 100644
View file @
7aa50b05
package
com
.
zxhl
.
cms
.
utils
.
encry
;
import
java.nio.charset.Charset
;
import
java.security.KeyFactory
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.Signature
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
public
class
RSAUtils
{
private
static
final
String
SIGN_ALGORITHMS
=
"SHA1WithRSA"
;
/**
* RSA签名
*
* @param content 待签名数据
* @return 签名值
*/
public
static
String
sign
(
String
content
,
String
privateKey
)
{
try
{
PKCS8EncodedKeySpec
pkcs8EncodedKeySpec
=
new
PKCS8EncodedKeySpec
(
Base64Utils
.
decode
(
privateKey
));
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"RSA"
);
PrivateKey
priKey
=
keyFactory
.
generatePrivate
(
pkcs8EncodedKeySpec
);
Signature
signature
=
Signature
.
getInstance
(
SIGN_ALGORITHMS
);
signature
.
initSign
(
priKey
);
signature
.
update
(
content
.
getBytes
(
Charset
.
forName
(
"UTF-8"
)));
return
Base64Utils
.
encode
(
signature
.
sign
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* RSA验签名检查
*
* @param content 待签名数据
* @param sign 签名值
* @return 布尔值
*/
public
static
boolean
verify
(
String
content
,
String
sign
,
String
publicKey
)
{
try
{
X509EncodedKeySpec
x509EncodedKeySpec
=
new
X509EncodedKeySpec
(
Base64Utils
.
decode
(
publicKey
));
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
"RSA"
);
PublicKey
pubKey
=
keyFactory
.
generatePublic
(
x509EncodedKeySpec
);
Signature
signature
=
Signature
.
getInstance
(
SIGN_ALGORITHMS
);
signature
.
initVerify
(
pubKey
);
signature
.
update
(
content
.
getBytes
(
Charset
.
forName
(
"UTF-8"
)));
return
signature
.
verify
(
Base64Utils
.
decode
(
sign
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
false
;
}
}
cms/src/main/java/com/zxhl/cms/widget/CenterDialog.kt
View file @
7aa50b05
...
@@ -469,7 +469,13 @@ object CenterDialog {
...
@@ -469,7 +469,13 @@ object CenterDialog {
JumpUtils
.
webJump
(
"隐私协议"
,
NetConfig
.
H5
.
WEB_URL_PRIVACY
)
JumpUtils
.
webJump
(
"隐私协议"
,
NetConfig
.
H5
.
WEB_URL_PRIVACY
)
}
}
}
}
val
descStr
=
SpannableStringBuilder
(
"你可阅读《隐私政策》及《用户协议》了解详细信息。如你同意,请点击“同意”开始接收我们的服务。"
)
val
rule
:
ClickableSpan
=
object
:
ClickableSpan
()
{
override
fun
onClick
(
widget
:
View
)
{
JumpUtils
.
webJump
(
"活动规则"
,
NetConfig
.
H5
.
WEB_URL_RULE
)
}
}
val
descStr
=
SpannableStringBuilder
(
"你可阅读《隐私政策》及《用户协议》了解详细信息,以及《活动规则》。如你同意,请点击“同意”开始接收我们的服务。"
)
descStr
.
setSpan
(
descStr
.
setSpan
(
clickPrivat
,
4
,
10
,
clickPrivat
,
4
,
10
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
...
@@ -478,6 +484,10 @@ object CenterDialog {
...
@@ -478,6 +484,10 @@ object CenterDialog {
clickUa
,
11
,
17
,
clickUa
,
11
,
17
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
)
descStr
.
setSpan
(
rule
,
26
,
31
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
descStr
.
setSpan
(
descStr
.
setSpan
(
ForegroundColorSpan
(
Color
.
parseColor
(
"#44a1ff"
)),
4
,
10
,
ForegroundColorSpan
(
Color
.
parseColor
(
"#44a1ff"
)),
4
,
10
,
...
@@ -487,6 +497,10 @@ object CenterDialog {
...
@@ -487,6 +497,10 @@ object CenterDialog {
ForegroundColorSpan
(
Color
.
parseColor
(
"#44a1ff"
)),
11
,
17
,
ForegroundColorSpan
(
Color
.
parseColor
(
"#44a1ff"
)),
11
,
17
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
)
descStr
.
setSpan
(
ForegroundColorSpan
(
Color
.
parseColor
(
"#44a1ff"
)),
26
,
31
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
desc
.
text
=
descStr
desc
.
text
=
descStr
desc
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
desc
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
...
@@ -539,7 +553,9 @@ object CenterDialog {
...
@@ -539,7 +553,9 @@ object CenterDialog {
mDialog
.
setCancelable
(
true
)
mDialog
.
setCancelable
(
true
)
mDialog
.
show
()
mDialog
.
show
()
}
}
private
var
mTbDialog
:
Dialog
?=
null
;
private
var
mTbDialog
:
Dialog
?
=
null
;
//淘口令
//淘口令
fun
showTbGoodsDetail
(
context
:
Activity
,
goods
:
TbGoodsItemEntity
)
{
fun
showTbGoodsDetail
(
context
:
Activity
,
goods
:
TbGoodsItemEntity
)
{
if
(
context
.
isFinishing
)
{
if
(
context
.
isFinishing
)
{
...
@@ -548,8 +564,8 @@ object CenterDialog {
...
@@ -548,8 +564,8 @@ object CenterDialog {
if
(
goods
.
zk_final_price
.
isNullOrEmpty
())
{
if
(
goods
.
zk_final_price
.
isNullOrEmpty
())
{
return
return
}
}
if
(
mTbDialog
!=
null
)
{
if
(
mTbDialog
!=
null
)
{
if
(
mTbDialog
?.
isShowing
!!
){
if
(
mTbDialog
?.
isShowing
!!
)
{
mTbDialog
?.
dismiss
()
mTbDialog
?.
dismiss
()
}
}
}
}
...
@@ -575,12 +591,12 @@ object CenterDialog {
...
@@ -575,12 +591,12 @@ object CenterDialog {
goodsImg
.
setLoadImageUrl
(
goods
.
pict_url
,
0
,
5
)
goodsImg
.
setLoadImageUrl
(
goods
.
pict_url
,
0
,
5
)
}
}
name
.
text
=
"${goods.title}"
name
.
text
=
"${goods.title}"
if
(
goods
.
coupon_amount
.
isNullOrEmpty
())
{
if
(
goods
.
coupon_amount
.
isNullOrEmpty
())
{
desc
.
text
=
"可领¥ 0元优惠券"
desc
.
text
=
"可领¥ 0元优惠券"
youhuiquan
.
text
=
"0元"
youhuiquan
.
text
=
"0元"
}
else
{
}
else
{
desc
.
text
=
"可领¥ ${goods.coupon_amount}元优惠券"
desc
.
text
=
"可领¥ ${goods.coupon_amount}元优惠券"
youhuiquan
.
text
=
"${goods.coupon_amount
?:
"
0
"}元"
youhuiquan
.
text
=
"${goods.coupon_amount
?:
"
0
"}元"
}
}
old_price
.
text
=
"¥ ${goods.zk_final_price}元"
old_price
.
text
=
"¥ ${goods.zk_final_price}元"
old_price
.
paint
.
flags
=
Paint
.
STRIKE_THRU_TEXT_FLAG
old_price
.
paint
.
flags
=
Paint
.
STRIKE_THRU_TEXT_FLAG
...
...
cms/src/main/res/layout/dialog_privacy_protocol_view.xml
View file @
7aa50b05
...
@@ -18,13 +18,8 @@
...
@@ -18,13 +18,8 @@
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"123dp"
android:layout_height=
"wrap_content"
android:text=
"请您务必审慎阅读、充分理解“服
android:text=
"请您务必审慎阅读、充分理解“服务及隐私政策”各条款,包括但不限于:为了向您提服务,我们需要收集你的设备信息等个人信息。你可以在“设置”中查看、变更、删除个人信息并管理你的授权。"
务及隐私政策”各条款,包括但不限
于:为了向您提服务,我们需要收集
你的设备信息等个人信息。你可以在
“设置”中查看、变更、删除个人信
息并管理你的授权。"
android:textColor=
"#ff333333"
android:textColor=
"#ff333333"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
/>
...
...
moduleMain/src/main/AndroidManifest.xml
View file @
7aa50b05
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
<activity
android:name=
".activity.CardDetailActivity"
>
<activity
android:name=
".activity.CardDetailActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -129,12 +129,13 @@
...
@@ -129,12 +129,13 @@
android:scheme=
"xxsqshop"
/>
android:scheme=
"xxsqshop"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
android:name=
".activity.RightsDetailActivity"
>
<activity
android:name=
".activity.RightsDetailActivity"
android:launchMode=
"singleTop"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
<data
android:host=
"rights_detail"
android:host=
"rights_detail"
android:scheme=
"xxsqshop"
/>
android:scheme=
"xxsqshop"
/>
...
@@ -170,7 +171,7 @@
...
@@ -170,7 +171,7 @@
<activity
android:name=
".box.activity.NewBoxGoodsDetailActivity"
>
<activity
android:name=
".box.activity.NewBoxGoodsDetailActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -215,7 +216,7 @@
...
@@ -215,7 +216,7 @@
<activity
android:name=
".box.activity.OrderDetailActivity"
>
<activity
android:name=
".box.activity.OrderDetailActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -227,7 +228,7 @@
...
@@ -227,7 +228,7 @@
<activity
android:name=
".activity.ToPaySkillGoodsActivity"
>
<activity
android:name=
".activity.ToPaySkillGoodsActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -252,7 +253,7 @@
...
@@ -252,7 +253,7 @@
<activity
android:name=
".activity.OpenMemberOrderActivity"
>
<activity
android:name=
".activity.OpenMemberOrderActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -264,7 +265,6 @@
...
@@ -264,7 +265,6 @@
<activity
android:name=
".activity.OpenMemberActivity"
>
<activity
android:name=
".activity.OpenMemberActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -275,7 +275,7 @@
...
@@ -275,7 +275,7 @@
<activity
android:name=
".activity.ShopOrderActivity"
>
<activity
android:name=
".activity.ShopOrderActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -308,7 +308,7 @@
...
@@ -308,7 +308,7 @@
<activity
android:name=
".activity.SkillShopActivity"
>
<activity
android:name=
".activity.SkillShopActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
@@ -331,7 +331,7 @@
...
@@ -331,7 +331,7 @@
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
<data
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/CardDetailActivity.kt
View file @
7aa50b05
...
@@ -2,27 +2,28 @@ package com.zxbw.modulemain.activity
...
@@ -2,27 +2,28 @@ package com.zxbw.modulemain.activity
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Paint
import
android.graphics.Paint
import
android.net.Uri
import
android.os.Handler
import
android.os.Handler
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.View
import
android.view.View
import
android.webkit.*
import
android.webkit.*
import
com.pay.paytypelibrary.base.OnPayResultListener
import
com.pay.paytypelibrary.base.OrderInfo
import
com.pay.paytypelibrary.base.PayUtil
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.contract.CardDetailContract
import
com.zxbw.modulemain.contract.CardDetailContract
import
com.zxbw.modulemain.presenter.CardDetailPresenter
import
com.zxbw.modulemain.presenter.CardDetailPresenter
import
com.zxbw.modulemain.view.DialogUtils
import
com.zxbw.modulemain.view.DialogUtils
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.model.qy.RightsDetailEntity
import
com.zxhl.cms.net.model.qy.RightsDetailEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.Pay
Activity
import
com.zxhl.cms.pay.Pay
mentConfig
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.JumpUtils
...
@@ -41,7 +42,7 @@ import kotlinx.android.synthetic.main.activity_layout_card_detail.id_rl_h5_pay_v
...
@@ -41,7 +42,7 @@ import kotlinx.android.synthetic.main.activity_layout_card_detail.id_rl_h5_pay_v
class
CardDetailActivity
:
BaseActivity
(),
CardDetailContract
.
View
{
class
CardDetailActivity
:
BaseActivity
(),
CardDetailContract
.
View
{
private
var
mPayPresenter
:
CardDetailPresenter
?
=
null
private
var
mPayPresenter
:
CardDetailPresenter
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
pay_type
:
Int
?
=
RightsDetailActivity
.
H5_PAY
private
var
pay_type
:
Int
?
=
PaymentConfig
.
H5_PAY
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
var
goodsID
:
String
?
=
""
var
goodsID
:
String
?
=
""
var
type
:
String
?
=
"0"
var
type
:
String
?
=
"0"
...
@@ -175,7 +176,7 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
...
@@ -175,7 +176,7 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
isClickPayBtn
=
true
isClickPayBtn
=
true
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
show
()
mLoading
?.
show
()
mPayPresenter
?.
requestRightsAliPay
(
mPayPresenter
?.
requestRightsAliPay
(
"xxsqshop://carddetail"
,
goodsID
.
toString
(),
goodsID
.
toString
(),
pay_type
.
toString
(),
pay_type
.
toString
(),
""
,
""
,
...
@@ -186,10 +187,10 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
...
@@ -186,10 +187,10 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
}
}
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
if
(
pay_type
==
RightsDetailActivity
.
MIN_PAY_PROGRAM
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
}
else
if
(
pay_type
==
RightsDetailActivity
.
H5_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
H5_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
EventUtils
.
onEvent
(
"h5_pay_error"
)
EventUtils
.
onEvent
(
"h5_pay_error"
)
...
@@ -222,14 +223,42 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
...
@@ -222,14 +223,42 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
}
}
})
})
}
}
}
else
if
(
pay_type
==
RightsDetailActivity
.
ALI_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
ALI_PAY
)
{
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
.
outTradeNo
)
PayUtil
.
CashierPaySingle
(
this
,
result
.
wakeup
,
object
:
OnPayResultListener
{
override
fun
onSuccess
(
p0
:
OrderInfo
?)
{
}
override
fun
onError
(
p0
:
String
?)
{
EventUtils
.
onEvent
(
"SdPayError"
,
"error:${p0}"
)
mLoading
?.
setResult
(
false
,
"支付异常"
,
1000
)
}
});
}
else
{
}
else
{
showToast
(
"暂不支持"
)
showToast
(
"暂不支持"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
}
}
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPayPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
showResultLoading
(
false
)
showResultLoading
(
false
)
}
}
...
@@ -267,7 +296,7 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
...
@@ -267,7 +296,7 @@ class CardDetailActivity : BaseActivity(), CardDetailContract.View {
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
if
(
isPause
&&
isClickPayBtn
)
{
if
(
isPause
&&
isClickPayBtn
)
{
if
(
pay_type
==
Pay
Activity
.
MIN_PAY_PROGRAM
||
pay_type
==
PayActivity
.
H5_PAY
)
{
if
(
pay_type
==
Pay
mentConfig
.
MIN_PAY_PROGRAM
||
pay_type
==
PaymentConfig
.
H5_PAY
)
{
//如果是敏支付或者H5支付
//如果是敏支付或者H5支付
mPayPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
mPayPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
}
else
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/OpenMemberActivity.kt
View file @
7aa50b05
package
com.zxbw.modulemain.activity
package
com.zxbw.modulemain.activity
import
android.text.TextUtils
import
android.view.View
import
android.view.View
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.view.BoxResultDialog
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.Utils
import
kotlinx.android.synthetic.main.activity_layout_open_member.*
import
kotlinx.android.synthetic.main.activity_layout_open_member.*
/**
/**
...
@@ -28,6 +31,10 @@ class OpenMemberActivity : BaseActivity() {
...
@@ -28,6 +31,10 @@ class OpenMemberActivity : BaseActivity() {
}
}
override
fun
init
()
{
override
fun
init
()
{
if
(
TextUtils
.
equals
(
Utils
.
getChannel
(
mActivity
),
"sh"
))
{
id_img_open_vip
.
setImageResource
(
R
.
drawable
.
img_open_vip_top_sh
)
}
id_img_open_vip
.
setOnClickListener
{
id_img_open_vip
.
setOnClickListener
{
JumpUtils
.
MemberOrderJump
()
JumpUtils
.
MemberOrderJump
()
finish
()
finish
()
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/OpenMemberOrderActivity.kt
View file @
7aa50b05
package
com.zxbw.modulemain.activity
package
com.zxbw.modulemain.activity
import
android.content.Intent
import
android.os.Handler
import
android.os.Handler
import
android.util.Log
import
android.util.Log
import
android.view.View
import
android.view.View
...
@@ -35,15 +36,15 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
...
@@ -35,15 +36,15 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
private
var
mPayFunAdapter
:
PaymentFunAdapter
?
=
null
;
private
var
mPayFunAdapter
:
PaymentFunAdapter
?
=
null
;
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
companion
object
{
//
companion object {
const
val
ALI_PAY
=
1
//支付宝支付类型
//
const val ALI_PAY = 1 //支付宝支付类型
const
val
WECHAT_PAY
=
2
//微信支付类型
//
const val WECHAT_PAY = 2 //微信支付类型
const
val
MINI_PROGRAM
=
11
//微信支付类型
//
const val MINI_PROGRAM = 11 //微信支付类型
const
val
MIN_PAY_PROGRAM
=
13
//敏付
//
const val MIN_PAY_PROGRAM = 13 //敏付
const
val
H5_PAY
=
21
//h5支付
//
const val H5_PAY = 21 //h5支付
}
//
}
private
var
pay_type
:
Int
?
=
H5_PAY
private
var
pay_type
:
Int
?
=
PaymentConfig
.
H5_PAY
override
fun
before
()
{
override
fun
before
()
{
super
.
before
()
super
.
before
()
setStatusBarBackground
(
AppContext
.
get
().
resources
.
getColor
(
R
.
color
.
transparent
))
setStatusBarBackground
(
AppContext
.
get
().
resources
.
getColor
(
R
.
color
.
transparent
))
...
@@ -134,25 +135,32 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
...
@@ -134,25 +135,32 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
mLoading
?.
setLoading
(
"请稍后"
)
mLoading
?.
setLoading
(
"请稍后"
)
mLoading
?.
show
()
mLoading
?.
show
()
if
(
pay_type
==
ALI_PAY
)
{
if
(
pay_type
==
PaymentConfig
.
ALI_PAY
)
{
mPresenter
?.
requestAliPay
(
mPresenter
?.
requestAliPay
(
this
,
this
,
payData
?.
goodsId
?:
""
,
payData
?.
goodsId
?:
""
,
pay_type
.
toString
(),
pay_type
.
toString
(),
"5"
"5"
)
)
}
else
if
(
pay_type
==
WECHAT_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
WECHAT_PAY
)
{
Log
.
e
(
"MXL"
,
"2微信原生支付"
)
Log
.
e
(
"MXL"
,
"2微信原生支付"
)
mPresenter
?.
requestWechatPayOrder
(
mPresenter
?.
requestWechatPayOrder
(
payData
?.
goodsId
?:
""
,
payData
?.
goodsId
?:
""
,
pay_type
.
toString
()
pay_type
.
toString
()
)
)
}
else
if
(
pay_type
==
MINI_PROGRAM
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
MINI_PROGRAM
)
{
Log
.
e
(
"MXL"
,
"2微信连连支付"
)
Log
.
e
(
"MXL"
,
"2微信连连支付"
)
mPresenter
?.
requestWechatPayOrder
(
mPresenter
?.
requestWechatPayOrder
(
payData
?.
goodsId
?:
""
,
payData
?.
goodsId
?:
""
,
pay_type
.
toString
()
pay_type
.
toString
()
)
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
mPresenter
?.
requestSdPay
(
"xxsqshop://member_order"
,
this
,
payData
?.
goodsId
?:
""
,
pay_type
.
toString
(),
"5"
)
}
else
{
}
else
{
Log
.
e
(
"MXL"
,
"2支付宝敏支付"
)
Log
.
e
(
"MXL"
,
"2支付宝敏支付"
)
mPresenter
?.
requestMiniProgrom
(
mPresenter
?.
requestMiniProgrom
(
...
@@ -164,6 +172,22 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
...
@@ -164,6 +172,22 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
override
fun
updatePriceList
(
data
:
List
<
MemberEntity
.
ProductDetail
>)
{
override
fun
updatePriceList
(
data
:
List
<
MemberEntity
.
ProductDetail
>)
{
}
}
...
@@ -240,6 +264,7 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
...
@@ -240,6 +264,7 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
for
(
i
in
result
.
pay_config_v2
!!
.
indices
)
{
for
(
i
in
result
.
pay_config_v2
!!
.
indices
)
{
if
(
result
?.
pay_config_v2
!!
[
i
].
open
==
1
)
{
if
(
result
?.
pay_config_v2
!!
[
i
].
open
==
1
)
{
pay_type
=
result
?.
pay_config_v2
!!
[
i
].
type
pay_type
=
result
?.
pay_config_v2
!!
[
i
].
type
// pay_type = PaymentConfig.SD_PAY
mPayFunAdapter
?.
setPosition
(
i
)
mPayFunAdapter
?.
setPosition
(
i
)
break
break
}
}
...
@@ -284,7 +309,7 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
...
@@ -284,7 +309,7 @@ class OpenMemberOrderActivity : BaseActivity(), PayContract.View {
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
if
(
isPause
)
{
if
(
isPause
)
{
if
(
pay_type
==
MIN_PAY_PROGRAM
||
pay_type
==
H5_PAY
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
||
pay_type
==
PaymentConfig
.
H5_PAY
)
{
//如果是敏支付或者H5支付
//如果是敏支付或者H5支付
mPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
mPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
}
else
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/RechargeActivity.kt
View file @
7aa50b05
package
com.zxbw.modulemain.activity
package
com.zxbw.modulemain.activity
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Intent
import
android.graphics.Paint
import
android.graphics.Paint
import
android.os.Handler
import
android.os.Handler
import
android.text.TextUtils
import
android.text.TextUtils
...
@@ -8,6 +9,9 @@ import android.util.Log
...
@@ -8,6 +9,9 @@ import android.util.Log
import
android.view.View
import
android.view.View
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.pay.paytypelibrary.base.OnPayResultListener
import
com.pay.paytypelibrary.base.OrderInfo
import
com.pay.paytypelibrary.base.PayUtil
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.adapter.OperatorAdapter
import
com.zxbw.modulemain.adapter.OperatorAdapter
import
com.zxbw.modulemain.adapter.RechargeAdapter
import
com.zxbw.modulemain.adapter.RechargeAdapter
...
@@ -26,6 +30,7 @@ import com.zxhl.cms.net.model.uc.PayResultEntity
...
@@ -26,6 +30,7 @@ import com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.utils.*
import
com.zxhl.cms.utils.*
import
com.zxhl.cms.widget.LoadingDialog
import
com.zxhl.cms.widget.LoadingDialog
...
@@ -44,7 +49,7 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
...
@@ -44,7 +49,7 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
private
var
mPresenter
:
RechargePresenter
?
=
null
private
var
mPresenter
:
RechargePresenter
?
=
null
private
var
couponsentity
:
CouponsEntity
?
=
null
private
var
couponsentity
:
CouponsEntity
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
pay_type
:
Int
?
=
RightsDetailActivity
.
H5_PAY
private
var
pay_type
:
Int
?
=
PaymentConfig
.
H5_PAY
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
private
var
mobileOp
:
String
?
=
""
private
var
mobileOp
:
String
?
=
""
private
var
selectPrice
:
String
?
=
""
private
var
selectPrice
:
String
?
=
""
...
@@ -105,7 +110,8 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
...
@@ -105,7 +110,8 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
mPresenter
=
RechargePresenter
(
this
)
mPresenter
=
RechargePresenter
(
this
)
mAdapter
=
RechargeAdapter
(
this
,
this
)
mAdapter
=
RechargeAdapter
(
this
,
this
)
// id_rl_recharge?.layoutManager = GridLayoutManager(this, 3)
// id_rl_recharge?.layoutManager = GridLayoutManager(this, 3)
id_rl_recharge
?.
layoutManager
=
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
)
id_rl_recharge
?.
layoutManager
=
LinearLayoutManager
(
this
,
LinearLayoutManager
.
HORIZONTAL
,
false
)
id_rl_recharge
?.
adapter
=
mAdapter
id_rl_recharge
?.
adapter
=
mAdapter
mPresenter
?.
getFetchCard
()
mPresenter
?.
getFetchCard
()
// mPresenter?.getPayList("mobileFee")
// mPresenter?.getPayList("mobileFee")
...
@@ -205,6 +211,7 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
...
@@ -205,6 +211,7 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
show
()
mLoading
?.
show
()
mPresenter
?.
requestRightsAliPay
(
mPresenter
?.
requestRightsAliPay
(
"xxsqshop://recharge"
,
goodsID
.
toString
(),
goodsID
.
toString
(),
pay_type
.
toString
(),
pay_type
.
toString
(),
phoneNumber
,
phoneNumber
,
...
@@ -226,10 +233,10 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
...
@@ -226,10 +233,10 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
}
}
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
if
(
pay_type
==
RightsDetailActivity
.
MIN_PAY_PROGRAM
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
}
else
if
(
pay_type
==
RightsDetailActivity
.
H5_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
H5_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
EventUtils
.
onEvent
(
"h5_pay_error"
)
EventUtils
.
onEvent
(
"h5_pay_error"
)
...
@@ -262,14 +269,42 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
...
@@ -262,14 +269,42 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
}
}
})
})
}
}
}
else
if
(
pay_type
==
RightsDetailActivity
.
ALI_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
ALI_PAY
)
{
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
.
outTradeNo
)
PayUtil
.
CashierPaySingle
(
this
,
result
.
wakeup
,
object
:
OnPayResultListener
{
override
fun
onSuccess
(
p0
:
OrderInfo
?)
{
}
override
fun
onError
(
p0
:
String
?)
{
EventUtils
.
onEvent
(
"SdPayError"
,
"error:${p0}"
)
mLoading
?.
setResult
(
false
,
"支付异常"
,
1000
)
}
});
}
else
{
}
else
{
showToast
(
"暂不支持"
)
showToast
(
"暂不支持"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
}
}
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
showResultLoading
(
false
)
showResultLoading
(
false
)
}
}
...
@@ -292,8 +327,8 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
...
@@ -292,8 +327,8 @@ class RechargeActivity : BaseActivity(), OnRecycleItemClickListener<MemberEntity
}
}
override
fun
setPayList
(
result
:
MemberEntity
)
{
override
fun
setPayList
(
result
:
MemberEntity
)
{
for
(
i
in
result
?.
goodsList
!!
)
{
for
(
i
in
result
?.
goodsList
!!
)
{
if
(
i
.
originalPrice
.
equals
(
"50"
))
{
if
(
i
.
originalPrice
.
equals
(
"50"
))
{
}
}
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/RightsDetailActivity.kt
View file @
7aa50b05
This diff is collapsed.
Click to expand it.
moduleMain/src/main/java/com/zxbw/modulemain/activity/ShopOrderActivity.kt
View file @
7aa50b05
...
@@ -25,13 +25,10 @@ import com.zxhl.cms.net.model.box.AddressEntity
...
@@ -25,13 +25,10 @@ import com.zxhl.cms.net.model.box.AddressEntity
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.box.OrderEntity
import
com.zxhl.cms.net.model.box.OrderEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.pay.PayContract
import
com.zxhl.cms.pay.PayPresenter
import
com.zxhl.cms.utils.*
import
com.zxhl.cms.utils.*
import
com.zxhl.cms.widget.LoadingDialog
import
com.zxhl.cms.widget.LoadingDialog
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.*
import
com.zxhl.cms.pay.PaymentFunAdapter
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.functions.Consumer
import
io.reactivex.functions.Consumer
...
@@ -285,8 +282,9 @@ class ShopOrderActivity : BaseActivity(), ShopOrderContract.View, PayContract.Vi
...
@@ -285,8 +282,9 @@ class ShopOrderActivity : BaseActivity(), ShopOrderContract.View, PayContract.Vi
}
}
mLoading
?.
show
()
mLoading
?.
show
()
mLoading
?.
setLoading
(
"请稍后"
)
mLoading
?.
setLoading
(
"请稍后"
)
if
(
pay_type
==
1
||
pay_type
==
13
||
pay_type
==
21
)
{
if
(
pay_type
==
1
||
pay_type
==
13
||
pay_type
==
21
||
pay_type
==
PaymentConfig
.
SD_PAY
)
{
mPayresenter
?.
shoprequestAliPay
(
mPayresenter
?.
shoprequestAliPay
(
"xxsqshop://shoporder"
,
this
,
this
,
payId
?:
""
,
payId
?:
""
,
pay_type
.
toString
(),
pay_type
.
toString
(),
...
@@ -423,32 +421,6 @@ class ShopOrderActivity : BaseActivity(), ShopOrderContract.View, PayContract.Vi
...
@@ -423,32 +421,6 @@ class ShopOrderActivity : BaseActivity(), ShopOrderContract.View, PayContract.Vi
}
}
}
}
// if (result != null) {
// if (result.pay_ali.equals("1") && result.pay_wx.equals("0")) {
// pay_type = PayActivity.ALI_PAY
// id_rl_wechat_pay.visibility = View.GONE
// id_rl_zfb_pay.visibility = View.VISIBLE
// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// } else {
// if (result?.pay_ali.equals("0")) {
// id_rl_zfb_pay.visibility = View.GONE
// } else {
// id_rl_zfb_pay.visibility = View.VISIBLE
//// pay_type = PayActivity.ALI_PAY
//// id_img_wechat?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong_default)
//// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// }
// if (result?.pay_wx.equals("0")) {
// id_rl_wechat_pay.visibility = View.GONE
// } else {
// id_rl_wechat_pay.visibility = View.VISIBLE
// pay_type = PayActivity.WECHAT_PAY
// id_img_wechat?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong)
// id_img_ali?.setImageResource(com.zxhl.cms.R.drawable.icon_xuanzhong_default)
// }
// }
// }
}
}
//使用优惠
//使用优惠
...
@@ -489,6 +461,22 @@ class ShopOrderActivity : BaseActivity(), ShopOrderContract.View, PayContract.Vi
...
@@ -489,6 +461,22 @@ class ShopOrderActivity : BaseActivity(), ShopOrderContract.View, PayContract.Vi
mdiscount
=
"0"
mdiscount
=
"0"
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPayresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
private
var
isPause
=
false
private
var
isPause
=
false
override
fun
onPause
()
{
override
fun
onPause
()
{
super
.
onPause
()
super
.
onPause
()
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/SkillShopActivity.kt
View file @
7aa50b05
...
@@ -9,6 +9,9 @@ import android.util.Log
...
@@ -9,6 +9,9 @@ import android.util.Log
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.View
import
android.view.View
import
android.webkit.*
import
android.webkit.*
import
com.pay.paytypelibrary.base.OnPayResultListener
import
com.pay.paytypelibrary.base.OrderInfo
import
com.pay.paytypelibrary.base.PayUtil
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.box.activity.ReceiveAddressActivity
import
com.zxbw.modulemain.box.activity.ReceiveAddressActivity
import
com.zxbw.modulemain.contract.CardDetailContract
import
com.zxbw.modulemain.contract.CardDetailContract
...
@@ -29,6 +32,7 @@ import com.zxhl.cms.net.model.uc.AliPayEntity
...
@@ -29,6 +32,7 @@ import com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.JumpUtils
...
@@ -54,7 +58,7 @@ import kotlinx.android.synthetic.main.activity_layout_to_pay_skill_goods.*
...
@@ -54,7 +58,7 @@ import kotlinx.android.synthetic.main.activity_layout_to_pay_skill_goods.*
class
SkillShopActivity
:
BaseActivity
(),
CardDetailContract
.
View
{
class
SkillShopActivity
:
BaseActivity
(),
CardDetailContract
.
View
{
private
var
mPayPresenter
:
CardDetailPresenter
?
=
null
private
var
mPayPresenter
:
CardDetailPresenter
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
pay_type
:
Int
?
=
RightsDetailActivity
.
H5_PAY
private
var
pay_type
:
Int
?
=
PaymentConfig
.
H5_PAY
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
private
var
updateAddress
:
Observable
<
Int
>?
=
null
private
var
updateAddress
:
Observable
<
Int
>?
=
null
var
goodsID
:
String
?
=
""
var
goodsID
:
String
?
=
""
...
@@ -283,7 +287,7 @@ class SkillShopActivity : BaseActivity(), CardDetailContract.View {
...
@@ -283,7 +287,7 @@ class SkillShopActivity : BaseActivity(), CardDetailContract.View {
isClickPayBtn
=
true
isClickPayBtn
=
true
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
show
()
mLoading
?.
show
()
mPayPresenter
?.
requestRightsAliPay
(
mPayPresenter
?.
requestRightsAliPay
(
"xxsqshop://skillshop"
,
goodsID
.
toString
(),
goodsID
.
toString
(),
pay_type
.
toString
(),
pay_type
.
toString
(),
""
,
""
,
...
@@ -294,10 +298,10 @@ class SkillShopActivity : BaseActivity(), CardDetailContract.View {
...
@@ -294,10 +298,10 @@ class SkillShopActivity : BaseActivity(), CardDetailContract.View {
}
}
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
if
(
pay_type
==
RightsDetailActivity
.
MIN_PAY_PROGRAM
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
}
else
if
(
pay_type
==
RightsDetailActivity
.
H5_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
H5_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
EventUtils
.
onEvent
(
"h5_pay_error"
)
EventUtils
.
onEvent
(
"h5_pay_error"
)
...
@@ -330,14 +334,42 @@ class SkillShopActivity : BaseActivity(), CardDetailContract.View {
...
@@ -330,14 +334,42 @@ class SkillShopActivity : BaseActivity(), CardDetailContract.View {
}
}
})
})
}
}
}
else
if
(
pay_type
==
RightsDetailActivity
.
ALI_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
ALI_PAY
)
{
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
.
outTradeNo
)
PayUtil
.
CashierPaySingle
(
this
,
result
.
wakeup
,
object
:
OnPayResultListener
{
override
fun
onSuccess
(
p0
:
OrderInfo
?)
{
}
override
fun
onError
(
p0
:
String
?)
{
EventUtils
.
onEvent
(
"SdPayError"
,
"error:${p0}"
)
mLoading
?.
setResult
(
false
,
"支付异常"
,
1000
)
}
});
}
else
{
}
else
{
showToast
(
"暂不支持"
)
showToast
(
"暂不支持"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
}
}
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPayPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
showResultLoading
(
false
)
showResultLoading
(
false
)
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/TbGoodsDetailActivity.kt
View file @
7aa50b05
...
@@ -183,7 +183,11 @@ class TbGoodsDetailActivity : BaseActivity(), TbGoodsDetailContract.View,
...
@@ -183,7 +183,11 @@ class TbGoodsDetailActivity : BaseActivity(), TbGoodsDetailContract.View,
override
fun
jumpError
(
error
:
String
)
{
override
fun
jumpError
(
error
:
String
)
{
Log
.
d
(
"wxw"
,
"error:$error"
)
Log
.
d
(
"wxw"
,
"error:$error"
)
mLoading
?.
setResult
(
false
,
"购买失败,请重试"
,
1000
)
if
(
error
.
contains
(
"跳转淘宝失败"
)){
mLoading
?.
setResult
(
false
,
"购买失败,请安装淘宝APP~"
,
1000
)
}
else
{
mLoading
?.
setResult
(
false
,
"购买失败,请重试"
,
1000
)
}
EventUtils
.
onEvent
(
"JumpTbError"
,
error
)
EventUtils
.
onEvent
(
"JumpTbError"
,
error
)
}
}
})
})
...
...
moduleMain/src/main/java/com/zxbw/modulemain/activity/ToPaySkillGoodsActivity.kt
View file @
7aa50b05
package
com.zxbw.modulemain.activity
package
com.zxbw.modulemain.activity
import
android.content.Intent
import
android.graphics.Paint
import
android.graphics.Paint
import
android.os.Handler
import
android.os.Handler
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.View
import
android.view.View
import
com.pay.paytypelibrary.base.OnPayResultListener
import
com.pay.paytypelibrary.base.OrderInfo
import
com.pay.paytypelibrary.base.PayUtil
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.contract.CardDetailContract
import
com.zxbw.modulemain.contract.CardDetailContract
import
com.zxbw.modulemain.presenter.CardDetailPresenter
import
com.zxbw.modulemain.presenter.CardDetailPresenter
...
@@ -19,6 +23,7 @@ import com.zxhl.cms.net.model.uc.AliPayEntity
...
@@ -19,6 +23,7 @@ import com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.net.model.uc.PayResultEntity
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.H5PayUtil
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.PayActivity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.JumpUtils
...
@@ -37,7 +42,7 @@ import kotlinx.android.synthetic.main.activity_layout_to_pay_skill_goods.id_rl_h
...
@@ -37,7 +42,7 @@ import kotlinx.android.synthetic.main.activity_layout_to_pay_skill_goods.id_rl_h
class
ToPaySkillGoodsActivity
:
BaseActivity
(),
CardDetailContract
.
View
{
class
ToPaySkillGoodsActivity
:
BaseActivity
(),
CardDetailContract
.
View
{
private
var
mPayPresenter
:
CardDetailPresenter
?
=
null
private
var
mPayPresenter
:
CardDetailPresenter
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
mLoading
:
LoadingDialog
?
=
null
private
var
pay_type
:
Int
?
=
RightsDetailActivity
.
H5_PAY
private
var
pay_type
:
Int
?
=
PaymentConfig
.
H5_PAY
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
private
var
payResultObservable
:
Observable
<
PayResultEntity
>?
=
null
var
goodsID
:
String
?
=
""
var
goodsID
:
String
?
=
""
var
type
:
String
?
=
"0"
var
type
:
String
?
=
"0"
...
@@ -182,7 +187,7 @@ class ToPaySkillGoodsActivity : BaseActivity(), CardDetailContract.View {
...
@@ -182,7 +187,7 @@ class ToPaySkillGoodsActivity : BaseActivity(), CardDetailContract.View {
isClickPayBtn
=
true
isClickPayBtn
=
true
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
setLoading
(
"请稍后..."
)
mLoading
?.
show
()
mLoading
?.
show
()
mPayPresenter
?.
requestRightsAliPay
(
mPayPresenter
?.
requestRightsAliPay
(
"xxsqshop://topayskill"
,
goodsID
.
toString
(),
goodsID
.
toString
(),
pay_type
.
toString
(),
pay_type
.
toString
(),
phoneNumber
,
phoneNumber
,
...
@@ -193,10 +198,10 @@ class ToPaySkillGoodsActivity : BaseActivity(), CardDetailContract.View {
...
@@ -193,10 +198,10 @@ class ToPaySkillGoodsActivity : BaseActivity(), CardDetailContract.View {
}
}
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
override
fun
requestOrderSuc
(
result
:
AliPayEntity
)
{
if
(
pay_type
==
RightsDetailActivity
.
MIN_PAY_PROGRAM
)
{
if
(
pay_type
==
PaymentConfig
.
MIN_PAY_PROGRAM
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
JumpUtils
.
h5Jump
(
"https://api.minpayment.com/pay.do?sendMsg="
+
result
.
wakeup
)
}
else
if
(
pay_type
==
RightsDetailActivity
.
H5_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
H5_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
SettingPreference
.
setOutTradeNo
(
result
?.
outTradeNo
)
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
if
(
result
.
outTradeNo
.
isNullOrEmpty
())
{
EventUtils
.
onEvent
(
"h5_pay_error"
)
EventUtils
.
onEvent
(
"h5_pay_error"
)
...
@@ -229,14 +234,42 @@ class ToPaySkillGoodsActivity : BaseActivity(), CardDetailContract.View {
...
@@ -229,14 +234,42 @@ class ToPaySkillGoodsActivity : BaseActivity(), CardDetailContract.View {
}
}
})
})
}
}
}
else
if
(
pay_type
==
RightsDetailActivity
.
ALI_PAY
)
{
}
else
if
(
pay_type
==
PaymentConfig
.
ALI_PAY
)
{
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
AlipayServer
.
payV2
(
this
,
result
.
wakeup
!!
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
SettingPreference
.
setOutTradeNo
(
result
.
outTradeNo
)
PayUtil
.
CashierPaySingle
(
this
,
result
.
wakeup
,
object
:
OnPayResultListener
{
override
fun
onSuccess
(
p0
:
OrderInfo
?)
{
}
override
fun
onError
(
p0
:
String
?)
{
EventUtils
.
onEvent
(
"SdPayError"
,
"error:${p0}"
)
mLoading
?.
setResult
(
false
,
"支付异常"
,
1000
)
}
});
}
else
{
}
else
{
showToast
(
"暂不支持"
)
showToast
(
"暂不支持"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
EventUtils
.
onEvent
(
"payment_error"
,
"$pay_type"
)
}
}
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPayPresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
override
fun
requestOrderFail
(
errorMsg
:
String
)
{
showResultLoading
(
false
)
showResultLoading
(
false
)
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/HomeBannerAdapter.kt
View file @
7aa50b05
...
@@ -42,6 +42,8 @@ class HomeBannerAdapter : PagerAdapter {
...
@@ -42,6 +42,8 @@ class HomeBannerAdapter : PagerAdapter {
bg
.
setImageResource
(
R
.
drawable
.
img_banner_mh_bg
)
bg
.
setImageResource
(
R
.
drawable
.
img_banner_mh_bg
)
}
else
if
(
data
.
bannerType
.
equals
(
"H5"
))
{
}
else
if
(
data
.
bannerType
.
equals
(
"H5"
))
{
bg
.
setImageResource
(
R
.
drawable
.
img_banner_wm_bg
)
bg
.
setImageResource
(
R
.
drawable
.
img_banner_wm_bg
)
}
else
if
(
data
.
bannerType
.
equals
(
"hua_fei"
))
{
bg
.
setImageResource
(
R
.
drawable
.
img_banner_hf_bg
)
}
else
{
}
else
{
bg
.
setImageResource
(
R
.
drawable
.
img_banner_ms_bg
)
bg
.
setImageResource
(
R
.
drawable
.
img_banner_ms_bg
)
}
}
...
@@ -58,6 +60,13 @@ class HomeBannerAdapter : PagerAdapter {
...
@@ -58,6 +60,13 @@ class HomeBannerAdapter : PagerAdapter {
}
else
{
}
else
{
JumpUtils
.
webJump
(
"免费领红包"
,
data
.
url
)
JumpUtils
.
webJump
(
"免费领红包"
,
data
.
url
)
}
}
}
else
if
(
data
.
bannerType
.
equals
(
"hua_fei"
))
{
if
(!
Constant
.
Switch
.
isOpenVip
)
{
JumpUtils
.
MemberOrderJump
()
}
else
{
//话费充值
JumpUtils
.
RechargeJump
()
}
}
else
{
}
else
{
JumpUtils
.
FlashSaleJump
()
JumpUtils
.
FlashSaleJump
()
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/ItemVipOrderAdapter.kt
View file @
7aa50b05
...
@@ -38,7 +38,14 @@ class ItemVipOrderAdapter :
...
@@ -38,7 +38,14 @@ class ItemVipOrderAdapter :
Glide
.
with
(
mContext
!!
).
asGif
().
load
(
R
.
drawable
.
img_gif_huafei
)
Glide
.
with
(
mContext
!!
).
asGif
().
load
(
R
.
drawable
.
img_gif_huafei
)
.
into
(
holder
.
id_img_rights_icon
!!
)
.
into
(
holder
.
id_img_rights_icon
!!
)
}
}
//1 充值中 2 充值成功 4 充值失败
if
(
bean
.
status
.
equals
(
"2"
)){
holder
.
id_tv_huafei_desc
?.
text
=
"充值成功"
}
else
if
(
bean
.
status
.
equals
(
"4"
)){
holder
.
id_tv_huafei_desc
?.
text
=
"充值异常,请联系客服查询订单状态"
}
else
{
holder
.
id_tv_huafei_desc
?.
text
=
"72小时内到账"
}
holder
.
id_tv_vip_goods_name
?.
text
=
bean
.
goodsName
holder
.
id_tv_vip_goods_name
?.
text
=
bean
.
goodsName
holder
.
id_tv_huafei_desc
?.
visibility
=
View
.
VISIBLE
holder
.
id_tv_huafei_desc
?.
visibility
=
View
.
VISIBLE
holder
.
id_tv_vip_goods_num
?.
visibility
=
View
.
GONE
holder
.
id_tv_vip_goods_num
?.
visibility
=
View
.
GONE
...
...
moduleMain/src/main/java/com/zxbw/modulemain/adapter/MyOrderAdapter.kt
View file @
7aa50b05
...
@@ -82,6 +82,7 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol
...
@@ -82,6 +82,7 @@ class MyOrderAdapter : BaseRecyclerAdapter<ShopOrderEntity, RecyclerView.ViewHol
val
huafeiDetailEntity
=
RightsDetailEntity
()
val
huafeiDetailEntity
=
RightsDetailEntity
()
huafeiDetailEntity
.
salePrice
=
bean
.
cash
huafeiDetailEntity
.
salePrice
=
bean
.
cash
huafeiDetailEntity
.
goodsName
=
bean
.
orderNotes
huafeiDetailEntity
.
goodsName
=
bean
.
orderNotes
huafeiDetailEntity
.
status
=
bean
.
orderStatus
bean
.
equitCard
=
listOf
(
huafeiDetailEntity
)
bean
.
equitCard
=
listOf
(
huafeiDetailEntity
)
}
}
}
else
{
}
else
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/box/activity/NewBoxGoodsDetailActivity.kt
View file @
7aa50b05
...
@@ -458,6 +458,11 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
...
@@ -458,6 +458,11 @@ class NewBoxGoodsDetailActivity : BaseActivity(), GoodsDetailContract.View,
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
PayDialog
.
onNewIntent
(
intent
)
}
private
var
isPause
=
false
private
var
isPause
=
false
override
fun
onPause
()
{
override
fun
onPause
()
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/box/activity/OrderDetailActivity.kt
View file @
7aa50b05
...
@@ -300,6 +300,13 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
...
@@ -300,6 +300,13 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
payGoodsId
?:
""
,
payGoodsId
?:
""
,
pay_type
.
toString
()
pay_type
.
toString
()
)
)
}
else
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
mPayresenter
?.
requestSdPay
(
"xxsqshop://member_order"
,
this
,
payGoodsId
?:
""
,
pay_type
.
toString
(),
"7"
)
}
else
{
}
else
{
Log
.
d
(
"wxw"
,
"goodsID"
+
payGoodsId
)
Log
.
d
(
"wxw"
,
"goodsID"
+
payGoodsId
)
mPayresenter
?.
requestMiniProgrom
(
mPayresenter
?.
requestMiniProgrom
(
...
@@ -316,6 +323,21 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
...
@@ -316,6 +323,21 @@ class OrderDetailActivity : BaseActivity(), OrderDetailContract.View, PayContrac
}
}
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
val
data
=
intent
?.
data
if
(
data
!=
null
)
{
if
(
pay_type
==
PaymentConfig
.
SD_PAY
)
{
val
payCode
=
data
.
getQueryParameter
(
"payCode"
)
if
(
payCode
==
"2"
)
{
isPause
=
false
mPayresenter
?.
verifyPay
(
SettingPreference
.
getOutTradeNo
(),
pay_type
!!
)
}
else
{
showResultLoading
(
false
)
}
}
}
}
fun
initPayConfig
()
{
fun
initPayConfig
()
{
mPayresenter
=
PayPresenter
(
this
)
mPayresenter
=
PayPresenter
(
this
)
...
...
moduleMain/src/main/java/com/zxbw/modulemain/contract/CardDetailContract.kt
View file @
7aa50b05
...
@@ -15,7 +15,7 @@ class CardDetailContract {
...
@@ -15,7 +15,7 @@ class CardDetailContract {
}
}
interface
Presenter
{
interface
Presenter
{
fun
requestRightsAliPay
(
goodsId
:
String
,
payType
:
String
,
phone
:
String
,
type
:
String
,
skill
:
Boolean
?,
outTradeNo
:
String
?)
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
,
type
:
String
,
skill
:
Boolean
?,
outTradeNo
:
String
?)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/contract/RechargeContract.kt
View file @
7aa50b05
...
@@ -24,6 +24,7 @@ class RechargeContract {
...
@@ -24,6 +24,7 @@ class RechargeContract {
fun
getFetchCard
()
fun
getFetchCard
()
fun
getPayList
(
payModel
:
String
)
fun
getPayList
(
payModel
:
String
)
fun
requestRightsAliPay
(
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
goodsId
:
String
,
payType
:
String
,
payType
:
String
,
phone
:
String
,
phone
:
String
,
...
...
moduleMain/src/main/java/com/zxbw/modulemain/contract/RightsPayContract.kt
View file @
7aa50b05
...
@@ -23,7 +23,7 @@ class RightsPayContract {
...
@@ -23,7 +23,7 @@ class RightsPayContract {
}
}
interface
Presenter
{
interface
Presenter
{
fun
requestRightsAliPay
(
goodsId
:
String
,
payType
:
String
,
phone
:
String
)
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/fragment/MagicBoxOrderFragment.kt
View file @
7aa50b05
...
@@ -13,10 +13,7 @@ import com.zxbw.modulemain.presenter.BoxOrderPresenter
...
@@ -13,10 +13,7 @@ import com.zxbw.modulemain.presenter.BoxOrderPresenter
import
com.zxhl.cms.common.base.BaseFragment
import
com.zxhl.cms.common.base.BaseFragment
import
com.zxhl.cms.net.model.box.NoticeEntity
import
com.zxhl.cms.net.model.box.NoticeEntity
import
com.zxhl.cms.net.model.box.ShopOrderEntity
import
com.zxhl.cms.net.model.box.ShopOrderEntity
import
com.zxhl.cms.utils.Utils
import
kotlinx.android.synthetic.main.fragment_layout_magic_box_order.*
import
kotlinx.android.synthetic.main.fragment_layout_magic_box_order.*
import
kotlinx.android.synthetic.main.fragment_layout_magic_box_order.id_refresh_view
import
kotlinx.android.synthetic.main.fragment_layout_recommend.*
class
MagicBoxOrderFragment
:
BaseFragment
(),
BoxOrderContract
.
View
{
class
MagicBoxOrderFragment
:
BaseFragment
(),
BoxOrderContract
.
View
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/CardDetailPresenter.kt
View file @
7aa50b05
...
@@ -7,6 +7,7 @@ import com.zxhl.cms.net.RxSchedulers
...
@@ -7,6 +7,7 @@ import com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.UserDataUtils
import
org.json.JSONObject
import
org.json.JSONObject
...
@@ -21,9 +22,25 @@ class CardDetailPresenter : CardDetailContract.Presenter {
...
@@ -21,9 +22,25 @@ class CardDetailPresenter : CardDetailContract.Presenter {
}
}
override
fun
requestRightsAliPay
(
goodsId
:
String
,
payType
:
String
,
phone
:
String
,
type
:
String
,
skill
:
Boolean
?,
outTradeNo
:
String
?)
{
override
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
,
type
:
String
,
skill
:
Boolean
?,
outTradeNo
:
String
?
)
{
ApiClient
.
userInfoAPi
.
aliPayRights
(
goodsId
,
payType
,
phone
,
type
,
skill
,
outTradeNo
)
ApiClient
.
userInfoAPi
.
aliPayRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
type
,
skill
,
outTradeNo
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
...
@@ -65,13 +82,17 @@ class CardDetailPresenter : CardDetailContract.Presenter {
...
@@ -65,13 +82,17 @@ class CardDetailPresenter : CardDetailContract.Presenter {
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
}
else
if
(
payType
==
21
)
{
}
else
if
(
payType
==
21
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
else
{
}
else
{
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
}
}
}
else
{
}
else
if
(
payType
==
PaymentConfig
.
SD_PAY
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
else
{
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
@@ -88,7 +109,7 @@ class CardDetailPresenter : CardDetailContract.Presenter {
...
@@ -88,7 +109,7 @@ class CardDetailPresenter : CardDetailContract.Presenter {
if
(
TextUtils
.
equals
(
"200"
,
result
.
status
))
{
if
(
TextUtils
.
equals
(
"200"
,
result
.
status
))
{
mView
?.
verifyOrderSuc
(
result
.
payStatus
)
mView
?.
verifyOrderSuc
(
result
.
payStatus
)
}
else
{
}
else
{
mView
?.
verifyOrderFail
(
"订单校验请求成功 校验异常${result?.status
?:
-1}"
)
mView
?.
verifyOrderFail
(
"订单校验请求成功 校验异常${result?.status
?:
-1}"
)
}
}
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/HomePresenter.kt
View file @
7aa50b05
...
@@ -3,6 +3,7 @@ package com.zxbw.modulemain.presenter
...
@@ -3,6 +3,7 @@ package com.zxbw.modulemain.presenter
import
android.content.Context
import
android.content.Context
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
import
com.zxbw.modulemain.R
import
com.zxbw.modulemain.contract.HomeContract
import
com.zxbw.modulemain.contract.HomeContract
import
com.zxbw.modulemain.contract.HomeRecommendContract
import
com.zxbw.modulemain.contract.HomeRecommendContract
import
com.zxbw.modulemain.contract.LoginContract
import
com.zxbw.modulemain.contract.LoginContract
...
@@ -19,6 +20,8 @@ import com.zxhl.cms.net.model.qy.TbGoodsEntity
...
@@ -19,6 +20,8 @@ import com.zxhl.cms.net.model.qy.TbGoodsEntity
import
com.zxhl.cms.net.model.uc.UserInfo
import
com.zxhl.cms.net.model.uc.UserInfo
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.Utils
import
kotlinx.android.synthetic.main.activity_layout_open_member.*
/**
/**
* 主页
* 主页
...
@@ -36,7 +39,15 @@ class HomePresenter : HomeContract.Presenter {
...
@@ -36,7 +39,15 @@ class HomePresenter : HomeContract.Presenter {
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
List
<
HomeBannerEntity
>>()
{
.
subscribe
(
object
:
BaseObserver
<
List
<
HomeBannerEntity
>>()
{
override
fun
onSuccess
(
result
:
List
<
HomeBannerEntity
>?)
{
override
fun
onSuccess
(
result
:
List
<
HomeBannerEntity
>?)
{
mView
.
setBannerList
(
result
)
if
(
TextUtils
.
equals
(
SettingPreference
.
getSource
(),
"sh"
))
{
val
toMutableList
=
result
?.
toMutableList
()
var
entity
=
HomeBannerEntity
()
entity
.
bannerType
=
"hua_fei"
toMutableList
?.
add
(
0
,
entity
)
mView
.
setBannerList
(
toMutableList
?.
toList
())
}
else
{
mView
.
setBannerList
(
result
)
}
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/RechargePresenter.kt
View file @
7aa50b05
...
@@ -10,6 +10,7 @@ import com.zxhl.cms.net.model.qy.CouponsEntity
...
@@ -10,6 +10,7 @@ import com.zxhl.cms.net.model.qy.CouponsEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.UserDataUtils
import
org.json.JSONObject
import
org.json.JSONObject
...
@@ -53,6 +54,7 @@ class RechargePresenter : RechargeContract.Presenter {
...
@@ -53,6 +54,7 @@ class RechargePresenter : RechargeContract.Presenter {
}
}
override
fun
requestRightsAliPay
(
override
fun
requestRightsAliPay
(
jumpScheme
:
String
,
goodsId
:
String
,
goodsId
:
String
,
payType
:
String
,
payType
:
String
,
phone
:
String
,
phone
:
String
,
...
@@ -62,7 +64,17 @@ class RechargePresenter : RechargeContract.Presenter {
...
@@ -62,7 +64,17 @@ class RechargePresenter : RechargeContract.Presenter {
couponId
:
String
?,
couponId
:
String
?,
mobileOp
:
String
?
mobileOp
:
String
?
)
{
)
{
ApiClient
.
userInfoAPi
.
aliPayRights
(
goodsId
,
payType
,
phone
,
type
,
skill
,
outTradeNo
,
couponId
,
mobileOp
)
ApiClient
.
userInfoAPi
.
aliPayRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
type
,
skill
,
outTradeNo
,
couponId
,
mobileOp
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
...
@@ -104,13 +116,17 @@ class RechargePresenter : RechargeContract.Presenter {
...
@@ -104,13 +116,17 @@ class RechargePresenter : RechargeContract.Presenter {
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
}
else
if
(
payType
==
21
)
{
}
else
if
(
payType
==
21
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
else
{
}
else
{
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
}
}
}
else
{
}
else
if
(
payType
==
PaymentConfig
.
SD_PAY
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
else
{
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
@@ -143,7 +159,7 @@ class RechargePresenter : RechargeContract.Presenter {
...
@@ -143,7 +159,7 @@ class RechargePresenter : RechargeContract.Presenter {
if
(
TextUtils
.
equals
(
"200"
,
result
.
status
))
{
if
(
TextUtils
.
equals
(
"200"
,
result
.
status
))
{
mView
?.
verifyOrderSuc
(
result
.
payStatus
)
mView
?.
verifyOrderSuc
(
result
.
payStatus
)
}
else
{
}
else
{
mView
?.
verifyOrderFail
(
"订单校验请求成功 校验异常${result?.status
?:
-1}"
)
mView
?.
verifyOrderFail
(
"订单校验请求成功 校验异常${result?.status
?:
-1}"
)
}
}
}
}
...
...
moduleMain/src/main/java/com/zxbw/modulemain/presenter/RightsPayPresenter.kt
View file @
7aa50b05
package
com.zxbw.modulemain.presenter
package
com.zxbw.modulemain.presenter
import
android.app.Activity
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
com.zxbw.modulemain.contract.RightsPayContract
import
com.zxbw.modulemain.contract.RightsPayContract
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.ApiClient
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.callback.BaseObserver
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.box.BoxInfoEntity
import
com.zxhl.cms.net.model.box.VerifacationEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.AliPayEntity
import
com.zxhl.cms.net.model.uc.PayMinEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.uc.PayVerifyEntity
import
com.zxhl.cms.net.model.uc.WeChatPayEntity
import
com.zxhl.cms.pay.PaymentConfig
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.pay.alipay.AlipayServer
import
com.zxhl.cms.utils.EventUtils
import
com.zxhl.cms.utils.JumpUtils
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.UserDataUtils
import
com.zxhl.cms.utils.WeChatPay
import
org.json.JSONObject
import
org.json.JSONObject
/**
/**
...
@@ -37,8 +24,13 @@ class RightsPayPresenter : RightsPayContract.Presenter {
...
@@ -37,8 +24,13 @@ class RightsPayPresenter : RightsPayContract.Presenter {
}
}
override
fun
requestRightsAliPay
(
goodsId
:
String
,
payType
:
String
,
phone
:
String
)
{
override
fun
requestRightsAliPay
(
ApiClient
.
userInfoAPi
.
aliPayRights
(
goodsId
,
payType
,
phone
,
"50"
,
false
,
""
)
jumpScheme
:
String
,
goodsId
:
String
,
payType
:
String
,
phone
:
String
)
{
ApiClient
.
userInfoAPi
.
aliPayRights
(
jumpScheme
,
goodsId
,
payType
,
phone
,
"50"
,
false
,
""
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
.
subscribe
(
object
:
BaseObserver
<
AliPayEntity
>()
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
override
fun
onSuccess
(
result
:
AliPayEntity
?)
{
...
@@ -57,18 +49,18 @@ class RightsPayPresenter : RightsPayContract.Presenter {
...
@@ -57,18 +49,18 @@ class RightsPayPresenter : RightsPayContract.Presenter {
override
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
{
override
fun
verifyPay
(
order
:
String
?,
payType
:
Int
)
{
try
{
try
{
if
(
payType
==
1
)
{
if
(
payType
==
PaymentConfig
.
ALI_PAY
)
{
val
json
=
JSONObject
(
order
)
val
json
=
JSONObject
(
order
)
val
obj
=
json
.
getJSONObject
(
"alipay_trade_app_pay_response"
)
val
obj
=
json
.
getJSONObject
(
"alipay_trade_app_pay_response"
)
val
tradeOrder
=
obj
.
getString
(
"trade_no"
)
val
tradeOrder
=
obj
.
getString
(
"trade_no"
)
val
outTradeOrder
=
obj
.
getString
(
"out_trade_no"
)
val
outTradeOrder
=
obj
.
getString
(
"out_trade_no"
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
}
else
if
(
payType
==
2
)
{
}
else
if
(
payType
==
PaymentConfig
.
WECHAT_PAY
)
{
val
json
=
JSONObject
(
order
)
val
json
=
JSONObject
(
order
)
val
tradeOrder
=
""
val
tradeOrder
=
""
val
outTradeOrder
=
json
.
getString
(
"extData"
)
val
outTradeOrder
=
json
.
getString
(
"extData"
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
requestVerify
(
outTradeOrder
,
tradeOrder
,
payType
)
}
else
if
(
payType
==
11
)
{
}
else
if
(
payType
==
PaymentConfig
.
MINI_PROGRAM
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
...
@@ -76,17 +68,21 @@ class RightsPayPresenter : RightsPayContract.Presenter {
...
@@ -76,17 +68,21 @@ class RightsPayPresenter : RightsPayContract.Presenter {
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
}
else
if
(
payType
==
13
)
{
}
else
if
(
payType
==
PaymentConfig
.
MIN_PAY_PROGRAM
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
}
else
if
(
payType
==
21
)
{
}
else
if
(
payType
==
PaymentConfig
.
H5_PAY
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
requestVerify
(
order
?:
""
,
""
,
payType
)
}
else
{
}
else
{
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
mView
?.
verifyOrderFail
(
"支付成功后 订单id为null"
)
}
}
}
else
{
}
else
if
(
payType
==
PaymentConfig
.
SD_PAY
)
{
if
(!
TextUtils
.
isEmpty
(
order
))
{
requestVerify
(
order
?:
""
,
""
,
payType
)
}
}
else
{
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
mView
.
verifyOrderFail
(
"支付成功后 开始校验订单异常 e:支付方式异常$payType"
)
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
moduleMain/src/main/res/drawable-xhdpi/img_banner_hf_bg.png
0 → 100644
View file @
7aa50b05
169 KB
moduleMain/src/main/res/drawable-xhdpi/img_open_vip_top_sh.png
0 → 100644
View file @
7aa50b05
271 KB
moduleZxAd/src/main/java/com/zx/ad/AdManager.kt
View file @
7aa50b05
...
@@ -102,7 +102,7 @@ object AdManager {
...
@@ -102,7 +102,7 @@ object AdManager {
fun
loadSplashAd
(
context
:
Activity
,
mSplashContainer
:
FrameLayout
,
listener
:
SplashAdListener
)
{
fun
loadSplashAd
(
context
:
Activity
,
mSplashContainer
:
FrameLayout
,
listener
:
SplashAdListener
)
{
if
(
context
.
is
Finishing
)
{
if
(
context
.
is
Destroyed
)
{
return
return
}
}
if
(
isLoadSplash
)
{
if
(
isLoadSplash
)
{
...
@@ -115,25 +115,6 @@ object AdManager {
...
@@ -115,25 +115,6 @@ object AdManager {
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
List
<
NewsEntity
>?>()
{
.
subscribe
(
object
:
BaseObserver
<
List
<
NewsEntity
>?>()
{
override
fun
onSuccess
(
result
:
List
<
NewsEntity
>?)
{
override
fun
onSuccess
(
result
:
List
<
NewsEntity
>?)
{
//本次针对穿山甲处理,当加入其它平台时需要测试未初始化的情况下,是否有error回调
if
(!
TTAdSdk
.
isInitSuccess
())
{
CSJAdManager
.
adInit
(
context
,
"5306826"
,
object
:
TTAdSdk
.
InitCallback
{
override
fun
success
()
{
if
(
result
.
isNullOrEmpty
())
{
isLoadSplash
=
false
listener
.
onError
(
"loadSplashAd IS NULL"
)
}
else
{
loadingSplashAd
(
context
,
result
,
mSplashContainer
,
listener
)
}
}
override
fun
fail
(
p0
:
Int
,
p1
:
String
?)
{
isLoadSplash
=
false
listener
.
onError
(
"AdSDK_NOT_INIT"
+
TTAdSdk
.
isInitSuccess
())
}
})
return
}
if
(
result
.
isNullOrEmpty
())
{
if
(
result
.
isNullOrEmpty
())
{
isLoadSplash
=
false
isLoadSplash
=
false
listener
.
onError
(
"loadSplashAd IS NULL"
)
listener
.
onError
(
"loadSplashAd IS NULL"
)
...
...
moduleZxAd/src/main/java/com/zx/ad/platform/csj/CSJAdManager.kt
View file @
7aa50b05
...
@@ -7,6 +7,7 @@ import android.util.Log
...
@@ -7,6 +7,7 @@ import android.util.Log
import
android.view.View
import
android.view.View
import
android.widget.FrameLayout
import
android.widget.FrameLayout
import
com.bytedance.sdk.openadsdk.*
import
com.bytedance.sdk.openadsdk.*
import
com.zx.ad.AdManager
import
com.zx.ad.callback.AdLoadCallBack
import
com.zx.ad.callback.AdLoadCallBack
import
com.zx.ad.callback.RewardVideoAdListener
import
com.zx.ad.callback.RewardVideoAdListener
import
com.zx.ad.callback.SplashAdListener
import
com.zx.ad.callback.SplashAdListener
...
@@ -24,8 +25,8 @@ import com.zx.ad.utils.UIUtils
...
@@ -24,8 +25,8 @@ import com.zx.ad.utils.UIUtils
*/
*/
object
CSJAdManager
{
object
CSJAdManager
{
private
var
mTTAdNative
:
TTAdNative
?
=
null
private
var
mTTAdNative
:
TTAdNative
?
=
null
fun
adInit
(
context
:
Context
,
appId
:
String
,
initCallback
:
TTAdSdk
.
InitCallback
?)
{
fun
adInit
(
context
:
Context
,
appId
:
String
,
initCallback
:
TTAdSdk
.
InitCallback
?)
{
TTAdManagerHolder
.
init
(
context
,
appId
,
initCallback
)
TTAdManagerHolder
.
init
(
context
,
appId
,
initCallback
)
// TTAdManagerHolder.init(context, "5001121")
// TTAdManagerHolder.init(context, "5001121")
}
}
...
@@ -35,8 +36,26 @@ object CSJAdManager {
...
@@ -35,8 +36,26 @@ object CSJAdManager {
* 加载开屏广告
* 加载开屏广告
*/
*/
fun
loadSplashAd
(
context
:
Context
,
entity
:
NewsEntity
,
loadCallBack
:
AdLoadCallBack
)
{
fun
loadSplashAd
(
context
:
Context
,
entity
:
NewsEntity
,
loadCallBack
:
AdLoadCallBack
)
{
//本次针对穿山甲处理,当加入其它平台时需要测试未初始化的情况下,是否有error回调
if
(!
TTAdSdk
.
isInitSuccess
())
{
adInit
(
context
,
entity
.
codeAppId
,
object
:
TTAdSdk
.
InitCallback
{
override
fun
success
()
{
loadSplashAd2
(
context
,
entity
,
loadCallBack
)
}
override
fun
fail
(
p0
:
Int
,
p1
:
String
?)
{
loadCallBack
.
OnAdLoadFail
(
"CSJ Ad Init Fail p0${p0} p1${p1}"
)
}
})
return
}
else
{
loadSplashAd2
(
context
,
entity
,
loadCallBack
)
}
}
private
fun
loadSplashAd2
(
context
:
Context
,
entity
:
NewsEntity
,
loadCallBack
:
AdLoadCallBack
)
{
mTTAdNative
=
TTAdManagerHolder
.
get
().
createAdNative
(
context
)
mTTAdNative
=
TTAdManagerHolder
.
get
().
createAdNative
(
context
)
if
(
mTTAdNative
==
null
)
{
if
(
mTTAdNative
==
null
)
{
loadCallBack
.
OnAdLoadFail
(
"loadSplashAd mTTAdNative is null"
)
loadCallBack
.
OnAdLoadFail
(
"loadSplashAd mTTAdNative is null"
)
return
return
}
}
...
@@ -51,7 +70,7 @@ object CSJAdManager {
...
@@ -51,7 +70,7 @@ object CSJAdManager {
.
build
()
.
build
()
mTTAdNative
?.
loadSplashAd
(
adSlot
,
object
:
TTAdNative
.
SplashAdListener
{
mTTAdNative
?.
loadSplashAd
(
adSlot
,
object
:
TTAdNative
.
SplashAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
Log
.
d
(
"AdManager"
,
"p0"
+
p0
)
Log
.
d
(
"AdManager"
,
"p0"
+
p0
)
AdEventUtils
.
onEventPullFail
(
entity
)
AdEventUtils
.
onEventPullFail
(
entity
)
loadCallBack
.
OnAdLoadFail
(
"CSJ p0:${p0} p1:${p1}"
)
loadCallBack
.
OnAdLoadFail
(
"CSJ p0:${p0} p1:${p1}"
)
}
}
...
@@ -63,7 +82,7 @@ object CSJAdManager {
...
@@ -63,7 +82,7 @@ object CSJAdManager {
override
fun
onSplashAdLoad
(
p0
:
TTSplashAd
?)
{
override
fun
onSplashAdLoad
(
p0
:
TTSplashAd
?)
{
AdEventUtils
.
onEventPullSuccess
(
entity
)
AdEventUtils
.
onEventPullSuccess
(
entity
)
splashAd
=
p0
;
splashAd
=
p0
;
loadCallBack
.
OnAdLoadSuccess
(
ADType
.
PLATFORM_AD_TT
,
entity
)
loadCallBack
.
OnAdLoadSuccess
(
ADType
.
PLATFORM_AD_TT
,
entity
)
}
}
})
})
}
}
...
@@ -148,7 +167,7 @@ object CSJAdManager {
...
@@ -148,7 +167,7 @@ object CSJAdManager {
override
fun
onRewardVideoCached
(
p0
:
TTRewardVideoAd
?)
{
override
fun
onRewardVideoCached
(
p0
:
TTRewardVideoAd
?)
{
rewardVideoAd
=
p0
rewardVideoAd
=
p0
loadCallBack
.
OnAdLoadSuccess
(
ADType
.
PLATFORM_AD_TT
,
entity
)
loadCallBack
.
OnAdLoadSuccess
(
ADType
.
PLATFORM_AD_TT
,
entity
)
}
}
})
})
}
}
...
@@ -219,7 +238,7 @@ object CSJAdManager {
...
@@ -219,7 +238,7 @@ object CSJAdManager {
})
})
rewardVideoAd
?.
showRewardVideoAd
(
context
)
rewardVideoAd
?.
showRewardVideoAd
(
context
)
}
else
{
}
else
{
listener
.
onRewardVideoAdError
(
"context is finish"
)
listener
.
onRewardVideoAdError
(
"context is finish"
)
}
}
}
}
...
...
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