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

- 본인인증을 한 유저만 포인트 정책에 따라 포인트를 지급하도록 수정
This commit is contained in:
Klaus 2025-05-20 00:51:04 +09:00
parent a36d9f02d8
commit d3ec13e6c0
5 changed files with 90 additions and 80 deletions

View File

@ -43,6 +43,7 @@ class AudioContentCommentController(
userActionService.recordAction( userActionService.recordAction(
memberId = member.id!!, memberId = member.id!!,
isAuth = member.auth != null,
actionType = ActionType.CONTENT_COMMENT, actionType = ActionType.CONTENT_COMMENT,
contentCommentId = commentId, contentCommentId = commentId,
pushTokenList = pushTokenList pushTokenList = pushTokenList
@ -50,6 +51,7 @@ class AudioContentCommentController(
userActionService.recordAction( userActionService.recordAction(
memberId = member.id!!, memberId = member.id!!,
isAuth = member.auth != null,
actionType = ActionType.ORDER_CONTENT_COMMENT, actionType = ActionType.ORDER_CONTENT_COMMENT,
contentId = request.contentId, contentId = request.contentId,
contentCommentId = commentId, contentCommentId = commentId,

View File

@ -65,6 +65,7 @@ class MemberController(
userActionService.recordAction( userActionService.recordAction(
memberId = response.memberId, memberId = response.memberId,
isAuth = false,
actionType = ActionType.SIGN_UP, actionType = ActionType.SIGN_UP,
pushTokenList = if (request.pushToken != null) { pushTokenList = if (request.pushToken != null) {
listOf(request.pushToken) listOf(request.pushToken)
@ -358,6 +359,7 @@ class MemberController(
if (response.isNew) { if (response.isNew) {
userActionService.recordAction( userActionService.recordAction(
memberId = response.memberId, memberId = response.memberId,
isAuth = false,
actionType = ActionType.SIGN_UP, actionType = ActionType.SIGN_UP,
pushTokenList = if (request.pushToken != null) { pushTokenList = if (request.pushToken != null) {
listOf(request.pushToken) listOf(request.pushToken)
@ -393,6 +395,7 @@ class MemberController(
if (response.isNew) { if (response.isNew) {
userActionService.recordAction( userActionService.recordAction(
memberId = response.memberId, memberId = response.memberId,
isAuth = false,
actionType = ActionType.SIGN_UP, actionType = ActionType.SIGN_UP,
pushTokenList = if (request.pushToken != null) { pushTokenList = if (request.pushToken != null) {
listOf(request.pushToken) listOf(request.pushToken)

View File

@ -40,6 +40,7 @@ class AuthController(
val pushTokenList = memberService.getPushTokenList(recipient = memberId) val pushTokenList = memberService.getPushTokenList(recipient = memberId)
userActionService.recordAction( userActionService.recordAction(
memberId = member.id!!, memberId = member.id!!,
isAuth = true,
actionType = ActionType.USER_AUTHENTICATION, actionType = ActionType.USER_AUTHENTICATION,
pushTokenList = pushTokenList pushTokenList = pushTokenList
) )

View File

@ -27,6 +27,7 @@ class UserActionController(
val pushTokenList = memberService.getPushTokenList(recipient = memberId) val pushTokenList = memberService.getPushTokenList(recipient = memberId)
service.recordAction( service.recordAction(
memberId = memberId, memberId = memberId,
isAuth = member.auth != null,
actionType = request.actionType, actionType = request.actionType,
pushTokenList = pushTokenList pushTokenList = pushTokenList
) )

View File

@ -31,6 +31,7 @@ class UserActionService(
fun recordAction( fun recordAction(
memberId: Long, memberId: Long,
isAuth: Boolean,
actionType: ActionType, actionType: ActionType,
contentId: Long? = null, contentId: Long? = null,
contentCommentId: Long? = null, contentCommentId: Long? = null,
@ -49,6 +50,7 @@ class UserActionService(
repository.flush() repository.flush()
} }
if (isAuth) {
try { try {
transactionTemplate.execute { transactionTemplate.execute {
val policy = policyRepository.findByActionTypeAndIsActiveTrue(actionType, now) val policy = policyRepository.findByActionTypeAndIsActiveTrue(actionType, now)
@ -142,6 +144,7 @@ class UserActionService(
} }
} }
} }
}
companion object { companion object {
private val logger = LoggerFactory.getLogger(UserActionService::class.java) private val logger = LoggerFactory.getLogger(UserActionService::class.java)