From 47fcc2fa76d1dea0880993fce14fea446b0cbb8e Mon Sep 17 00:00:00 2001 From: grimm <1769111741@qq.com> Date: Wed, 8 May 2024 11:48:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=B1=E8=B6=A3=E8=81=94=E7=9B=9F=E5=A6=96?= =?UTF-8?q?=E6=99=B6=E6=B8=A0=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/controller/GetUserController.java | 8 ++-- .../ljsd/service/YgAqlmYjVerifyService.java | 43 +++++++++++++++++++ .../service/YouguDiscountVerifyService.java | 6 +-- 3 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/ljsd/service/YgAqlmYjVerifyService.java diff --git a/src/main/java/com/ljsd/controller/GetUserController.java b/src/main/java/com/ljsd/controller/GetUserController.java index 870ffe5..6352035 100644 --- a/src/main/java/com/ljsd/controller/GetUserController.java +++ b/src/main/java/com/ljsd/controller/GetUserController.java @@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; +import java.security.SecureRandom; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,6 +53,7 @@ public class GetUserController extends HttpServlet { serviceMap.put("XQFP", new XqfpVerifyService("XQFP")); serviceMap.put("ZZXX", new ZzxxVerifyService("ZZXX")); serviceMap.put("AQLM", new AQLMVerifyService("AQLM")); + serviceMap.put("AQLMYJ", new YgAqlmYjVerifyService("AQLMYJ")); serviceMap.put("WYDDS", new EightUVerifyService("WYDDS")); } @@ -128,9 +130,6 @@ public class GetUserController extends HttpServlet { String channel = request.getParameter("channel"); String sub_channel = request.getParameter("sub_channel"); LOGGER.info("the opendId = {},token={},platform={} admin=>{} channel=>{} sub_channel={}",openId,token,platform,admin,channel,sub_channel); - if(serviceMap == null){ - LOGGER.info("serviceMap is null"); - } try { //根据前端发过来的种类进行校验 if(channel==null|| channel.isEmpty()){ @@ -166,7 +165,7 @@ public class GetUserController extends HttpServlet { List userInfos = BaseGlobal.getInstance().mongoDBPool.find(_COLLECTION_NAME, dbObject); if (userInfos.isEmpty()) { try{ - boolean getLock=false; + boolean getLock=false; while(!getLock){ getLock = BaseGlobal.getInstance().redisApp.tryGetDistributedLock(RedisKey.REGISTER_LOCK, "", "get", 800); if(getLock){ @@ -223,7 +222,6 @@ public class GetUserController extends HttpServlet { out.close(); } - @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { diff --git a/src/main/java/com/ljsd/service/YgAqlmYjVerifyService.java b/src/main/java/com/ljsd/service/YgAqlmYjVerifyService.java new file mode 100644 index 0000000..accd295 --- /dev/null +++ b/src/main/java/com/ljsd/service/YgAqlmYjVerifyService.java @@ -0,0 +1,43 @@ +package com.ljsd.service; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.ljsd.pojo.VerifyParams; +import com.ljsd.util.HttpUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +public class YgAqlmYjVerifyService extends YouGuVerifyService { + private static final Logger LOGGER = LoggerFactory.getLogger(YgAqlmYjVerifyService.class); + + public YgAqlmYjVerifyService(String sign) { + super(sign); + } + + @Override + boolean doVerify(VerifyParams params) { + String loginUrl = "http://smi.648sy.com/tcxldyzaqlmzf/auth"; + LOGGER.info("爱趣联盟妖晶渠道登录验证-->{}",params.getOpenId()); + Map parms = new HashMap<>(); + parms.put("token",params.getToken()); + parms.put("uid",params.getOpenId()); + boolean result = false; + try { + String r = HttpUtils.doPost(loginUrl, parms); + JSONObject jsonObject = JSON.parseObject(r); + int errno = jsonObject.getIntValue("errno"); + LOGGER.info("爱趣联盟妖晶渠道登录验证请求结果:{}",r); + if(errno == 0){ + result = true; + } + }catch (IOException e){ + LOGGER.info("爱趣联盟妖晶渠道登录验证验证失败,{}",e.getMessage()); + return false; + } + return result; + } +} diff --git a/src/main/java/com/ljsd/service/YouguDiscountVerifyService.java b/src/main/java/com/ljsd/service/YouguDiscountVerifyService.java index 37d3692..4e09fcd 100644 --- a/src/main/java/com/ljsd/service/YouguDiscountVerifyService.java +++ b/src/main/java/com/ljsd/service/YouguDiscountVerifyService.java @@ -24,7 +24,7 @@ public class YouguDiscountVerifyService extends YouGuVerifyService { @Override boolean doVerify(VerifyParams params) { String loginUrl = "http://smi.648sy.com/tcxldyzb/auth"; - LOGGER.info("悠谷渠道登录验证-->{}",params.getOpenId()); + LOGGER.info("悠谷折扣渠道登录验证-->{}",params.getOpenId()); Map parms = new HashMap<>(); parms.put("token",params.getToken()); parms.put("uid",params.getOpenId()); @@ -33,12 +33,12 @@ public class YouguDiscountVerifyService extends YouGuVerifyService { String r = HttpUtils.doPost(loginUrl, parms); JSONObject jsonObject = JSON.parseObject(r); int errno = jsonObject.getIntValue("errno"); - LOGGER.info("悠谷渠道登录验证请求结果:{}",r); + LOGGER.info("悠谷折扣渠道登录验证请求结果:{}",r); if(errno == 0){ result = true; } }catch (IOException e){ - LOGGER.info("悠谷渠道登录验证验证失败,{}",e.getMessage()); + LOGGER.info("悠谷折扣渠道登录验证验证失败,{}",e.getMessage()); return false; } return result;