进入0元购时,检查未通知的 提现list,并通知
This commit is contained in:
parent
03aae381b2
commit
ca097b392e
|
|
@ -2,12 +2,14 @@ package com.gamedog.vididin.features.withdraw.dialogs
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import com.ama.core.architecture.util.ResUtil
|
||||||
import com.ama.core.architecture.util.setOnClickBatch
|
import com.ama.core.architecture.util.setOnClickBatch
|
||||||
import com.ama.core.architecture.widget.BindingDialog
|
import com.ama.core.architecture.widget.BindingDialog
|
||||||
|
import com.vididin.real.money.game.R
|
||||||
import com.vididin.real.money.game.databinding.DialogWithdrawSuccessBinding as ViewBinding
|
import com.vididin.real.money.game.databinding.DialogWithdrawSuccessBinding as ViewBinding
|
||||||
|
|
||||||
|
|
||||||
class WithdrawSuccessDialog(context: Activity, private val mCashNum: Float) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
class WithdrawSuccessDialog(context: Activity, private val mCashNum: Float = 0F, private val cashNumStr: String = "") : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
build()
|
build()
|
||||||
|
|
@ -32,7 +34,12 @@ class WithdrawSuccessDialog(context: Activity, private val mCashNum: Float) : Bi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tvCashNum.text = mCashNum.toString()
|
if (mCashNum > 0F) {
|
||||||
|
tvCashNum.text = ResUtil.getString(R.string.cash) + " " + mCashNum.toString()
|
||||||
|
} else {
|
||||||
|
tvCashNum.text = cashNumStr
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.vididin.real.money.game.R
|
||||||
import com.gamedog.vididin.beans.ZeroBuyItem
|
import com.gamedog.vididin.beans.ZeroBuyItem
|
||||||
import com.gamedog.vididin.beans.ZeroBuyResp
|
import com.gamedog.vididin.beans.ZeroBuyResp
|
||||||
import com.gamedog.vididin.core.login.login.AccountManager
|
import com.gamedog.vididin.core.login.login.AccountManager
|
||||||
|
import com.gamedog.vididin.features.withdraw.dialogs.WithdrawSuccessDialog
|
||||||
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyNotWinDialog
|
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyNotWinDialog
|
||||||
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyRulesDialog
|
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyRulesDialog
|
||||||
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyWinDialog
|
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyWinDialog
|
||||||
|
|
@ -106,6 +107,17 @@ class ZeroBuyActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
}, VididinEvents.Event_Account_Diamond_Changed)
|
}, VididinEvents.Event_Account_Diamond_Changed)
|
||||||
|
|
||||||
requestData()
|
requestData()
|
||||||
|
|
||||||
|
checkPreWithdrawWaitNotifyResult()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkPreWithdrawWaitNotifyResult() {
|
||||||
|
val waitNotifyList = ZeroManager.instance().getWaitNotifyResultList()
|
||||||
|
|
||||||
|
waitNotifyList.forEach {
|
||||||
|
WithdrawSuccessDialog(this, cashNumStr = it.winCashNumStr).show()
|
||||||
|
ZeroManager.instance().updateHasNotifyValue(it.purchase_id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateUIDiamondNum() {
|
private fun updateUIDiamondNum() {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.internal.http2.Http2Reader
|
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
import kotlin.Int
|
import kotlin.Int
|
||||||
|
|
||||||
|
|
@ -75,6 +74,10 @@ class ZeroManager private constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getWaitNotifyResultList() : List<WinZeroWithdrawInfoItem> {
|
||||||
|
return mRecordList.filter { it.withdrawState == TRANSACTION_STATE_SUCCESS && !it.hasShowResultDialog }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* only add new one, if already exist - then do nothing
|
* only add new one, if already exist - then do nothing
|
||||||
*/
|
*/
|
||||||
|
|
@ -94,7 +97,7 @@ class ZeroManager private constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alreadyExist) {
|
if (!alreadyExist) {
|
||||||
mRecordList.add(WinZeroWithdrawInfoItem(zeroItem.id, zeroItem.title, zeroItem.price))
|
mRecordList.add(WinZeroWithdrawInfoItem(zeroItem.id, zeroItem.title, zeroItem.price!!))
|
||||||
saveWinWithdrawInfos()
|
saveWinWithdrawInfos()
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -213,34 +216,31 @@ class ZeroManager private constructor() {
|
||||||
if (userId > 0) {
|
if (userId > 0) {
|
||||||
requestParams.put("UserId", userId.toString())
|
requestParams.put("UserId", userId.toString())
|
||||||
}
|
}
|
||||||
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
|
||||||
requestParams.put("ActivityId", zeroWithdrawItem.purchase_id.toString())
|
requestParams.put("ActivityId", zeroWithdrawItem.purchase_id.toString())
|
||||||
|
|
||||||
// withdraw check result 相关参数:
|
// withdraw check result 相关参数:
|
||||||
requestParams.put("device_id", zeroWithdrawItem.orderId)
|
requestParams.put("device_id", zeroWithdrawItem.orderId)
|
||||||
requestParams.put("order_id", zeroWithdrawItem.orderId)
|
requestParams.put("order_id", zeroWithdrawItem.orderId)
|
||||||
/*val signOriginStr = "${zeroWithdrawItem.purchase_id}-${userId}-${bankCPFAccount}-${accountType}-${bankCPFAccount}-${accountType}-${ZEROBUY_SECRET}"
|
requestParams.put("record_id", zeroWithdrawItem.orderId)
|
||||||
requestParams.put("Sign", MD5Util.md5(signOriginStr)!!)*/
|
requestParams.put("recordId", zeroWithdrawItem.orderId)
|
||||||
|
|
||||||
|
|
||||||
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
//val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams)
|
||||||
|
val result = NetworkUtil.post("http://192.168.110.141:8081/any", requestHeaders, requestParams)
|
||||||
|
|
||||||
when (result) {
|
when (result) {
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
val respObj = AndroidUtil.json2Object<ZeroBuyWithdrawResp>(result.data.string())
|
val respObj = AndroidUtil.json2Object<ZeroBuyWithdrawResp>(result.data.string())
|
||||||
|
|
||||||
respObj?.let {
|
respObj?.let {
|
||||||
if (it.code == 0 && it.content.isNotEmpty()) {
|
if (it.code == 0) {
|
||||||
zeroWithdrawItem.orderId = respObj.content
|
zeroWithdrawItem.orderId = respObj.content
|
||||||
zeroWithdrawItem.withdrawState = TRANSACTION_STATE_ONGOING
|
zeroWithdrawItem.withdrawState = TRANSACTION_STATE_SUCCESS
|
||||||
saveWinWithdrawInfos()
|
saveWinWithdrawInfos()
|
||||||
|
|
||||||
AndroidUtil.showToast(R.string.zero_withdraw_ongoing)
|
AndroidUtil.showToast(R.string.zero_withdraw_ongoing)
|
||||||
return@launch
|
return@launch
|
||||||
} else {
|
|
||||||
zeroWithdrawItem.withdrawState = TRANSACTION_STATE_FAIL
|
|
||||||
zeroWithdrawItem.failReason = respObj.code
|
|
||||||
saveWinWithdrawInfos()
|
|
||||||
AndroidUtil.showToast(R.string.zero_withdraw_failed)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -309,10 +309,20 @@ class ZeroManager private constructor() {
|
||||||
} finally {
|
} finally {
|
||||||
mRecordLocker.unlock()
|
mRecordLocker.unlock()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mLooperHandler.postDelayed(mLoopRunnable, 20 * 1000)
|
mLooperHandler.postDelayed(mLoopRunnable, 20 * 1000)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateHasNotifyValue(purchaseId: Int) {
|
||||||
|
mRecordList.forEach {
|
||||||
|
if (it.purchase_id == purchaseId) {
|
||||||
|
it.hasShowResultDialog = true
|
||||||
|
saveWinWithdrawInfos()
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,7 +331,7 @@ class ZeroManager private constructor() {
|
||||||
data class WinZeroWithdrawInfoItem(
|
data class WinZeroWithdrawInfoItem(
|
||||||
val purchase_id: Int = 0,
|
val purchase_id: Int = 0,
|
||||||
val purchase_title: String? = "",
|
val purchase_title: String? = "",
|
||||||
val winCashNumStr: String? = "",
|
val winCashNumStr: String = "",
|
||||||
var operateMs: Long = System.currentTimeMillis(),
|
var operateMs: Long = System.currentTimeMillis(),
|
||||||
var withdrawState: Int = TRANSACTION_STATE_UNSTART,
|
var withdrawState: Int = TRANSACTION_STATE_UNSTART,
|
||||||
var failReason: Int = 0,
|
var failReason: Int = 0,
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textColor="@color/green_2c"
|
android:textColor="@color/green_2c"
|
||||||
android:text="@string/cash"
|
|
||||||
android:drawableStart="@mipmap/icon_cash"
|
android:drawableStart="@mipmap/icon_cash"
|
||||||
android:drawablePadding="3dp"
|
android:drawablePadding="3dp"
|
||||||
/>
|
/>
|
||||||
|
|
@ -48,6 +47,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"
|
||||||
android:textSize="30sp"
|
android:textSize="30sp"
|
||||||
|
android:text="@string/cash"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/green_2c"
|
android:textColor="@color/green_2c"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue