修改异常处理上报逻辑,统计添加type20

This commit is contained in:
Jerry Yan 2025-02-05 13:50:52 +08:00
parent 42822f7eda
commit 1eb636d402
2 changed files with 9 additions and 10 deletions

View File

@ -14,6 +14,7 @@ public enum StatisticEnum {
DOWNLOAD(8,"下载"),
CLICK_ON_PAYMENT(9,"点击支付、购买"),
OTHER_ENTER(10,"其他渠道进入"),
SCAN_MARKED_CODE(20,"扫描特殊标记码"),
;

View File

@ -17,7 +17,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.stream.Collectors;
@ -74,15 +73,14 @@ public class CustomExceptionHandle {
@ExceptionHandler(value = Exception.class)
public ApiResponse<String> handle(Exception e) {
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
new Thread(() -> {
NotifyFactory.to().sendTo(
String requestText = getRequestAsText();
new Thread(() -> NotifyFactory.via().sendTo(
new NotifyContent(
"帧途后台报错了!",
e.getMessage() + "\n---\n请求主体\n```\n" + getRequestAsText() + "\n```\n---\n错误栈\n```\n" + getStackTrace(e) + "\n```"
e.getMessage() + "\n---\n请求主体\n```\n" + requestText + "\n```\n---\n错误栈\n```\n" + getStackTrace(e) + "\n```"
),
"default_user"
);
}).start();
)).start();
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
}