消息功能完善

1. 赠送道具
2. 购买道具
3. bd邀请代理
4. 代理邀请主播
This commit is contained in:
tianfeng 2025-10-15 19:06:08 +08:00
parent a4861816c0
commit 8575e93a5b
7 changed files with 57 additions and 60 deletions

View File

@ -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
);
/**

View File

@ -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()));
}

View File

@ -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());
}

View File

@ -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()
);
}

View File

@ -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()
);
}

View File

@ -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<Object, Object> 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();
}
}

View File

@ -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<UsePropsDTO> switchUseProps(Long userId, Long propsId) {
@ -79,15 +82,21 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi {
return ResultResponse.success();
}
@Override
public ResultResponse<Void> givePropsNotify(Long userId ,String type,Integer days) {
public ResultResponse<Void> 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();