From da4ecf7d23c0e266db31bc8d590655a7ffa33966 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 12 Dec 2023 11:53:16 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=EB=AC=B4=EB=A3=8C=20=EC=B6=A9=EC=A0=84=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/can/charge/free/AdsCharge.kt | 23 ----- .../can/charge/free/AdsChargeController.kt | 35 -------- .../can/charge/free/AdsChargeRepository.kt | 7 -- .../can/charge/free/AdsChargeService.kt | 85 ------------------- src/main/resources/application.yml | 6 -- src/test/resources/application.yml | 3 - 6 files changed, 159 deletions(-) delete mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt delete mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt delete mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt delete mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt deleted file mode 100644 index d290824..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsCharge.kt +++ /dev/null @@ -1,23 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import kr.co.vividnext.sodalive.common.BaseEntity -import kr.co.vividnext.sodalive.member.Member -import javax.persistence.Entity -import javax.persistence.FetchType -import javax.persistence.JoinColumn -import javax.persistence.ManyToOne - -@Entity -data class AdsCharge( - val transactionKey: String, - val adKey: String, - val adName: String, - val adProfit: Float, - val adCurrency: String, - val point: Float, - val deviceIfa: String -) : BaseEntity() { - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "member_id", nullable = false) - var member: Member? = null -} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt deleted file mode 100644 index ea6bf41..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeController.kt +++ /dev/null @@ -1,35 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import org.springframework.web.bind.annotation.GetMapping -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.RequestParam -import org.springframework.web.bind.annotation.RestController - -@RestController -@RequestMapping("/charge/ads") -class AdsChargeController(private val service: AdsChargeService) { - @GetMapping - fun adsCharge( - @RequestParam("transaction_key") transactionKey: String, - @RequestParam("placement_uid") placementUid: String, - @RequestParam("ad_key") adKey: String, - @RequestParam("ad_name") adName: String, - @RequestParam("ad_profit") adProfit: String, - @RequestParam("ad_currency") adCurrency: String, - @RequestParam("point") point: String, - @RequestParam("device_ifa") deviceIfa: String, - @RequestParam("picker_uid") memberId: String - ) { - service.adsCharge( - transactionKey, - placementUid, - adKey, - adName, - adProfit, - adCurrency, - point, - deviceIfa, - memberId - ) - } -} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt deleted file mode 100644 index 8b71aea..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeRepository.kt +++ /dev/null @@ -1,7 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import org.springframework.data.jpa.repository.JpaRepository -import org.springframework.stereotype.Repository - -@Repository -interface AdsChargeRepository : JpaRepository diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt deleted file mode 100644 index 1541fde..0000000 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/free/AdsChargeService.kt +++ /dev/null @@ -1,85 +0,0 @@ -package kr.co.vividnext.sodalive.can.charge.free - -import kr.co.vividnext.sodalive.can.charge.Charge -import kr.co.vividnext.sodalive.can.charge.ChargeRepository -import kr.co.vividnext.sodalive.can.charge.ChargeStatus -import kr.co.vividnext.sodalive.can.payment.Payment -import kr.co.vividnext.sodalive.can.payment.PaymentGateway -import kr.co.vividnext.sodalive.can.payment.PaymentStatus -import kr.co.vividnext.sodalive.common.AdsChargeException -import kr.co.vividnext.sodalive.fcm.FcmEvent -import kr.co.vividnext.sodalive.fcm.FcmEventType -import kr.co.vividnext.sodalive.member.MemberRepository -import org.springframework.beans.factory.annotation.Value -import org.springframework.context.ApplicationEventPublisher -import org.springframework.data.repository.findByIdOrNull -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional - -@Service -class AdsChargeService( - private val repository: AdsChargeRepository, - private val memberRepository: MemberRepository, - private val chargeRepository: ChargeRepository, - private val applicationEventPublisher: ApplicationEventPublisher, - - @Value("\${point-click.placement-uid}") - private val placementUid: String -) { - @Transactional - fun adsCharge( - transactionKey: String, - placementUid: String, - adKey: String, - adName: String, - adProfit: String, - adCurrency: String, - point: String, - deviceIfa: String, - memberId: String - ) { - if (placementUid != this.placementUid) { - throw AdsChargeException("잘못된 요청입니다.") - } - - val member = memberRepository.findByIdOrNull(id = memberId.toLong()) - ?: throw AdsChargeException("잘못된 요청입니다.") - - val adsCharge = AdsCharge( - transactionKey = transactionKey, - adKey = adKey, - adName = adName, - adProfit = adProfit.toFloat(), - adCurrency = adCurrency, - point = point.toFloat(), - deviceIfa = deviceIfa - ) - adsCharge.member = member - repository.save(adsCharge) - - val charge = Charge(0, rewardCan = adsCharge.point.toInt(), status = ChargeStatus.ADS) - charge.title = "${adsCharge.point.toInt()} 캔" - charge.member = member - - val payment = Payment( - status = PaymentStatus.COMPLETE, - paymentGateway = PaymentGateway.POINT_CLICK_AD - ) - - payment.method = "제휴보상" - charge.payment = payment - chargeRepository.save(charge) - - member.charge(0, adsCharge.point.toInt(), "ads") - - applicationEventPublisher.publishEvent( - FcmEvent( - type = FcmEventType.INDIVIDUAL, - title = "제휴보상", - message = "${adsCharge.point.toInt()} 캔이 지급되었습니다.", - recipients = listOf(member.id!!), - isAuth = null - ) - ) - } -} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3be6e79..1f71979 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -20,9 +20,6 @@ agora: appId: ${AGORA_APP_ID} appCertificate: ${AGORA_APP_CERTIFICATE} -pointClick: - placementUid: fc07cfb1-ef16-455c-bdad-22aa9e8fd78c - firebase: secretKeyPath: ${GOOGLE_APPLICATION_CREDENTIALS} @@ -92,6 +89,3 @@ spring: hibernate: show_sql: true format_sql: true - -pointClick: - placementUid: test diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 6639ad7..a4d9db8 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -13,9 +13,6 @@ agora: appId: ${AGORA_APP_ID} appCertificate: ${AGORA_APP_CERTIFICATE} -pointClick: - placementUid: test - cloud: aws: credentials: From 7e02acd22cb64f94ec77316d473a03dab82df103 Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 14 Dec 2023 00:02:48 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=B0=A9=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20-=20=ED=81=AC=EB=A6=AC=EC=97=90?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20URL=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/vividnext/sodalive/live/room/GetRoomListResponse.kt | 1 + .../kr/co/vividnext/sodalive/live/room/LiveRoomService.kt | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt index 34edc54..2649133 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/GetRoomListResponse.kt @@ -12,6 +12,7 @@ data class GetRoomListResponse( val price: Int, val tags: List, val channelName: String?, + val creatorProfileImage: String, val creatorNickname: String, val creatorId: Long, val isReservation: Boolean, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt index 09101b0..25ab32f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/room/LiveRoomService.kt @@ -146,6 +146,11 @@ class LiveRoomService( isAdult = it.isAdult, price = it.price, channelName = it.channelName, + creatorProfileImage = if (it.member!!.profileImage != null) { + "$cloudFrontHost/${it.member!!.profileImage}" + } else { + "$cloudFrontHost/profile/default-profile.png" + }, creatorNickname = it.member!!.nickname, creatorId = it.member!!.id!!, tags = it.tags