Fix bug - 去掉repeat

This commit is contained in:
renhaoting 2026-01-06 16:44:44 +08:00
parent c2191c5990
commit 64a093782e
2 changed files with 80 additions and 90 deletions

View File

@ -6,9 +6,7 @@ import android.view.LayoutInflater
import androidx.activity.viewModels
import androidx.core.graphics.toColorInt
import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
import com.ama.core.architecture.highlightpro.HighlightPro
import com.ama.core.architecture.highlightpro.parameter.Constraints
@ -268,39 +266,37 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
val currentTimeMs = System.currentTimeMillis()
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.PayoutResult.collect { result ->
when (result) {
is Result.Loading -> {
}
is Result.Success -> {
var failType: Int? = 0
viewModel.PayoutResult.collect { result ->
when (result) {
is Result.Loading -> {
}
is Result.Success -> {
var failType: Int? = 0
if (result.data?.data?.error == 0) {
saveNewRecord(result.data.data!!, payCashNum, currentTimeMs)
} else {
/* 错误码
0成功1失败2签名验证失败3客户端版本过低4uuid错误5所在地国家或地区不在提现限制内6提现金额不符对应的产品id7提现产品id不对8达到提现金额限制9提现次数超过限制10今日没有提现机会11提现账号达到次数限制12身份审核条件不满足不能提现13巴西提现参数 document_type 错误
14巴西提现参数 document_id 错误15 巴西提现参数 AccountType 错误16 巴西提现参数 Name 错误17巴西提现参数 Account DocumentId 不同18巴西提现参数account_type为CPF时 对应的 account 错误19巴西提现参数account_type为CNPJ时 对应的 account 错误20巴西提现参数 account_type 错误
21巴西提现参数 document_type 错误22巴西提现参数account_type为CPF时 对应的 document_id 错误23巴西提现参数account_type为CNPJ时 对应的 document_id 错误24 ts长度错误25 没提0.1就提现其它的
*/
failType = result.data?.data?.error
if (failType != null && failType > 0) {
failType += 20
showFailDialog(WithdrawManager.instance().getFailHintStrRes(failType))
if (result.data?.data?.error == 0) {
saveNewRecord(result.data.data!!, payCashNum, currentTimeMs)
} else {
/* 错误码
0成功1失败2签名验证失败3客户端版本过低4uuid错误5所在地国家或地区不在提现限制内6提现金额不符对应的产品id7提现产品id不对8达到提现金额限制9提现次数超过限制10今日没有提现机会11提现账号达到次数限制12身份审核条件不满足不能提现13巴西提现参数 document_type 错误
14巴西提现参数 document_id 错误15 巴西提现参数 AccountType 错误16 巴西提现参数 Name 错误17巴西提现参数 Account DocumentId 不同18巴西提现参数account_type为CPF时 对应的 account 错误19巴西提现参数account_type为CNPJ时 对应的 account 错误20巴西提现参数 account_type 错误
21巴西提现参数 document_type 错误22巴西提现参数account_type为CPF时 对应的 document_id 错误23巴西提现参数account_type为CNPJ时 对应的 document_id 错误24 ts长度错误25 没提0.1就提现其它的
*/
failType = result.data?.data?.error
if (failType != null && failType > 0) {
failType += 20
showFailDialog(WithdrawManager.instance().getFailHintStrRes(failType))
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Reason, mapOf(
"Reason_Type" to "Fail",
"Fail_Reason" to failType,
"Withdrawal_Position" to payCashNum,
"Withdrawal_Day" to 1,
))
}
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Reason, mapOf(
"Reason_Type" to "Fail",
"Fail_Reason" to failType,
"Withdrawal_Position" to payCashNum,
"Withdrawal_Day" to 1,
))
}
}
is Result.Error -> {
showFailDialog(R.string.withdraw_fail_unkown_error)
}
}
is Result.Error -> {
showFailDialog(R.string.withdraw_fail_unkown_error)
}
}
}

View File

@ -8,13 +8,11 @@ import androidx.activity.viewModels
import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
import com.ama.core.architecture.util.AndroidUtil
import com.ama.core.architecture.util.CommonItemDecoration
import com.ama.core.architecture.util.DateUtil
import com.ama.core.architecture.util.ResUtil.dp
import com.ama.core.architecture.util.setOnClickBatch
import com.gamedog.statisticreporter.StatisticUtil
import com.gamedog.vididin.VidiConst
@ -116,43 +114,41 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
private fun requestInit(withdrawNum: Double) {
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.InitData.collect { result ->
when (result) {
is com.gamedog.vididin.netbase.Result.Loading -> {
viewModel.InitData.collect { result ->
when (result) {
is com.gamedog.vididin.netbase.Result.Loading -> {
}
is com.gamedog.vididin.netbase.Result.Success -> {
val reqInitBean = result.data.data
}
is com.gamedog.vididin.netbase.Result.Success -> {
val reqInitBean = result.data.data
reqInitBean?.let {
var errorHintRes = 0
if (it.error == 0 && !it.uuid.isNullOrEmpty() && !it.items.isNullOrEmpty()) {
val itemId = if (withdrawNum <= VidiConst.WITHDRAW_SMALL_NUM) 0 else 1
val withDrawItem = it.items?.get(itemId)!!
if (withDrawItem.status == INIT_OK) {
requestPayout(it.uuid!!, withDrawItem.id, withdrawNum)
} else {
errorHintRes = R.string.withdraw_fail_reach_day_limit
}
reqInitBean?.let {
var errorHintRes = 0
if (it.error == 0 && !it.uuid.isNullOrEmpty() && !it.items.isNullOrEmpty()) {
val itemId = if (withdrawNum <= VidiConst.WITHDRAW_SMALL_NUM) 0 else 1
val withDrawItem = it.items?.get(itemId)!!
if (withDrawItem.status == INIT_OK) {
requestPayout(it.uuid!!, withDrawItem.id, withdrawNum)
} else {
// 0成功1失败2签名验证失败3客户端版本过低4 ts长度错误
when (it.error) {
3-> errorHintRes = R.string.withdraw_fail_version_toolow
}
errorHintRes = R.string.withdraw_fail_reach_day_limit
}
if (errorHintRes > 0) {
showFailDialog(errorHintRes)
} else {
// 0成功1失败2签名验证失败3客户端版本过低4 ts长度错误
when (it.error) {
3-> errorHintRes = R.string.withdraw_fail_version_toolow
}
}
if (errorHintRes > 0) {
showFailDialog(errorHintRes)
}
}
is com.gamedog.vididin.netbase.Result.Error -> {
showFailDialog(R.string.withdraw_fail_unkown_error)
}
}
is com.gamedog.vididin.netbase.Result.Error -> {
showFailDialog(R.string.withdraw_fail_unkown_error)
}
}
}
@ -165,42 +161,40 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
val currentTimeMs = System.currentTimeMillis()
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.PayoutResult.collect { result ->
when (result) {
is com.gamedog.vididin.netbase.Result.Loading -> {
}
is com.gamedog.vididin.netbase.Result.Success -> {
var errHintRes = 0
viewModel.PayoutResult.collect { result ->
when (result) {
is com.gamedog.vididin.netbase.Result.Loading -> {
}
is com.gamedog.vididin.netbase.Result.Success -> {
var errHintRes = 0
when (result.data?.data?.error) {
/* 错误码
0成功1失败2签名验证失败3客户端版本过低4uuid错误5所在地国家或地区不在提现限制内6提现金额不符对应的产品id7提现产品id不对8达到提现金额限制9提现次数超过限制10今日没有提现机会11提现账号达到次数限制12身份审核条件不满足不能提现13巴西提现参数 document_type 错误
14巴西提现参数 document_id 错误15 巴西提现参数 AccountType 错误16 巴西提现参数 Name 错误17巴西提现参数 Account DocumentId 不同18巴西提现参数account_type为CPF时 对应的 account 错误19巴西提现参数account_type为CNPJ时 对应的 account 错误20巴西提现参数 account_type 错误
21巴西提现参数 document_type 错误22巴西提现参数account_type为CPF时 对应的 document_id 错误23巴西提现参数account_type为CNPJ时 对应的 document_id 错误24 ts长度错误25 没提0.1就提现其它的
*/
0 -> {
saveNewRecord(result.data.data!!, payCashNum, currentTimeMs)
}
5-> {
errHintRes = R.string.withdraw_fail_region_restricit
}
8-> {
errHintRes = R.string.withdraw_fail_amount_limit
}
9-> {
errHintRes = R.string.withdraw_fail_amount_limit
}
when (result.data?.data?.error) {
/* 错误码
0成功1失败2签名验证失败3客户端版本过低4uuid错误5所在地国家或地区不在提现限制内6提现金额不符对应的产品id7提现产品id不对8达到提现金额限制9提现次数超过限制10今日没有提现机会11提现账号达到次数限制12身份审核条件不满足不能提现13巴西提现参数 document_type 错误
14巴西提现参数 document_id 错误15 巴西提现参数 AccountType 错误16 巴西提现参数 Name 错误17巴西提现参数 Account DocumentId 不同18巴西提现参数account_type为CPF时 对应的 account 错误19巴西提现参数account_type为CNPJ时 对应的 account 错误20巴西提现参数 account_type 错误
21巴西提现参数 document_type 错误22巴西提现参数account_type为CPF时 对应的 document_id 错误23巴西提现参数account_type为CNPJ时 对应的 document_id 错误24 ts长度错误25 没提0.1就提现其它的
*/
0 -> {
saveNewRecord(result.data.data!!, payCashNum, currentTimeMs)
}
if (errHintRes > 0) {
showFailDialog(errHintRes)
5-> {
errHintRes = R.string.withdraw_fail_region_restricit
}
8-> {
errHintRes = R.string.withdraw_fail_amount_limit
}
9-> {
errHintRes = R.string.withdraw_fail_amount_limit
}
}
is com.gamedog.vididin.netbase.Result.Error -> {
showFailDialog(R.string.withdraw_fail_unkown_error)
if (errHintRes > 0) {
showFailDialog(errHintRes)
}
}
is com.gamedog.vididin.netbase.Result.Error -> {
showFailDialog(R.string.withdraw_fail_unkown_error)
}
}
}
}