1
This commit is contained in:
@@ -3,7 +3,10 @@ package cn.van333.wxsend.aop.annotation;
|
|||||||
import cn.van333.wxsend.constant.CacheConstants;
|
import cn.van333.wxsend.constant.CacheConstants;
|
||||||
import cn.van333.wxsend.enums.LimitType;
|
import cn.van333.wxsend.enums.LimitType;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Leo
|
* @author Leo
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package cn.van333.wxsend.aop.aspectj;
|
package cn.van333.wxsend.aop.aspectj;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
||||||
import cn.van333.wxsend.enums.LimitType;
|
import cn.van333.wxsend.enums.LimitType;
|
||||||
import cn.van333.wxsend.exception.ServiceException;
|
import cn.van333.wxsend.exception.ServiceException;
|
||||||
@@ -20,6 +16,10 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|||||||
import org.springframework.data.redis.core.script.RedisScript;
|
import org.springframework.data.redis.core.script.RedisScript;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流处理
|
* 限流处理
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
package cn.van333.wxsend.business.controller;
|
package cn.van333.wxsend.business.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
||||||
import cn.van333.wxsend.business.model.R;
|
import cn.van333.wxsend.business.model.R;
|
||||||
import cn.van333.wxsend.business.service.LogService;
|
import cn.van333.wxsend.business.service.LogService;
|
||||||
import cn.van333.wxsend.enums.WXMessageType;
|
import cn.van333.wxsend.enums.WXMessageType;
|
||||||
import cn.van333.wxsend.util.SourceForQLUtil;
|
|
||||||
import cn.van333.wxsend.util.TokenUtil;
|
import cn.van333.wxsend.util.TokenUtil;
|
||||||
import cn.van333.wxsend.util.WxSendUtil;
|
import cn.van333.wxsend.util.WxSendUtil;
|
||||||
import cn.van333.wxsend.util.request.MessageRequest;
|
import cn.van333.wxsend.util.request.MessageRequest;
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -18,8 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Leo
|
* @author Leo
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
|||||||
@@ -5,17 +5,19 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
||||||
import cn.van333.wxsend.business.model.R;
|
import cn.van333.wxsend.business.model.R;
|
||||||
import cn.van333.wxsend.business.service.LogService;
|
import cn.van333.wxsend.business.service.LogService;
|
||||||
import cn.van333.wxsend.util.TokenUtil;
|
|
||||||
import cn.van333.wxsend.enums.WXMessageType;
|
import cn.van333.wxsend.enums.WXMessageType;
|
||||||
|
import cn.van333.wxsend.util.SourceForQLUtil;
|
||||||
|
import cn.van333.wxsend.util.TokenUtil;
|
||||||
import cn.van333.wxsend.util.WxSendUtil;
|
import cn.van333.wxsend.util.WxSendUtil;
|
||||||
import cn.van333.wxsend.util.request.MessageRequest;
|
import cn.van333.wxsend.util.request.MessageRequest;
|
||||||
import cn.van333.wxsend.util.SourceForQLUtil;
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.rmi.CORBA.Util;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package cn.van333.wxsend.exception;
|
package cn.van333.wxsend.exception;
|
||||||
|
|
||||||
import cn.van333.wxsend.business.model.R;
|
import cn.van333.wxsend.business.model.R;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
package cn.van333.wxsend.util;
|
package cn.van333.wxsend.util;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.extra.template.Template;
|
|
||||||
import cn.hutool.extra.template.engine.velocity.VelocityEngine;
|
|
||||||
import org.apache.ibatis.jdbc.SQL;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.util.HtmlUtils;
|
import org.springframework.web.util.HtmlUtils;
|
||||||
|
|
||||||
import javax.activation.DataSource;
|
import javax.activation.DataSource;
|
||||||
@@ -55,7 +48,7 @@ public class QCUtil {
|
|||||||
* @param msg
|
* @param msg
|
||||||
*/
|
*/
|
||||||
public static final void consume(long start, long end, String msg) {
|
public static final void consume(long start, long end, String msg) {
|
||||||
System.err.println(String.format("%s consume times: %s=%s-%s", msg, (end - start), end, start));
|
System.err.printf("%s consume times: %s=%s-%s%n", msg, (end - start), end, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package cn.van333.wxsend.util.str;
|
package cn.van333.wxsend.util.str;
|
||||||
|
|
||||||
import cn.van333.wxsend.util.str.StringUtils;
|
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user