Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
M
magicbox
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
王雪伟
magicbox
Commits
18372f31
Commit
18372f31
authored
Apr 02, 2022
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :加入上报事件戳 [实现方案] :
parent
e3d59db6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
21 deletions
+154
-21
Appli.kt
app/src/main/java/com/zhangxin/magicbox/Appli.kt
+1
-1
version.properties
app/version.properties
+2
-2
GooglePayHelper.kt
cms/src/main/java/com/zxhl/cms/googlepay/GooglePayHelper.kt
+137
-10
PayActivity.kt
cms/src/main/java/com/zxhl/cms/pay/PayActivity.kt
+6
-1
EventUtils.kt
cms/src/main/java/com/zxhl/cms/utils/EventUtils.kt
+8
-7
No files found.
app/src/main/java/com/zhangxin/magicbox/Appli.kt
View file @
18372f31
...
@@ -48,7 +48,7 @@ class Appli : Application() {
...
@@ -48,7 +48,7 @@ class Appli : Application() {
val
afDevKey
=
"bbVuECGrv5oci77w97NMVg"
val
afDevKey
=
"bbVuECGrv5oci77w97NMVg"
val
appsflyer
:
AppsFlyerLib
=
AppsFlyerLib
.
getInstance
()
val
appsflyer
:
AppsFlyerLib
=
AppsFlyerLib
.
getInstance
()
// For debug - remove in production
// For debug - remove in production
appsflyer
.
setDebugLog
(
tru
e
)
appsflyer
.
setDebugLog
(
fals
e
)
//optional
//optional
appsflyer
.
setMinTimeBetweenSessions
(
0
)
appsflyer
.
setMinTimeBetweenSessions
(
0
)
appsflyer
.
init
(
afDevKey
,
null
,
this
)
appsflyer
.
init
(
afDevKey
,
null
,
this
)
...
...
app/version.properties
View file @
18372f31
PACKAGE_NAME
=
com.zhangxin.magicbox
PACKAGE_NAME
=
com.zhangxin.magicbox
VERSION_CODE
=
13
VERSION_CODE
=
14
VERSION_NAME
=
1.0.3.5
VERSION_NAME
=
1.0.3.6
\ No newline at end of file
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/googlepay/GooglePayHelper.kt
View file @
18372f31
...
@@ -40,6 +40,10 @@ class GooglePayHelper {
...
@@ -40,6 +40,10 @@ class GooglePayHelper {
// To be implemented in a later section.
// To be implemented in a later section.
Log
.
d
(
TAG
,
"购买监听 code ${billingResult.responseCode}"
)
Log
.
d
(
TAG
,
"购买监听 code ${billingResult.responseCode}"
)
Log
.
d
(
TAG
,
"购买监听 size ${purchases?.size}"
)
Log
.
d
(
TAG
,
"购买监听 size ${purchases?.size}"
)
EventUtils
.
onEvent
(
"GooglePayGotoPayE"
,
"Google支付结束回调结果 code${billingResult.responseCode}"
)
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
//支付成功 同步后台
//支付成功 同步后台
if
(!
purchases
.
isNullOrEmpty
())
{
if
(!
purchases
.
isNullOrEmpty
())
{
...
@@ -61,6 +65,8 @@ class GooglePayHelper {
...
@@ -61,6 +65,8 @@ class GooglePayHelper {
//购买成功 消耗掉
//购买成功 消耗掉
consume
(
googlePayResult
,
purchase
)
consume
(
googlePayResult
,
purchase
)
}
}
}
else
{
mPayCallBack
?.
onError
(
"支付异常: google支付成功,未获取到商品结果信息"
)
}
}
}
else
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
ITEM_ALREADY_OWNED
)
{
}
else
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
ITEM_ALREADY_OWNED
)
{
//未消耗掉
//未消耗掉
...
@@ -138,13 +144,15 @@ class GooglePayHelper {
...
@@ -138,13 +144,15 @@ class GooglePayHelper {
}
}
})
})
}
}
}
}
/**
/**
* 购买商品
* 购买商品
*/
*/
private
fun
purchase
(
mSku
:
String
,
orderId
:
String
)
{
private
fun
purchase
(
mSku
:
String
,
orderId
:
String
)
{
EventUtils
.
onEvent
(
"GooglePayPurchaseS"
,
"预备购买Google商品"
)
productId
=
mSku
productId
=
mSku
obfuscatedAccountid
=
orderId
obfuscatedAccountid
=
orderId
if
(
billingClient
.
isReady
)
{
if
(
billingClient
.
isReady
)
{
...
@@ -152,6 +160,9 @@ class GooglePayHelper {
...
@@ -152,6 +160,9 @@ class GooglePayHelper {
skuList
.
add
(
mSku
)
skuList
.
add
(
mSku
)
val
params
=
SkuDetailsParams
.
newBuilder
()
val
params
=
SkuDetailsParams
.
newBuilder
()
params
.
setSkusList
(
skuList
).
setType
(
SkuType
.
INAPP
)
params
.
setSkusList
(
skuList
).
setType
(
SkuType
.
INAPP
)
EventUtils
.
onEvent
(
"GooglePayQuerySkuS"
,
"开始查询Google商品"
)
billingClient
.
querySkuDetailsAsync
(
billingClient
.
querySkuDetailsAsync
(
params
.
build
()
params
.
build
()
)
{
billingResult
,
skuDetailsList
->
)
{
billingResult
,
skuDetailsList
->
...
@@ -166,6 +177,11 @@ class GooglePayHelper {
...
@@ -166,6 +177,11 @@ class GooglePayHelper {
// .setObfuscatedProfileId()
// .setObfuscatedProfileId()
.
setObfuscatedAccountId
(
orderId
)
.
setObfuscatedAccountId
(
orderId
)
.
build
()
.
build
()
EventUtils
.
onEvent
(
"GooglePayGotoPayS"
,
"查询成功,开始吊起Google支付"
)
//吊起支付
//吊起支付
val
responseCode
=
val
responseCode
=
billingClient
.
launchBillingFlow
(
billingClient
.
launchBillingFlow
(
...
@@ -173,42 +189,77 @@ class GooglePayHelper {
...
@@ -173,42 +189,77 @@ class GooglePayHelper {
flowParams
flowParams
).
responseCode
).
responseCode
Log
.
d
(
TAG
,
"purchase 去支付 code $responseCode"
)
Log
.
d
(
TAG
,
"purchase 去支付 code $responseCode"
)
EventUtils
.
onEvent
(
"GooglePayQuerySkuE"
,
"查询商品结束 吊起支付Code:${responseCode}"
)
EventUtils
.
onEvent
(
"GooglePayPurchaseE"
,
"预备购买结束"
)
break
break
}
else
{
}
else
{
if
(
i
==
skuDetailsList
.
size
-
1
)
{
if
(
i
==
skuDetailsList
.
size
-
1
)
{
mPayCallBack
?.
onError
(
"GooglePay 未匹配到对应的商品"
)
EventUtils
.
onEvent
(
"GooglePayQuerySkuE"
,
"查询商品结束 未匹配到对应的商品:${mSku}"
)
mPayCallBack
?.
onError
(
"GooglePay 未匹配到对应的商品${mSku}"
)
}
}
}
}
}
}
}
else
{
}
else
{
Log
.
d
(
TAG
,
"purchase 未查询到商品"
)
Log
.
d
(
TAG
,
"purchase 未查询到商品"
)
mPayCallBack
?.
onError
(
"GooglePay 商品未查询到"
)
EventUtils
.
onEvent
(
"GooglePayQuerySkuE"
,
"未查询到Google商品列表"
)
mPayCallBack
?.
onError
(
"GooglePay 未查询到Google商品列表"
)
}
}
}
else
{
}
else
{
Log
.
d
(
TAG
,
"purchase 查询连接失败 cede"
+
billingResult
.
responseCode
)
Log
.
d
(
TAG
,
"purchase 查询连接失败 cede"
+
billingResult
.
responseCode
)
EventUtils
.
onEvent
(
"GooglePayQuerySkuE"
,
"商品查询连接失败 cede${billingResult.responseCode}"
)
mPayCallBack
?.
onError
(
"GooglePay error code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
mPayCallBack
?.
onError
(
"GooglePay error code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
}
}
}
}
}
else
{
}
else
{
Log
.
d
(
TAG
,
"purchase 购买 未连接"
)
EventUtils
.
onEvent
(
"GooglePayPurchaseE"
,
"预备购买未连接到Google"
)
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
//BillingClient准备好了。你可以在这里查询购买情况。
//BillingClient准备好了。你可以在这里查询购买情况。
purchase
(
mSku
,
orderId
)
purchase
(
mSku
,
orderId
)
}
else
{
}
else
{
EventUtils
.
onEvent
(
"GooglePayPurchaseE"
,
"预备购买重连失败 code:${billingResult.responseCode}"
)
mPayCallBack
?.
onError
(
"purchase 购买 连接失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
mPayCallBack
?.
onError
(
"purchase 购买 连接失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
}
}
}
}
override
fun
onBillingServiceDisconnected
()
{
override
fun
onBillingServiceDisconnected
()
{
// Try to restart the connection on the next request to
EventUtils
.
onEvent
(
// Google Play by calling the startConnection() method.
"GooglePayPurchaseE"
,
"预备购买重连失败 Disconnected"
)
mPayCallBack
?.
onError
(
"purchase 购买连接失败 onBillingServiceDisconnected"
)
mPayCallBack
?.
onError
(
"purchase 购买连接失败 onBillingServiceDisconnected"
)
}
}
})
})
// mPayCallBack?.onError("GooglePay purchase 购买 未连接")
}
}
}
}
...
@@ -218,6 +269,10 @@ class GooglePayHelper {
...
@@ -218,6 +269,10 @@ class GooglePayHelper {
* @param purchaseToken 商品token
* @param purchaseToken 商品token
*/
*/
private
fun
consume
(
googlePayResult
:
GooglePayResult
,
purchase
:
Purchase
)
{
private
fun
consume
(
googlePayResult
:
GooglePayResult
,
purchase
:
Purchase
)
{
EventUtils
.
onEvent
(
"GooglePayConsumeS"
,
"支付成功,开始消耗商品"
)
if
(
billingClient
.
isReady
)
{
if
(
billingClient
.
isReady
)
{
val
consumeParams
=
val
consumeParams
=
ConsumeParams
.
newBuilder
()
ConsumeParams
.
newBuilder
()
...
@@ -229,16 +284,33 @@ class GooglePayHelper {
...
@@ -229,16 +284,33 @@ class GooglePayHelper {
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
// Handle the success of the consume operation.
// Handle the success of the consume operation.
// Log.d(TAG, "consume 1消耗成功${googlePayResult.purchaseToken}")
// Log.d(TAG, "consume 1消耗成功${googlePayResult.purchaseToken}")
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"消耗商品成功"
)
//同步后台 消耗掉
//同步后台 消耗掉
updateToService
(
googlePayResult
,
purchase
)
updateToService
(
googlePayResult
,
purchase
)
productId
=
""
productId
=
""
obfuscatedAccountid
=
""
obfuscatedAccountid
=
""
}
else
{
}
else
{
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"商品消耗失败 code${billingResult.responseCode}}"
)
Log
.
d
(
TAG
,
"consume 消耗失败 code:"
+
billingResult
.
responseCode
)
Log
.
d
(
TAG
,
"consume 消耗失败 code:"
+
billingResult
.
responseCode
)
mPayCallBack
?.
onError
(
"consume 消耗失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
//支付成功
mPayCallBack
?.
onError
(
"consume 消耗失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
//支付成功
}
}
}
}
}
else
{
}
else
{
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"消耗商品 未连接Google"
)
EventUtils
.
onEvent
(
"GooglePayConsumeS"
,
"支付成功,开始重连消耗商品"
)
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
...
@@ -253,17 +325,34 @@ class GooglePayHelper {
...
@@ -253,17 +325,34 @@ class GooglePayHelper {
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
// Handle the success of the consume operation.
// Handle the success of the consume operation.
Log
.
d
(
TAG
,
"consume 消耗成功${googlePayResult.purchaseToken}"
)
Log
.
d
(
TAG
,
"consume 消耗成功${googlePayResult.purchaseToken}"
)
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"重连成功 消耗商品成功"
)
//同步后台 消耗掉
//同步后台 消耗掉
updateToService
(
googlePayResult
,
purchase
)
updateToService
(
googlePayResult
,
purchase
)
productId
=
""
productId
=
""
obfuscatedAccountid
=
""
obfuscatedAccountid
=
""
}
else
{
}
else
{
Log
.
d
(
TAG
,
"consume 消耗失败 code:"
+
billingResult
.
responseCode
)
Log
.
d
(
TAG
,
"consume 消耗失败 code:"
+
billingResult
.
responseCode
)
mPayCallBack
?.
onError
(
"consume 消耗失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"重连成功 消耗商品失败code:${billingResult.responseCode}}"
)
mPayCallBack
?.
onError
(
"重连成功 消耗商品失败code:${billingResult.responseCode}"
)
}
}
}
}
}
else
{
}
else
{
// Log.d(TAG, "consume init 连接失败 code:" + billingResult.responseCode)
// Log.d(TAG, "consume init 连接失败 code:" + billingResult.responseCode)
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"消耗商品 重连失败code:${billingResult.responseCode}"
)
mPayCallBack
?.
onError
(
"consume 消耗连接失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
mPayCallBack
?.
onError
(
"consume 消耗连接失败 code:"
+
billingResult
.
responseCode
+
" msg:"
+
billingResult
.
debugMessage
)
}
}
}
}
...
@@ -271,6 +360,11 @@ class GooglePayHelper {
...
@@ -271,6 +360,11 @@ class GooglePayHelper {
override
fun
onBillingServiceDisconnected
()
{
override
fun
onBillingServiceDisconnected
()
{
// Try to restart the connection on the next request to
// Try to restart the connection on the next request to
// Google Play by calling the startConnection() method.
// Google Play by calling the startConnection() method.
EventUtils
.
onEvent
(
"GooglePayConsumeE"
,
"消耗商品重连失败 Disconnected"
)
mPayCallBack
?.
onError
(
"consume onBillingServiceDisconnected"
)
mPayCallBack
?.
onError
(
"consume onBillingServiceDisconnected"
)
}
}
})
})
...
@@ -475,6 +569,9 @@ class GooglePayHelper {
...
@@ -475,6 +569,9 @@ class GooglePayHelper {
* google支付
* google支付
*/
*/
fun
googlePay
(
goodsId
:
String
,
payMode
:
String
,
payCallBack
:
GooglePayCallBack
)
{
fun
googlePay
(
goodsId
:
String
,
payMode
:
String
,
payCallBack
:
GooglePayCallBack
)
{
EventUtils
.
onEvent
(
"GooglePayGetOrderIdS"
,
"获取订单号"
)
mPayCallBack
=
payCallBack
mPayCallBack
=
payCallBack
//向服务端获取订单ID
//向服务端获取订单ID
ApiClient
.
userInfoAPi
.
googlePay
(
goodsId
,
"4"
,
""
,
""
,
payMode
)
ApiClient
.
userInfoAPi
.
googlePay
(
goodsId
,
"4"
,
""
,
""
,
payMode
)
...
@@ -482,16 +579,30 @@ class GooglePayHelper {
...
@@ -482,16 +579,30 @@ class GooglePayHelper {
.
subscribe
(
object
:
BaseObserver
<
GooglePayEntity
>()
{
.
subscribe
(
object
:
BaseObserver
<
GooglePayEntity
>()
{
override
fun
onSuccess
(
result
:
GooglePayEntity
?)
{
override
fun
onSuccess
(
result
:
GooglePayEntity
?)
{
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
EventUtils
.
onEvent
(
"GooglePayGetOrderIdE"
,
"获取订单号_成功"
)
var
sku
=
goodsId
.
replace
(
"-"
,
"_"
)
var
sku
=
goodsId
.
replace
(
"-"
,
"_"
)
// Log.d(TAG, "请求支付${sku}")
purchase
(
"xymh_$sku"
,
result
.
outTradeNo
?:
""
)
purchase
(
"xymh_$sku"
,
result
.
outTradeNo
?:
""
)
}
else
{
}
else
{
EventUtils
.
onEvent
(
"GooglePayGetOrderIdE"
,
"未获取到订单数据"
)
mPayCallBack
?.
onError
(
"GooglePay 未获取到订单数据"
)
mPayCallBack
?.
onError
(
"GooglePay 未获取到订单数据"
)
}
}
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
// EventUtils.onEvent("GooglePay Fail:$errorMsg")
EventUtils
.
onEvent
(
"GooglePayGetOrderIdE"
,
"获取订单号接口异常:$errorMsg"
)
mPayCallBack
?.
onError
(
"订单接口 Error:$errorMsg"
)
mPayCallBack
?.
onError
(
"订单接口 Error:$errorMsg"
)
}
}
})
})
...
@@ -501,17 +612,33 @@ class GooglePayHelper {
...
@@ -501,17 +612,33 @@ class GooglePayHelper {
* google支付 成功后 同步给服务器
* google支付 成功后 同步给服务器
*/
*/
private
fun
updateToService
(
googlePayResult
:
GooglePayResult
,
purchase
:
Purchase
)
{
private
fun
updateToService
(
googlePayResult
:
GooglePayResult
,
purchase
:
Purchase
)
{
EventUtils
.
onEvent
(
"GooglePayToServiceS"
,
"google支付成功,开始同步后端校验"
)
//支付成功 向后端同步 网络问题再次重试
//支付成功 向后端同步 网络问题再次重试
ApiClient
.
shopApi
.
googlePaySuccess
(
googlePayResult
)
ApiClient
.
shopApi
.
googlePaySuccess
(
googlePayResult
)
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
compose
(
RxSchedulers
.
observableIO2Main
())
.
subscribe
(
object
:
BaseObserver
<
Any
>()
{
.
subscribe
(
object
:
BaseObserver
<
Any
>()
{
override
fun
onSuccess
(
result
:
Any
?)
{
override
fun
onSuccess
(
result
:
Any
?)
{
// EventUtils.onEvent("googlepaysuccess_onsuccess")
// EventUtils.onEvent("googlepaysuccess_onsuccess")
EventUtils
.
onEvent
(
"GooglePayToServiceE"
,
"google支付成功,后端校验成功"
)
mPayCallBack
?.
onPaySuccess
(
googlePayResult
,
purchase
.
originalJson
)
//支付成功
mPayCallBack
?.
onPaySuccess
(
googlePayResult
,
purchase
.
originalJson
)
//支付成功
}
}
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
override
fun
onFailure
(
e
:
Throwable
?,
code
:
String
?,
errorMsg
:
String
?)
{
// EventUtils.onEvent("googlepaysuccess_onfailure", "${errorMsg}")
// EventUtils.onEvent("googlepaysuccess_onfailure", "${errorMsg}")
EventUtils
.
onEvent
(
"GooglePayToServiceE"
,
"google支付成功,后端校验失败 code:$code msg:$errorMsg"
)
mPayCallBack
?.
onError
(
"服务器同步失败 code:$code msg:$errorMsg"
)
mPayCallBack
?.
onError
(
"服务器同步失败 code:$code msg:$errorMsg"
)
}
}
})
})
...
...
cms/src/main/java/com/zxhl/cms/pay/PayActivity.kt
View file @
18372f31
...
@@ -282,7 +282,6 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -282,7 +282,6 @@ class PayActivity : BaseActivity(), PayContract.View,
EventUtils
.
onEvent
(
"pay_fail"
)
EventUtils
.
onEvent
(
"pay_fail"
)
mLoading
?.
setResult
(
false
,
"Pay for failure"
,
1000
)
mLoading
?.
setResult
(
false
,
"Pay for failure"
,
1000
)
}
}
}
}
fun
setBootmPrice
()
{
fun
setBootmPrice
()
{
...
@@ -516,15 +515,18 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -516,15 +515,18 @@ class PayActivity : BaseActivity(), PayContract.View,
var
googlePay
:
GooglePayHelper
?
=
null
var
googlePay
:
GooglePayHelper
?
=
null
private
fun
googlePay
(
goodsId
:
String
)
{
private
fun
googlePay
(
goodsId
:
String
)
{
if
(
goodsId
==
""
)
{
if
(
goodsId
==
""
)
{
EventUtils
.
onEvent
(
"GooglePayGoodsIdNull"
)
return
return
}
}
mLoading
?.
setLoading
(
getString
(
R
.
string
.
wait_ing2
))
mLoading
?.
setLoading
(
getString
(
R
.
string
.
wait_ing2
))
mLoading
?.
show
()
mLoading
?.
show
()
EventUtils
.
onEvent
(
"GooglePayStart"
,
"开始支付"
)
googlePay
?.
googlePay
(
goodsId
,
"6"
,
object
:
GooglePayCallBack
{
googlePay
?.
googlePay
(
goodsId
,
"6"
,
object
:
GooglePayCallBack
{
override
fun
onPaySuccess
(
purchase
:
GooglePayResult
,
googleJson
:
String
)
{
override
fun
onPaySuccess
(
purchase
:
GooglePayResult
,
googleJson
:
String
)
{
mPresenter
?.
verifyPay
(
googleJson
,
GOOGLE_PAY
)
mPresenter
?.
verifyPay
(
googleJson
,
GOOGLE_PAY
)
//mLoading?.setResult(true, "Pay for success", 1000)
//mLoading?.setResult(true, "Pay for success", 1000)
EventUtils
.
onEvent
(
"GooglePaySuccess"
)
EventUtils
.
onEvent
(
"GooglePaySuccess"
)
EventUtils
.
onEvent
(
"GooglePayEnd"
,
"支付结束_成功"
)
}
}
override
fun
onCancel
()
{
override
fun
onCancel
()
{
...
@@ -532,6 +534,7 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -532,6 +534,7 @@ class PayActivity : BaseActivity(), PayContract.View,
mLoading
?.
setResult
(
false
,
"pay cancel"
,
1000
)
mLoading
?.
setResult
(
false
,
"pay cancel"
,
1000
)
}
}
EventUtils
.
onEvent
(
"GooglePayCancel"
)
EventUtils
.
onEvent
(
"GooglePayCancel"
)
EventUtils
.
onEvent
(
"GooglePayEnd"
,
"支付结束_取消"
)
}
}
override
fun
onError
(
error
:
String
)
{
override
fun
onError
(
error
:
String
)
{
...
@@ -540,6 +543,8 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -540,6 +543,8 @@ class PayActivity : BaseActivity(), PayContract.View,
mLoading
?.
setResult
(
false
,
"pay error"
,
1000
)
mLoading
?.
setResult
(
false
,
"pay error"
,
1000
)
}
}
EventUtils
.
onEvent
(
"GooglePayError"
,
error
)
EventUtils
.
onEvent
(
"GooglePayError"
,
error
)
EventUtils
.
onEvent
(
"GooglePayEnd"
,
"支付结束_异常 msg:${error}"
)
}
}
})
})
}
}
...
...
cms/src/main/java/com/zxhl/cms/utils/EventUtils.kt
View file @
18372f31
...
@@ -39,20 +39,21 @@ object EventUtils {
...
@@ -39,20 +39,21 @@ object EventUtils {
fun
onEvent
(
action
:
String
)
{
fun
onEvent
(
action
:
String
)
{
val
jsonObj
=
getJSON
(
action
)
val
jsonObj
=
getJSON
(
action
)
jsonObj
.
put
(
"time"
,
"${System.currentTimeMillis()}"
)
apiClient
(
jsonObj
)
apiClient
(
jsonObj
)
appFlayerEvent
(
action
,
""
)
appFlayerEvent
(
action
,
jsonObj
)
// MobclickAgent.onEvent(AppContext.get(), action)
// MobclickAgent.onEvent(AppContext.get(), action)
}
}
fun
onEvent
(
action
:
String
,
value
:
String
)
{
fun
onEvent
(
action
:
String
,
value
:
String
)
{
val
jsonObj
=
getJSON
(
action
)
val
jsonObj
=
getJSON
(
action
)
jsonObj
.
put
(
"value"
,
value
)
jsonObj
.
put
(
"value"
,
value
)
jsonObj
.
put
(
"time"
,
"${System.currentTimeMillis()}"
)
apiClient
(
jsonObj
)
apiClient
(
jsonObj
)
appFlayerEvent
(
action
,
value
)
appFlayerEvent
(
action
,
jsonObj
)
// MobclickAgent.onEvent(AppContext.get(), action, value)
// MobclickAgent.onEvent(AppContext.get(), action, value)
}
}
// /**
// /**
// * 统计新用户首次登陆 男女生
// * 统计新用户首次登陆 男女生
// */
// */
...
@@ -73,9 +74,9 @@ object EventUtils {
...
@@ -73,9 +74,9 @@ object EventUtils {
private
fun
apiClient
(
data
:
JSONObject
)
{
private
fun
apiClient
(
data
:
JSONObject
)
{
val
str
=
data
.
toString
()
val
str
=
data
.
toString
()
Log
.
d
(
"EventUtils"
,
str
)
//
Log.d("EventUtils", str)
val
key
=
AESUtils
.
encrypt
(
str
)
val
key
=
AESUtils
.
encrypt
(
str
)
Log
.
d
(
"EventUtils"
,
key
)
//
Log.d("EventUtils", key)
EventApiClient
.
cfgApi
.
requestEvent
(
"behavior"
,
key
).
subscribeOn
(
Schedulers
.
io
())
EventApiClient
.
cfgApi
.
requestEvent
(
"behavior"
,
key
).
subscribeOn
(
Schedulers
.
io
())
.
subscribe
(
object
:
Observer
<
Any
>
{
.
subscribe
(
object
:
Observer
<
Any
>
{
override
fun
onComplete
()
{
override
fun
onComplete
()
{
...
@@ -117,9 +118,9 @@ object EventUtils {
...
@@ -117,9 +118,9 @@ object EventUtils {
}
}
fun
appFlayerEvent
(
action
:
String
,
value
:
String
)
{
fun
appFlayerEvent
(
action
:
String
,
data
:
JSONObject
)
{
var
eventValues
=
HashMap
<
String
,
Any
>()
var
eventValues
=
HashMap
<
String
,
Any
>()
eventValues
[
action
]
=
value
eventValues
[
action
]
=
data
.
toString
()
AppsFlyerLib
.
getInstance
().
logEvent
(
AppContext
.
get
(),
action
,
eventValues
,
object
:
AppsFlyerRequestListener
{
AppsFlyerLib
.
getInstance
().
logEvent
(
AppContext
.
get
(),
action
,
eventValues
,
object
:
AppsFlyerRequestListener
{
override
fun
onSuccess
()
{
override
fun
onSuccess
()
{
Log
.
e
(
"appsflyer"
,
"onSuccess"
)
Log
.
e
(
"appsflyer"
,
"onSuccess"
)
...
...
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