fix: 유저 행동 데이터에 따른 포인트 지급

- 유저가 지급 받을 포인트가 0 이상인 경우에만 포인트 지급 로그를 남기고 푸시 발송
This commit is contained in:
Klaus 2025-05-19 16:27:58 +09:00
parent b102241efd
commit 36b8e8169e
1 changed files with 28 additions and 32 deletions

View File

@ -102,42 +102,38 @@ class UserActionService(
) )
if (grantedCount >= policy.availableCount) return@execute if (grantedCount >= policy.availableCount) return@execute
grantLogRepository.save( val point = if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) {
PointGrantLog( order.can
memberId = memberId, } else {
point = if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) { policy.pointAmount
order.can }
} else {
policy.pointAmount
},
actionType = actionType,
policyId = policy.id!!,
orderId = order?.id
)
)
memberPointRepository.save( if (point > 0) {
MemberPoint( grantLogRepository.save(
memberId = memberId, PointGrantLog(
point = if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) { memberId = memberId,
order.can point = point,
} else { actionType = actionType,
policy.pointAmount policyId = policy.id!!,
}, orderId = order?.id
actionType = actionType, )
expiresAt = now.plusDays(3)
) )
)
if (pushTokenList.isNotEmpty()) { memberPointRepository.save(
fcmService.sendPointGranted( MemberPoint(
pushTokenList, memberId = memberId,
if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) { point = point,
order.can actionType = actionType,
} else { expiresAt = now.plusDays(3)
policy.pointAmount )
}
) )
if (pushTokenList.isNotEmpty()) {
fcmService.sendPointGranted(
pushTokenList,
point
)
}
} }
} }
} }