public Object cycle(){
private Map<String, Long> userTicks = new HashMap<String, Long>();
String memberId = member.getId();
if (userTicks.containsKey(memberId)) {
Long tick = userTicks.get(memberId);
if (System.currentTimeMillis() - tick < 1 * 1000) {
return new APIResult(GlobalConstantsUtil.GENERAL_ERROR, "请勿频繁操作");
}
}
/**
*代码逻辑
*
/
userTicks.put(memberId, System.currentTimeMillis());
return APIResult.createSuccess();
}
原文:https://www.cnblogs.com/qqzhulu/p/10252923.html