fix: 유저 행동 데이터에 따른 포인트 지급
- 유저가 지급 받을 포인트가 0 이상인 경우에만 포인트 지급 로그를 남기고 푸시 발송
This commit is contained in:
parent
b102241efd
commit
36b8e8169e
|
@ -102,14 +102,17 @@ 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(
|
|
||||||
memberId = memberId,
|
|
||||||
point = if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) {
|
|
||||||
order.can
|
order.can
|
||||||
} else {
|
} else {
|
||||||
policy.pointAmount
|
policy.pointAmount
|
||||||
},
|
}
|
||||||
|
|
||||||
|
if (point > 0) {
|
||||||
|
grantLogRepository.save(
|
||||||
|
PointGrantLog(
|
||||||
|
memberId = memberId,
|
||||||
|
point = point,
|
||||||
actionType = actionType,
|
actionType = actionType,
|
||||||
policyId = policy.id!!,
|
policyId = policy.id!!,
|
||||||
orderId = order?.id
|
orderId = order?.id
|
||||||
|
@ -119,11 +122,7 @@ class UserActionService(
|
||||||
memberPointRepository.save(
|
memberPointRepository.save(
|
||||||
MemberPoint(
|
MemberPoint(
|
||||||
memberId = memberId,
|
memberId = memberId,
|
||||||
point = if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) {
|
point = point,
|
||||||
order.can
|
|
||||||
} else {
|
|
||||||
policy.pointAmount
|
|
||||||
},
|
|
||||||
actionType = actionType,
|
actionType = actionType,
|
||||||
expiresAt = now.plusDays(3)
|
expiresAt = now.plusDays(3)
|
||||||
)
|
)
|
||||||
|
@ -132,15 +131,12 @@ class UserActionService(
|
||||||
if (pushTokenList.isNotEmpty()) {
|
if (pushTokenList.isNotEmpty()) {
|
||||||
fcmService.sendPointGranted(
|
fcmService.sendPointGranted(
|
||||||
pushTokenList,
|
pushTokenList,
|
||||||
if (actionType == ActionType.ORDER_CONTENT_COMMENT && order != null) {
|
point
|
||||||
order.can
|
|
||||||
} else {
|
|
||||||
policy.pointAmount
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn("포인트 지급 또는 알림 실패: ${e.message}")
|
logger.warn("포인트 지급 또는 알림 실패: ${e.message}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue