统一处理提现流程逻辑+1

This commit is contained in:
renhaoting 2026-01-07 15:30:26 +08:00
parent e2bdd75db4
commit 82d7f7d9d8
1 changed files with 4 additions and 35 deletions

View File

@ -139,9 +139,6 @@ class WithdrawManager private constructor() {
SpUtil.instance().putList(SpUtil.KEY_WITHDRAW_ITEM_LIST, itemList) SpUtil.instance().putList(SpUtil.KEY_WITHDRAW_ITEM_LIST, itemList)
} }
fun getItemList(): List<WithdrawItem> {
return mWithdrawItemList
}
fun getItem(itemIndex: Int): WithdrawItem { fun getItem(itemIndex: Int): WithdrawItem {
return mWithdrawItemList[itemIndex] return mWithdrawItemList[itemIndex]
@ -152,10 +149,6 @@ class WithdrawManager private constructor() {
return RecordsManager.instance().getHasWithdrawSuccessCashCount() return RecordsManager.instance().getHasWithdrawSuccessCashCount()
} }
fun getHasWithdrawSuccessCashCount(itemIndex: Int): Double {
return RecordsManager.instance().getHasWithdrawSuccessCashCount(itemIndex)
}
fun addAdEarnForSubBean(itemIndex: Int, selectedSubIndex: Int, earnMoneyNum: Double) : Boolean { fun addAdEarnForSubBean(itemIndex: Int, selectedSubIndex: Int, earnMoneyNum: Double) : Boolean {
if (itemIndex >= 0 && itemIndex < mWithdrawItemList.size) { if (itemIndex >= 0 && itemIndex < mWithdrawItemList.size) {
try { try {
@ -221,23 +214,11 @@ class WithdrawManager private constructor() {
RecordsManager.instance().updateRecordHasNotifyState(recordNo) RecordsManager.instance().updateRecordHasNotifyState(recordNo)
} }
fun saveNewRecord(newRecord: RecordCash) { fun saveNewWithdrawRecord(newRecord: RecordCash) {
RecordsManager.instance().saveNewWithdrawRecord(newRecord)
loopCheckTransactionState()
}
fun saveNewRecord2(newRecord: RecordCash) {
RecordsManager.instance().saveNewWithdrawRecord(newRecord) RecordsManager.instance().saveNewWithdrawRecord(newRecord)
} }
fun updateRecord(recordNo: String, newState: Int, failType: Int = 0) {
val withdrawItemIndex = RecordsManager.instance().withdrawUpdateRecord(recordNo, newState, failType)
if (newState == STATE_HAS_WITHDRAWED && withdrawItemIndex >= 0) {
checkIfItemFinishAndReset(withdrawItemIndex)
}
}
private fun checkIfItemFinishAndReset(itemIndex: Int) { private fun checkIfItemFinishAndReset(itemIndex: Int) {
var needReset = false var needReset = false
if (itemIndex == 0) { if (itemIndex == 0) {
@ -254,11 +235,11 @@ class WithdrawManager private constructor() {
} }
if (needReset) { if (needReset) {
resetItem(itemIndex) resetWithdrawItem(itemIndex)
} }
} }
private fun resetItem(itemIndex: Int) { private fun resetWithdrawItem(itemIndex: Int) {
val needResetItem = mWithdrawItemList[itemIndex] val needResetItem = mWithdrawItemList[itemIndex]
needResetItem.apply { needResetItem.apply {
totalProgress = 0 totalProgress = 0
@ -287,10 +268,6 @@ class WithdrawManager private constructor() {
return RecordsManager.instance().getOngoingRecordList() return RecordsManager.instance().getOngoingRecordList()
} }
private fun getRecord(recordNo: String): RecordCash? {
return RecordsManager.instance().getRecord(recordNo)
}
private fun loopCheckTransactionState() { private fun loopCheckTransactionState() {
val ongoingList = getOngoingRecordList() val ongoingList = getOngoingRecordList()
@ -364,14 +341,6 @@ class WithdrawManager private constructor() {
} }
private fun sendWithdrawResultStatistic(cashNum: Double, isSuccess: Boolean, failType: Int) {
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Reason,
mapOf("Reason_Type" to (if (isSuccess) "Success" else "Fail"),
"Fail_Reason" to failType.toString() + ": " + getFailHintStrRes(failType),
"Withdrawal_Position" to cashNum,
"Withdrawal_Day" to 1))
}
fun getFailHintStrRes(failType: Int) : Int { fun getFailHintStrRes(failType: Int) : Int {
var failTextRes = R.string.withdraw_normal_fail var failTextRes = R.string.withdraw_normal_fail
when (failType) { when (failType) {
@ -506,7 +475,7 @@ class WithdrawManager private constructor() {
withdrawItemSubIndex = withdrawSubItemId withdrawItemSubIndex = withdrawSubItemId
withdrawItemLoopIndex = payItemLoopIndex withdrawItemLoopIndex = payItemLoopIndex
} }
saveNewRecord2(withdrawRecord) saveNewWithdrawRecord(withdrawRecord)
val initReqParam = applyInitFields( PayInitReq()) val initReqParam = applyInitFields( PayInitReq())
val initReqResult = NetworkUtil.callApi { val initReqResult = NetworkUtil.callApi {