|
@@ -50,8 +50,11 @@ public class ParkingCouponController {
|
|
|
@SaIgnore
|
|
@SaIgnore
|
|
|
@GetMapping
|
|
@GetMapping
|
|
|
public void jump(HttpServletResponse response, @RequestParam String code) throws IOException {
|
|
public void jump(HttpServletResponse response, @RequestParam String code) throws IOException {
|
|
|
|
|
+ log.info("停车券跳转请求, code: {}", code);
|
|
|
var url = KymCache.INSTANCE.getParkingCouponUrl(code);
|
|
var url = KymCache.INSTANCE.getParkingCouponUrl(code);
|
|
|
|
|
+ log.info("从缓存获取停车券URL, code: {}, urlLength: {}", code, url != null ? url.length() : 0);
|
|
|
if (url == null || url.isEmpty()) {
|
|
if (url == null || url.isEmpty()) {
|
|
|
|
|
+ log.warn("停车券链接已失效, code: {}", code);
|
|
|
response.setContentType("text/html; charset=utf-8");
|
|
response.setContentType("text/html; charset=utf-8");
|
|
|
response.getWriter().write("""
|
|
response.getWriter().write("""
|
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
@@ -65,11 +68,13 @@ public class ParkingCouponController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (url.length() < MAX_REDIRECT_URL_LENGTH) {
|
|
if (url.length() < MAX_REDIRECT_URL_LENGTH) {
|
|
|
|
|
+ log.info("短 URL 直接重定向, code: {}, urlLength: {}", code, url.length());
|
|
|
response.sendRedirect(url);
|
|
response.sendRedirect(url);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// URL 过长时使用服务端代理,避免浏览器 GET 请求触发第三方服务器 414
|
|
// URL 过长时使用服务端代理,避免浏览器 GET 请求触发第三方服务器 414
|
|
|
|
|
+ log.info("长 URL 使用代理, code: {}, urlLength: {}", code, url.length());
|
|
|
try {
|
|
try {
|
|
|
String content = HttpUtil.get(url);
|
|
String content = HttpUtil.get(url);
|
|
|
String origin = extractOrigin(url);
|
|
String origin = extractOrigin(url);
|