v1.1 小秘书红包相关消息简转繁
This commit is contained in:
@@ -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());
|
||||
// 异步发送通知
|
||||
|
@@ -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("此紅包不在進行時")
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user