diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java index 912e2345..f9cf3f43 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java @@ -1,27 +1,19 @@ package com.red.circle.other.app.command.dynamic.add; -import com.alibaba.fastjson.JSON; -import com.red.circle.auth.inner.endpoint.AuthClient; -import com.red.circle.common.business.core.ReplaceString; -import com.red.circle.common.business.core.SensitiveWordFilter; import com.red.circle.common.business.core.enums.ApprovalStatusEnum; import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; import com.red.circle.common.business.core.enums.DynamicEventTypeEnum; -import com.red.circle.common.business.enums.AccountStatusEnum; import com.red.circle.common.business.enums.PhotoApprovalStatusEnum; import com.red.circle.component.redis.service.RedisService; import com.red.circle.external.inner.endpoint.message.ImAccountClient; import com.red.circle.external.inner.endpoint.message.NewsletterClient; import com.red.circle.external.inner.endpoint.oss.OssServiceClient; -import com.red.circle.external.inner.model.cmd.message.NewsletterResultCmd; -import com.red.circle.external.inner.model.enums.message.NewsletterEvent; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.framework.core.response.ResponseErrorCode; import com.red.circle.mq.business.model.event.approval.CensorContent; import com.red.circle.mq.business.model.event.approval.CensorProfileEvent; import com.red.circle.mq.business.model.event.dynamic.DynamicEvent; -import com.red.circle.mq.business.model.event.task.TaskApprovalEvent; import com.red.circle.mq.rocket.business.producer.CensorMqMessage; import com.red.circle.mq.rocket.business.producer.DynamicMqMessage; import com.red.circle.mq.rocket.business.producer.TaskMqMessage; @@ -29,7 +21,6 @@ import com.red.circle.other.app.dto.cmd.dynamic.DynamicContentAddCmd; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; import com.red.circle.other.domain.model.user.UserConsumptionLevel; -import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.common.user.UserAccountCommon; import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; @@ -43,9 +34,7 @@ import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureSer import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; import com.red.circle.other.inner.asserts.DynamicErrorCode; -import com.red.circle.other.inner.model.cmd.user.account.PunishmentAccountCmd; import com.red.circle.tool.core.collection.CollectionUtils; -import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.num.ArithmeticUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils; @@ -95,17 +84,15 @@ public class DynamicContentAddCmdExe { public Long execute(DynamicContentAddCmd cmd) { + //校验参数 checkParameters(cmd); Long contentId = IdWorkerUtils.getId(); - consumeGold(cmd, contentId); - + //保存动态 save(cmd, contentId); - dynamicCacheService.pushUserTodayDynamicCount(cmd.getReqUserId()); - - + dynamicCacheService.incrUserTodayDynamicCount(cmd.getReqUserId()); if (CollectionUtils.isEmpty(cmd.getPictures())) { return contentId; @@ -114,11 +101,6 @@ public class DynamicContentAddCmdExe { addApprovalDynamic(cmd, contentId); sendViolationContentMq(cmd); - - - - - return contentId; } @@ -259,24 +241,6 @@ public class DynamicContentAddCmdExe { dynamicTagService.getById(cmd.getTagId())); } - checkUserLevel(cmd); - if (SensitiveWordFilter.checkSensitiveWord(cmd.getContent())){ - // 封禁账号及设备 -// userAccountCommon.punishmentPro(new PunishmentAccountCmd() -// .setBeOptUserId(cmd.getReqUserId()) -// .setOptUserId(cmd.requiredReqUserId()) -// .setStatus(AccountStatusEnum.ARCHIVE) -// .setDescription("【动态涉及敏感词】封号-" + cmd.getContent()) -// ); -// -// UserProfile userProfile = new UserProfile(); -// userProfile.setId(cmd.getReqUserId()); -// userProfile.setCheckStatus(AccountStatusEnum.ARCHIVE.name()); -// userProfileGateway.updateSelectiveById(userProfile); - ResponseAssert.isTrue(DynamicErrorCode.SENSITIVE_WORD_ERROR, Boolean.FALSE); - //clearUserSource(cmd.getReqUserId(), AccountStatusEnum.ARCHIVE_DEVICE); - } - //判断是否为动态黑名单用户,是则不能发动态 ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, dynamicBlacklistService.exist(cmd.getReqUserId())); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java index b05cc1bf..35287a06 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java @@ -204,6 +204,6 @@ public interface DynamicCacheService { * @param userId 用户ID * @return 今天用户发布的动态数量 */ - Long pushUserTodayDynamicCount(Long userId); + Long incrUserTodayDynamicCount(Long userId); } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java index 8181bc69..957e91db 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java @@ -232,7 +232,7 @@ public class DynamicCacheServiceImpl implements DynamicCacheService { } @Override - public Long pushUserTodayDynamicCount(Long userId) { + public Long incrUserTodayDynamicCount(Long userId) { return redisService .increment(getUserTodayDynamicCountAppendKey(userId), 1, TimeUnit.DAYS); }