admin
2022-05-07 15bedcc619b1edb6eb987f9288db7670e5b38c46
app/src/main/java/com/yeshi/makemoney/app/service/impl/goldcorn/GoldCornMakeServiceImpl.java
@@ -95,9 +95,9 @@
        //间隔判断
        if (config.getMinSpaceTime() != null) {
            List<GoldCornGetRecord> list = goldCornGetRecordService.list(query, 1, 1);
            if (list != null && list.size() > 0 && System.currentTimeMillis() - list.get(0).getCreateTime().getTime() < config.getMinSpaceTime() * 1000L) {
            if (list != null && list.size() > 0 && time.getTime() - list.get(0).getCreateTime().getTime() < config.getMinSpaceTime() * 1000L) {
                String msg = String.format("需要间隔%s秒以上", config.getMinSpaceTime());
                throw new GoldCornMakeException(GoldCornMakeException.CODE_GET_FREQUENCY_LIMIT, msg);
                throw new GoldCornMakeException(GoldCornMakeException.CODE_GET_FREQUENCY_TIME_LIMIT, msg);
            }
        }
@@ -127,7 +127,7 @@
        Map<GoldCornGetType, Long> countMap = goldCornGetRecordService.sumEventCount(query);
        if (countMap.get(type) != null && (countMap.get(type) >= config.getLimitCount())) {
            String msg = String.format("超出%s次/%s的限制", config.getLimitCount(), config.getTimeUnit().getName());
            throw new GoldCornMakeException(GoldCornMakeException.CODE_GET_FREQUENCY_LIMIT, msg);
            throw new GoldCornMakeException(GoldCornMakeException.CODE_GET_FREQUENCY_COUNT_LIMIT, msg);
        }
        return config.getLimitCount() - (countMap.get(type) != null ? countMap.get(type) : 0);
    }