From 8575e93a5b60798bffbe950111d04c6a07029abc Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 15 Oct 2025 19:06:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8A=9F=E8=83=BD=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 赠送道具 2. 购买道具 3. bd邀请代理 4. 代理邀请主播 --- .../props/api/PropsBackpackClientApi.java | 3 +- .../app/props/PropsGiveServiceImpl.java | 6 ++-- .../material/PropsPurchasingCmdExe.java | 20 +++++++++---- .../app/command/team/AgentInviteHostExe.java | 27 ++++-------------- .../app/command/team/BdAgentInviteExe.java | 28 ++----------------- .../other/app/util/OfficialNoticeUtils.java | 20 +++++++++++++ .../props/PropsBackpackClientEndpoint.java | 13 +++++++-- 7 files changed, 57 insertions(+), 60 deletions(-) create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/util/OfficialNoticeUtils.java diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/material/props/api/PropsBackpackClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/material/props/api/PropsBackpackClientApi.java index 881cbfcb..96e5fc45 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/material/props/api/PropsBackpackClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/material/props/api/PropsBackpackClientApi.java @@ -74,7 +74,8 @@ public interface PropsBackpackClientApi { ResultResponse givePropsNotify( @RequestParam("userId") Long userId, @RequestParam("propsType") String propsType, - @RequestParam("days") Integer days + @RequestParam("days") Integer days, + @RequestParam("propsId") Long propsId ); /** diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/props/PropsGiveServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/props/PropsGiveServiceImpl.java index cb106b9a..8e7293a7 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/props/PropsGiveServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/props/PropsGiveServiceImpl.java @@ -138,7 +138,7 @@ public class PropsGiveServiceImpl implements PropsGiveService { if (Objects.equals(cmd.getSecondaryType(), ConsolePropsTypeEnum.THEME.getName())) { handleTheme(cmd); //发送通知 - propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays()); + propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays(), Long.valueOf(cmd.getContent())); return; } sendPropsBackpack(cmd); @@ -151,7 +151,7 @@ public class PropsGiveServiceImpl implements PropsGiveService { isNullOrZero(cmd.getExchangeDays()); handleBadge(cmd); //发送通知 - propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays()); + propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays(), Long.valueOf(cmd.getContent())); return; } if (Objects.equals(cmd.getType(), PropsActivityRewardEnum.GOLD.name())) { @@ -325,7 +325,7 @@ public class PropsGiveServiceImpl implements PropsGiveService { .setOpUser(cmd.getOpsUser()); propsBackpackClient.giveProps(givePropsBackpackCmd); //发送通知 - propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays()); + propsBackpackClient.givePropsNotify(cmd.getReceiverId(),cmd.getSecondaryType(),cmd.getExchangeDays(), Long.valueOf(cmd.getContent())); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java index afac4ef8..e6ec5bda 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/material/PropsPurchasingCmdExe.java @@ -14,6 +14,7 @@ import com.red.circle.mq.rocket.business.producer.TaskMqMessage; import com.red.circle.other.app.dto.cmd.material.PropsPurchasingCmd; import com.red.circle.other.domain.gateway.props.PropsStoreGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; @@ -26,6 +27,7 @@ import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility; import com.red.circle.other.inner.model.dto.material.props.ProductProps; import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO; import com.red.circle.other.inner.model.dto.material.props.PropsStoreCommodity; +import com.red.circle.tool.core.collection.MapBuilder; import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils; @@ -94,7 +96,7 @@ public class PropsPurchasingCmdExe { nobleVipAbility(cmd, commodity); } - sendGiveAwayNotice(cmd); + sendGiveAwayNotice(cmd, commodity); //完成任务 钩子 9 充值 taskMqMessage.sendTask(TaskApprovalEvent.builder() @@ -176,18 +178,24 @@ public class PropsPurchasingCmdExe { } - private void sendGiveAwayNotice(PropsPurchasingCmd cmd) { + private void sendGiveAwayNotice(PropsPurchasingCmd cmd, PropsStoreCommodity commodity) { if (cmd.isPurchasing()) { return; } + UserProfile userProfile = userProfileGateway.getByUserId(cmd.requiredReqUserId()); + + String sourceUrl = commodity.getPropsResources().getSourceUrl(); officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder() .toAccount(cmd.getAcceptUserId()) .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) - .templateParam(Map.of("nickname", - userProfileGateway.getByUserId(cmd.requiredReqUserId()) - .getUserNickname() - , "effectDuration", cmd.getDays())) + .templateParam(MapBuilder.builder() + .put("userProfile", String.format("%s(%s)", userProfile.getUserNickname(), userProfile.getAccount())) + .put("userAvatar", userProfile.getUserAvatar()) + .put("countryCode", userProfile.getCountryCode()) + .put("countryName", userProfile.getCountryName()) + .build()) + .expand(sourceUrl) .build()); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/AgentInviteHostExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/AgentInviteHostExe.java index aa3fa0c4..08db0e56 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/AgentInviteHostExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/AgentInviteHostExe.java @@ -11,6 +11,7 @@ import com.red.circle.framework.core.response.ResponseErrorCode; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.team.BdInviteMessageCO; import com.red.circle.other.app.dto.cmd.team.*; +import com.red.circle.other.app.util.OfficialNoticeUtils; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.mongo.entity.team.bd.BdInviteAgentMessage; @@ -183,10 +184,7 @@ public class AgentInviteHostExe { officialNoticeClient.send( NoticeExtTemplateTypeCmd.builder() .toAccount(message.getUserId()) - .templateParam(MapBuilder.builder() - .put("userProfile", String.format("%s(%s)", userProfile.getUserNickname(), - userProfile.actualAccount())) - .build()) + .templateParam(OfficialNoticeUtils.buildUserProfile(userProfile)) .noticeType(noticeTypeEnum) .build() ); @@ -195,28 +193,13 @@ public class AgentInviteHostExe { private void sendMessage(AgentInviteHostCmd cmd) { UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId())); ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile); - String h5Url = enumConfigCacheService.getValue(EnumConfigKey.H5_DOMAIN_BASE_URL_V2,cmd.requireReqSysOrigin()); +// String h5Url = enumConfigCacheService.getValue(EnumConfigKey.H5_DOMAIN_BASE_URL_V2,cmd.requireReqSysOrigin()); - if (StringUtils.isBlank(h5Url)) { - return; - } - String path = null; - - if (Objects.equals(cmd.requireReqSysOriginEnum(), SysOriginPlatformEnum.TARAB)) { - path = "/team-tarab"; - } - - if (StringUtils.isBlank(path)) { - return; - } officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder() .toAccount(cmd.getInviteUserId()) .noticeType(OfficialNoticeTypeEnum.AGENT_SEND_INVITE_HOST) - .templateParam(MapBuilder.builder() - .put("userProfile", String.format("%s(%s)", userProfile.getUserNickname(), - userProfile.actualAccount())) - .build()) - .expand(h5Url + path) + .templateParam(OfficialNoticeUtils.buildUserProfile(userProfile)) +// .expand(h5Url) .build() ); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java index 10756d76..336ee32c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java @@ -8,6 +8,7 @@ import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.team.DbInviteAgentCmd; +import com.red.circle.other.app.util.OfficialNoticeUtils; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; @@ -153,40 +154,15 @@ public class BdAgentInviteExe { } private void sendMessage(DbInviteAgentCmd cmd) { - cmd.setUrl("/team-yolo/apply-join"); UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( userProfileGateway.getByUserId(cmd.requiredReqUserId()) ); ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile); - String h5Url = enumConfigCacheService.getValue(EnumConfigKey.H5_DOMAIN_BASE_URL_V2, - cmd.requireReqSysOrigin()); - if (StringUtils.isBlank(h5Url)) { - return; - } - String path = null; - if (Objects.equals(cmd.requireReqSysOriginEnum(), SysOriginPlatformEnum.TARAB)) { - path = "/team-tarab"; - } - if (Objects.equals(cmd.requireReqSysOriginEnum(), SysOriginPlatformEnum.YOLO)) { - if (StringUtils.isNotBlank(cmd.getUrl())){ - path = cmd.getUrl(); - }else { - path = "/team"; - } - - } - if (StringUtils.isBlank(path)) { - return; - } officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder() .toAccount(cmd.getInviteUserId()) .noticeType(OfficialNoticeTypeEnum.BD_SEND_INVITE_AGENT) - .templateParam(MapBuilder.builder() - .put("userProfile", String.format("%s(%s)", userProfile.getUserNickname(), - userProfile.actualAccount())) - .build()) - .expand(h5Url + path) + .templateParam(OfficialNoticeUtils.buildUserProfile(userProfile)) .build() ); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/util/OfficialNoticeUtils.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/util/OfficialNoticeUtils.java new file mode 100644 index 00000000..778a7844 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/util/OfficialNoticeUtils.java @@ -0,0 +1,20 @@ +package com.red.circle.other.app.util; + +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.tool.core.collection.MapBuilder; + +import java.util.Map; + +public class OfficialNoticeUtils { + + public static Map buildUserProfile(UserProfileDTO userProfile) { + return MapBuilder.builder() + .put("userNickname", userProfile.getUserNickname()) + .put("account", userProfile.actualAccount()) + .put("userAvatar", userProfile.getUserAvatar()) + .put("countryCode", userProfile.getCountryCode()) + .put("countryName", userProfile.getCountryName()) + .build(); + } + +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java index ae6571d1..c60d2ae9 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java @@ -5,6 +5,8 @@ import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExt import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum; import com.red.circle.framework.dto.ResultResponse; import com.red.circle.other.app.inner.service.material.props.PropsBackpackClientService; +import com.red.circle.other.infra.database.rds.entity.props.PropsSourceRecord; +import com.red.circle.other.infra.database.rds.service.props.PropsSourceRecordService; import com.red.circle.other.infra.utils.I18nUtils; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; @@ -43,6 +45,7 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi { private final OfficialNoticeClient officialNoticeClient; private final UserProfileGateway userProfileGateway; private final UserRegionGateway userRegionGateway; + private final PropsSourceRecordService propsSourceRecordService; @Override public ResultResponse switchUseProps(Long userId, Long propsId) { @@ -79,15 +82,21 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi { return ResultResponse.success(); } @Override - public ResultResponse givePropsNotify(Long userId ,String type,Integer days) { + public ResultResponse givePropsNotify(Long userId ,String type,Integer days, Long propsId) { UserProfile user = userProfileGateway.getByUserId(userId); + String url = null; + PropsSourceRecord props = propsSourceRecordService.getPropsById(propsId); + if (props != null) { + url = props.getCover(); + } + if (!Objects.isNull(user)) { RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId); officialNoticeClient.send( NoticeExtTemplateCustomizeCmd.builder().toAccount(userId) .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) .content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName()))) - .expand(null) + .expand(url) .build()); } return ResultResponse.success();