v1.1 小秘书红包相关消息简转繁

This commit is contained in:
2022-10-18 18:19:24 +08:00
parent 9867edc820
commit 6183b31e96
2 changed files with 9 additions and 9 deletions

View File

@@ -116,7 +116,7 @@ public class FansRoomService extends ServiceImpl<FansRoomMapper,FansRoom> {
public void inviteRoomFans(Long roomUid) {
Room room = roomService.getRoomByUid(roomUid);
if (StringUtils.isNotEmpty(room.getRoomPwd())) {
throw new ServiceException("已上锁房间不可邀请粉丝");
throw new ServiceException("已上鎖房間不可邀請粉絲");
}
// 每天邀请次数限制
String value = jedisService.hget(
@@ -125,11 +125,11 @@ public class FansRoomService extends ServiceImpl<FansRoomMapper,FansRoom> {
Integer inviteTimesLimit = Integer.parseInt(jedisService.get(RedisKey.invite_room_fans_times_limit.getKey()));
Integer inviteIntervalLimit = Integer.parseInt(jedisService.get(RedisKey.invite_room_fans_interval_limit.getKey()));
if (inviteTimes >= inviteTimesLimit) {
throw new ServiceException("每日邀请次数不可超" + inviteTimes.toString() + "");
throw new ServiceException("每日邀請次數不可超" + inviteTimes.toString() + "");
}
Boolean result = jedisService.setnx(RedisKey.invite_room_fans_interval.getKey(roomUid.toString()), "-", inviteIntervalLimit);
if (!result) {
throw new ServiceException("前已发出过邀请");
throw new ServiceException("前已發出過邀請");
}
jedisService.hincr(RedisKey.invite_room_fans_daily_times.getKey(DateTimeUtil.getTodayStr()), roomUid.toString());
// 异步发送通知

View File

@@ -144,7 +144,7 @@ abstract class RedEnvelopeStrategy {
val buildRedEnvelopeDTO = redEnvelopeStrategy.buildRedEnvelopeDTO(sendRedEnvelopeDTO)
redEnvelopeStrategy.sendMinAmountCheck(buildRedEnvelopeDTO)
redEnvelopeStrategy.redenvelopeParamCheck(buildRedEnvelopeDTO)
userPurseService.subDiamond(sendRedEnvelopeDTO.userId, sendRedEnvelopeDTO.amount.toDouble(), "发送红包扣除${sendRedEnvelopeDTO.amount}")
userPurseService.subDiamond(sendRedEnvelopeDTO.userId, sendRedEnvelopeDTO.amount.toDouble(), "發送紅包扣除${sendRedEnvelopeDTO.amount}")
val generateRedEnvelopeId = redEnvelopeStrategy.saveSendRecord(buildRedEnvelopeDTO)
sendRedEnvelopeDTO.id = generateRedEnvelopeId
redEnvelopeStrategy.doSendNotify(sendRedEnvelopeDTO)
@@ -178,7 +178,7 @@ abstract class RedEnvelopeStrategy {
val redEnvelopeService = SpringContextHolder.getBean(RedEnvelopeService::class.java)
val redEnvelope = redEnvelopeService.getById(redEnvelopeId)
val userPurseService = SpringContextHolder.getBean(UserPurseService::class.java)
userPurseService.addDiamond(redEnvelope.userId, calculateBackGold.toDouble(), null, "包退 $calculateBackGold ")
userPurseService.addDiamond(redEnvelope.userId, calculateBackGold.toDouble(), null, "包退 $calculateBackGold ")
redEnvelopeStrategy.backNotify(redEnvelopeId, calculateBackGold)
// 插入账单
if (redEnvelope.type == RedEnvelopTypeEnum.DIAMOND) {
@@ -321,19 +321,19 @@ abstract class RedEnvelopeStrategy {
val redEnvelopService = SpringContextHolder.getBean(RedEnvelopeService::class.java)
val stateById = redEnvelopService.stateById(redEnvelopeId)
if (stateById == RedEnvelopStateEnum.TIME_OUT) {
throw ServiceException("包已超")
throw ServiceException("包已超")
}
if (stateById == RedEnvelopStateEnum.REMAIN_ZERO) {
throw ServiceException("包已经抢完了")
throw ServiceException("包已經搶完了")
}
if (stateById == RedEnvelopStateEnum.WILL) {
throw ServiceException("红包还没开")
throw ServiceException("紅包還沒開")
}
if (stateById != RedEnvelopStateEnum.ING) {
throw ServiceException("包不在进行时")
throw ServiceException("包不在進行時")
}
}