@
snappyone 当然是放在 doUnpack 方法里靠前的
String userIdsKey = RedisKeys.buildRedPacketUserIdsKey(redPacketId);
if(redisTemplate.hasKey(userIdsKey)){
Boolean member = redisTemplate.opsForSet().isMember(userIdsKey, userId);
if(member){
throw new CommonException(ResponseCode.ERROR, "不可重复领取此红包");
}
redisTemplate.opsForSet().add(userIdsKey, userId);
}else{
redisTemplate.opsForSet().add(userIdsKey, userId);
redisTemplate.expire(userIdsKey, 1, TimeUnit.HOURS);
}