【埋点】Chest_Claim_Click(宝箱领取点击事件)在可以领取时就上报了,需要点击领取后上报。且事件中total_amount 属性上报错误,领取 0.1 奖励上报为 1

This commit is contained in:
renhaoting 2026-01-23 18:12:22 +08:00
parent 91260dc651
commit 479e8aad93
1 changed files with 16 additions and 11 deletions

View File

@ -58,7 +58,6 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
if (taskStateBeanInSp == null || taskStateBeanInSp.boxList.isNullOrEmpty() || isAllBoxExpiredOrFinished(taskStateBeanInSp)) { if (taskStateBeanInSp == null || taskStateBeanInSp.boxList.isNullOrEmpty() || isAllBoxExpiredOrFinished(taskStateBeanInSp)) {
mStateBean = generateStateBeanFromConfig() mStateBean = generateStateBeanFromConfig()
saveState2Sp() saveState2Sp()
sendEnterNewSubBoxEvent(0)
} else { } else {
mStateBean = taskStateBeanInSp mStateBean = taskStateBeanInSp
calculateCurrentOngoingBox() calculateCurrentOngoingBox()
@ -112,8 +111,6 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
mStateBean.boxList[index].boxStartMs = DateUtil.getCurTimeMs() mStateBean.boxList[index].boxStartMs = DateUtil.getCurTimeMs()
saveState2Sp() saveState2Sp()
notifyEvent() notifyEvent()
sendEnterNewSubBoxEvent(index)
} }
return return
} }
@ -121,14 +118,9 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
} }
} }
private fun sendEnterNewSubBoxEvent(index: Int) { private fun sendClaimedEvent(claimBoxTotal: Int, couldClaimCashNum: Double) {
val subBox = getBoxState(index)
subBox?.let {
val resetBoxCount = mStateBean.boxList.size - index - 1
StatisticUtil.reportEvents(StatisticUtil.KEY_Chest_Claim_Click, StatisticUtil.reportEvents(StatisticUtil.KEY_Chest_Claim_Click,
mapOf("total_amount" to it.reward_value, "chest_count" to resetBoxCount, "task_type" to "subBox", "task_progress" to "0")) mapOf("total_amount" to couldClaimCashNum, "chest_count" to claimBoxTotal))
}
} }
private fun sendSubBoxSubTaskFinishEvent(index: Int, subTask: TaskStateBoxSub) { private fun sendSubBoxSubTaskFinishEvent(index: Int, subTask: TaskStateBoxSub) {
@ -272,6 +264,16 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
return waitClaimCashNum return waitClaimCashNum
} }
fun getCouldClaimBoxNum(): Int {
var subBoxNum = 0
mStateBean.boxList.forEachIndexed { index, box ->
if (getBoxStateEnum(index) == STATE_FINISH) {
subBoxNum ++
}
}
return subBoxNum
}
fun getSubTaskHintStrRes(boxIndex: Int, subTaskIndex: Int): Int { fun getSubTaskHintStrRes(boxIndex: Int, subTaskIndex: Int): Int {
when (boxIndex) { when (boxIndex) {
0-> { 0-> {
@ -350,6 +352,7 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
fun executeClaimCash(): Boolean { fun executeClaimCash(): Boolean {
try { try {
val couldClaimCashNum = getCouldClaimCashNum() val couldClaimCashNum = getCouldClaimCashNum()
val subBoxNum = getCouldClaimBoxNum()
if (couldClaimCashNum > 0F) { if (couldClaimCashNum > 0F) {
AccountManager.adjustCash(couldClaimCashNum, RecordCash(RECORD_CASH_PLUS_BOX_TASK, couldClaimCashNum.toDouble())) AccountManager.adjustCash(couldClaimCashNum, RecordCash(RECORD_CASH_PLUS_BOX_TASK, couldClaimCashNum.toDouble()))
mStateBean.boxList.forEachIndexed { index, box -> mStateBean.boxList.forEachIndexed { index, box ->
@ -357,6 +360,8 @@ class BoxTaskHelper: BaseTaskHelper<TaskStateBoxRoot, BoxTaskRoot>() {
box.hasClaimedReward = true box.hasClaimedReward = true
} }
} }
sendClaimedEvent(subBoxNum, couldClaimCashNum)
saveState2Sp() saveState2Sp()
notifyEvent() notifyEvent()
return true return true