消息类型处理

This commit is contained in:
tianfeng 2025-11-19 19:58:40 +08:00
parent aa3b880427
commit 8848c93ab4
2 changed files with 33 additions and 16 deletions

View File

@ -48,4 +48,17 @@ public enum BadgeConfigTypeEnum {
return Objects.equals(this.name(), name);
}
public static boolean isHonorType(String name) {
return name != null && name.startsWith("HONOR");
}
public static boolean of(String name) {
for (BadgeConfigTypeEnum value : values()) {
if (value.name().equals(name)) {
return true;
}
}
return false;
}
}

View File

@ -16,6 +16,7 @@ import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.domain.model.user.ability.RegionConfig;
import com.red.circle.other.inner.endpoint.material.props.api.PropsBackpackClientApi;
import com.red.circle.other.inner.enums.material.BadgeConfigTypeEnum;
import com.red.circle.other.inner.enums.material.PropsCommodityType;
import com.red.circle.other.inner.model.cmd.material.DeletePropsCmd;
import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd;
@ -93,24 +94,27 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi {
url = props.getCover();
}
Map<String, Object> map = new HashMap<>();
map.put("propType", type);
if (!Objects.isNull(user)) {
if (Arrays.asList("ACTIVITY", "ADMINISTRATOR").contains(type)) {
BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId);
url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : "";
map.put("propType", "BADGE");
if (Objects.isNull(user)) {
return ResultResponse.success();
}
Map<String, Object> map = new HashMap<>();
map.put("propType", type);
if (BadgeConfigTypeEnum.of(type)) {
BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId);
url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : "";
}
RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId);
officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder().toAccount(userId)
.noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS)
.title(JSON.toJSONString(map))
.content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName())))
.expand(url)
.build());
}
RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId);
officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder().toAccount(userId)
.noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS)
.title(JSON.toJSONString(map))
.content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName())))
.expand(url)
.build());
return ResultResponse.success();
}