根据产品要求提现新逻辑:一旦进入100% 条目,马上扣减现金
This commit is contained in:
parent
daa1d2b2ad
commit
ba220384cb
|
|
@ -123,6 +123,7 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
private fun handleGotoWithdraw(itemIndex: Int) {
|
private fun handleGotoWithdraw(itemIndex: Int) {
|
||||||
val cashNum = mItemViewList.get(itemIndex).getCashNum()
|
val cashNum = mItemViewList.get(itemIndex).getCashNum()
|
||||||
if (cashNum > 1.0) {
|
if (cashNum > 1.0) {
|
||||||
|
WithdrawManager.instance().setItemStarted(itemIndex)
|
||||||
gotoWithdrawSubActivity(itemIndex)
|
gotoWithdrawSubActivity(itemIndex)
|
||||||
} else {
|
} else {
|
||||||
val hasBindBank = AccountManager.hasValidBankInfo()
|
val hasBindBank = AccountManager.hasValidBankInfo()
|
||||||
|
|
@ -316,7 +317,6 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
|
|
||||||
private fun gotoWithdrawSubActivity(selectedIndex: Int) {
|
private fun gotoWithdrawSubActivity(selectedIndex: Int) {
|
||||||
Router.WithdrawSub.startActivity(this, selectedIndex)
|
Router.WithdrawSub.startActivity(this, selectedIndex)
|
||||||
WithdrawManager.instance().setItemStarted(selectedIndex)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,7 @@ class WithdrawInfoConfirmDialog(context: Activity, private val onConfirmed: (cas
|
||||||
}
|
}
|
||||||
|
|
||||||
tvActionApply -> {
|
tvActionApply -> {
|
||||||
if (AccountManager.getCash() < mWithdrawCashNum) {
|
onConfirmed.invoke(mWithdrawCashNum)
|
||||||
AndroidUtil.showToast(R.string.not_enough_cash)
|
|
||||||
} else {
|
|
||||||
//WithdrawWatchAdDialog(mActivity, mWithdrawCashNum).show()
|
|
||||||
onConfirmed.invoke(mWithdrawCashNum)
|
|
||||||
}
|
|
||||||
|
|
||||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Apply,
|
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Apply,
|
||||||
mapOf("Withdrawal_Position" to mWithdrawCashNum,
|
mapOf("Withdrawal_Position" to mWithdrawCashNum,
|
||||||
"Withdrawal_Day" to 1))
|
"Withdrawal_Day" to 1))
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ object AccountManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun adjustCash(adjustNum: Double, recordBean: RecordCash?): Boolean {
|
fun adjustCash(adjustNum: Double, recordBean: RecordCash? = null): Boolean {
|
||||||
if (adjustNum < 0L && Math.abs(adjustNum) > getCash()) {
|
if (adjustNum < 0L && Math.abs(adjustNum) > getCash()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -248,10 +248,6 @@ class WithdrawManager private constructor() {
|
||||||
mRecordLocker.unlock()
|
mRecordLocker.unlock()
|
||||||
}
|
}
|
||||||
saveRecords2Sp()
|
saveRecords2Sp()
|
||||||
val cashNum = newRecord.cashNum * -1
|
|
||||||
AccountManager.adjustCash(cashNum, RecordCash(
|
|
||||||
RECORD_CASH_PLUS_WITHDRAW_ONGOING, cashNum.toDouble(), true).apply { uuid = newRecord.recordNo }
|
|
||||||
)
|
|
||||||
loopCheckTransactionState()
|
loopCheckTransactionState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -469,9 +465,6 @@ class WithdrawManager private constructor() {
|
||||||
updateRecord(recordNo, TRANSACTION_STATE_FAIL, failedType)
|
updateRecord(recordNo, TRANSACTION_STATE_FAIL, failedType)
|
||||||
val recordBean = WithdrawManager.instance?.getRecord(recordNo)
|
val recordBean = WithdrawManager.instance?.getRecord(recordNo)
|
||||||
recordBean?.let {
|
recordBean?.let {
|
||||||
AccountManager.adjustCash(it.cashNum,
|
|
||||||
RecordCash(RECORD_CASH_PLUS_WITHDRAW_FAIL, it.cashNum.toDouble(), false, failedType).apply { uuid = recordNo })
|
|
||||||
|
|
||||||
sendWithdrawResultStatistic(it.cashNum, false, failedType)
|
sendWithdrawResultStatistic(it.cashNum, false, failedType)
|
||||||
}
|
}
|
||||||
notifyWithdrawCheckResult(recordNo)
|
notifyWithdrawCheckResult(recordNo)
|
||||||
|
|
@ -592,7 +585,7 @@ class WithdrawManager private constructor() {
|
||||||
return 0.0
|
return 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStartedItemRestCashCount(): Double {
|
/*private fun getStartedItemRestCashCount(): Double {
|
||||||
var allStartedItemRestCashNum = 0.0
|
var allStartedItemRestCashNum = 0.0
|
||||||
mItemList.forEachIndexed { index, item ->
|
mItemList.forEachIndexed { index, item ->
|
||||||
if (!(TaskManager.instance().newbieFirstWithdrawStatus().getStatusBean().hasClaimReward && index == 0)) {
|
if (!(TaskManager.instance().newbieFirstWithdrawStatus().getStatusBean().hasClaimReward && index == 0)) {
|
||||||
|
|
@ -601,7 +594,7 @@ class WithdrawManager private constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return allStartedItemRestCashNum
|
return allStartedItemRestCashNum
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
fun getItemProgress(itemIndex: Int): Double {
|
fun getItemProgress(itemIndex: Int): Double {
|
||||||
|
|
@ -610,16 +603,10 @@ class WithdrawManager private constructor() {
|
||||||
if (itemIndex in 0..mItemList.size-1) {
|
if (itemIndex in 0..mItemList.size-1) {
|
||||||
val curItem = mItemList[itemIndex]
|
val curItem = mItemList[itemIndex]
|
||||||
val userCashTotal = AccountManager.getCash()
|
val userCashTotal = AccountManager.getCash()
|
||||||
var restAvailableCashNum = userCashTotal - getStartedItemRestCashCount()
|
if (curItem.hasStarted) {
|
||||||
|
return 1.0
|
||||||
if (restAvailableCashNum < 0.0) {
|
|
||||||
restAvailableCashNum = 0.0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curItem.hasStarted || restAvailableCashNum >= curItem.totalCashNum) {
|
|
||||||
itemProgress = 1.0
|
|
||||||
} else {
|
} else {
|
||||||
itemProgress = restAvailableCashNum / curItem.totalCashNum
|
itemProgress = userCashTotal / curItem.totalCashNum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -632,7 +619,7 @@ class WithdrawManager private constructor() {
|
||||||
if (!curItem.hasStarted) {
|
if (!curItem.hasStarted) {
|
||||||
curItem.hasStarted = true
|
curItem.hasStarted = true
|
||||||
curItem.startMs = System.currentTimeMillis()
|
curItem.startMs = System.currentTimeMillis()
|
||||||
|
AccountManager.adjustCash(-1 * curItem.totalCashNum)
|
||||||
saveInfos2Sp(mItemList)
|
saveInfos2Sp(mItemList)
|
||||||
notifyItemListChanged()
|
notifyItemListChanged()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue