오디션 수정
- 오디션 상태를 모집중으로 변경시 오디션 알림 받기가 되어 있는 유저에게 푸시 발송
This commit is contained in:
@@ -10,7 +10,7 @@ import org.springframework.transaction.event.TransactionalEventListener
|
||||
|
||||
enum class FcmEventType {
|
||||
ALL, INDIVIDUAL, CREATE_LIVE, START_LIVE, CANCEL_LIVE, UPLOAD_CONTENT, SEND_MESSAGE, CHANGE_NOTICE,
|
||||
CREATE_CONTENT_COMMENT
|
||||
CREATE_CONTENT_COMMENT, IN_PROGRESS_AUDITION
|
||||
}
|
||||
|
||||
class FcmEvent(
|
||||
@@ -25,6 +25,7 @@ class FcmEvent(
|
||||
val contentId: Long? = null,
|
||||
val messageId: Long? = null,
|
||||
val creatorId: Long? = null,
|
||||
val auditionId: Long? = null,
|
||||
val commentParentId: Long? = null,
|
||||
val myMemberId: Long? = null,
|
||||
val isAvailableJoinCreator: Boolean? = null
|
||||
@@ -278,6 +279,41 @@ class FcmSendListener(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FcmEventType.IN_PROGRESS_AUDITION -> {
|
||||
if (fcmEvent.auditionId != null && fcmEvent.auditionId > 0) {
|
||||
val pushTokenList = memberRepository.getAuditionNoticeRecipientPushTokens(
|
||||
isAuth = fcmEvent.isAuth ?: false
|
||||
)
|
||||
|
||||
val iosPushTokens = pushTokenList["ios"]
|
||||
val aosPushToken = pushTokenList["aos"]
|
||||
|
||||
if (iosPushTokens != null) {
|
||||
for (tokens in iosPushTokens) {
|
||||
pushService.send(
|
||||
tokens = tokens,
|
||||
title = fcmEvent.title,
|
||||
message = fcmEvent.message,
|
||||
container = "ios",
|
||||
auditionId = fcmEvent.auditionId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (aosPushToken != null) {
|
||||
for (tokens in aosPushToken) {
|
||||
pushService.send(
|
||||
tokens = tokens,
|
||||
title = fcmEvent.title,
|
||||
message = fcmEvent.message,
|
||||
container = "aos",
|
||||
auditionId = fcmEvent.auditionId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,8 @@ class FcmService {
|
||||
roomId: Long? = null,
|
||||
messageId: Long? = null,
|
||||
contentId: Long? = null,
|
||||
creatorId: Long? = null
|
||||
creatorId: Long? = null,
|
||||
auditionId: Long? = null
|
||||
) {
|
||||
if (tokens.isNotEmpty()) {
|
||||
logger.info("os: $container")
|
||||
@@ -76,6 +77,10 @@ class FcmService {
|
||||
multicastMessage.putData("channel_id", creatorId.toString())
|
||||
}
|
||||
|
||||
if (auditionId != null) {
|
||||
multicastMessage.putData("auditionId", auditionId.toString())
|
||||
}
|
||||
|
||||
val response = FirebaseMessaging.getInstance().sendEachForMulticast(multicastMessage.build())
|
||||
logger.info("보내기 성공: ${response.successCount}")
|
||||
logger.info("보내기 실패: ${response.failureCount}")
|
||||
|
Reference in New Issue
Block a user