From 93c13c47fd35493bbca35be7baccfd1a0ba9e9ef Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 16 十二月 2022 09:52:38 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/controller/other/FloatServerController.java | 38 +++++++++++++++++++++++++++----------- 1 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/lf/server/controller/other/FloatServerController.java b/src/main/java/com/lf/server/controller/other/FloatServerController.java index c203d25..acfcfb9 100644 --- a/src/main/java/com/lf/server/controller/other/FloatServerController.java +++ b/src/main/java/com/lf/server/controller/other/FloatServerController.java @@ -2,14 +2,15 @@ import com.alibaba.fastjson.JSON; import com.lf.server.controller.all.BaseController; -import com.lf.server.entity.show.FloatServerResponse; -import com.lf.server.entity.show.ReqParamFloatServer; +import com.lf.server.entity.other.FloatServerResponse; +import com.lf.server.entity.other.ReqParamFloatServer; import com.lf.server.helper.HttpHelper; import com.lf.server.helper.LicHelper; import io.swagger.annotations.Api; import org.apache.http.HttpEntity; import org.apache.http.entity.InputStreamEntity; import org.apache.http.util.EntityUtils; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -28,7 +29,7 @@ private static boolean isRedirect = false; - @RequestMapping({"/checkout/license"}) + @PostMapping({"/checkout/license"}) public void license(HttpServletRequest req, HttpServletResponse res) { try { if (isRedirect) { @@ -43,15 +44,15 @@ LicHelper helper = getHelper(); String reqJson = helper.b(str); - ReqParamFloatServer reqParam = JSON.parseObject(reqJson, ReqParamFloatServer.class); - FloatServerResponse fsr = new FloatServerResponse(reqParam); + ReqParamFloatServer rfs = JSON.parseObject(reqJson, ReqParamFloatServer.class); + FloatServerResponse fsr = new FloatServerResponse(rfs); String resJson = JSON.toJSONString(fsr); String strRes = helper.a(resJson); res.getWriter().write(strRes); } catch (Exception ex) { - // + log.error(ex.getMessage(), ex); } } @@ -64,7 +65,7 @@ return -1; } - private LicHelper getHelper() { + private static LicHelper getHelper() { if (licHelper == null) { licHelper = new LicHelper(); licHelper.d("&kdaow$IEW.##%5-"); @@ -74,15 +75,30 @@ return licHelper; } - private void test() { + @SuppressWarnings("AlibabaUndefineMagicConstant") + private static String getClientIpAddr(HttpServletRequest req) { + String ip; + if ((ip = req.getHeader("x-forwarded-for")) == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = req.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = req.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = req.getRemoteAddr(); + } + + return ip; + } + + public static void test() { try { ReqParamFloatServer reqParam = new ReqParamFloatServer("192.168.20.106", "12316"); String json = JSON.toJSONString(reqParam); - LicHelper helper = new LicHelper(); - helper.d("&kdaow$IEW.##%5-"); - helper.c("*y91z72a;pclfleoqc20161v$DSP&%3+"); + String licCode = "78a82f0920de0f557f8177bec1e48601c4dc25e4054a00728e4314b56528d3a1632de5298edee38a65412277977a174fea5d91c452b19ef138dbc2ba089ba632"; + LicHelper helper = getHelper(); String str = helper.a(json); System.out.println("ReqParamFloatServer: " + str); -- Gitblit v1.9.3