| | |
| | | if (verifyAlipayKey != null && verifyAlipayKey.trim().equalsIgnoreCase("1")) { |
| | | try { |
| | | // 需要验证支付宝口令 |
| | | if (urllist.size() < 1) { |
| | | if (urllist.isEmpty()) { |
| | | throw new Exception("口令中不包含链接"); |
| | | } |
| | | AlipayOrderUtil.AlipayOrderTradeInfo tradeInfo = AlipayOrderUtil.getTradeInfo(urllist.get(0)); |
| | |
| | | throw new KeyVerifyException(KeyVerifyException.CODE_COMMON, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | KeyOrder order = keyOrderService.addKeyOrder(keyInfo, wxUid, TimeUtil.getGernalTime(System.currentTimeMillis(), Constant.DB_DAY_FORMAT),orderType, orderDto); |
| | | Long uid = keyOrderService.getCanDistributeUid(Constant.MAX_PAY_ACCOUNT_QUEUE_SIZE); |
| | | if (uid != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | private Map<String, IPUtil.IPInfo> ipInfoMap=new HashMap<>(); |
| | | @ResponseBody |
| | | @RequestMapping(value = "submitKeyV4") |
| | | public String submitKeyV4(SubmitKeyInfo keyInfo, HttpSession session, HttpServletRequest request) { |
| | |
| | | WxUserInfo user = (WxUserInfo) session.getAttribute(Constant.SESSION_KEY_USER); |
| | | if (StringUtil.isNullOrEmpty(keyInfo.getKey())) { |
| | | return JsonUtil.loadFalseResult("请上传key"); |
| | | } |
| | | String ip = IPUtil.getRemotIP(request); |
| | | keyInfo.setIp(ip); |
| | | if(!ipInfoMap.containsKey(ip)){ |
| | | try { |
| | | IPUtil.IPInfo ipInfo = IPUtil.getLocalIPInfo(ip); |
| | | ipInfoMap.put(ip, ipInfo); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | keyInfo.setIpInfo(ipInfoMap.get(ip)); |
| | | |
| | | String citys = systemConfigService.getValueCache(SystemConfigKeyEnum.FORBIDDEN_SUBMIT_CITYS); |
| | | if(citys!=null&&ipInfoMap.get(ip)!=null){ |
| | | List<String> cityList = Arrays.asList(citys.split(",")); |
| | | if(cityList.contains(ipInfoMap.get(ip).getCity())){ |
| | | LogUtil.loggerDebug.warn("区域屏蔽:{}-{}", ip, new Gson().toJson(ipInfoMap.get(ip))); |
| | | return JsonUtil.loadFalseResult("暂时无法上传口令"); |
| | | } |
| | | } |
| | | |
| | | try { |
| | |
| | | return JsonUtil.loadTrueResult(Constant.RESULT_CODE_NEED_LOGIN, root); |
| | | } |
| | | wxLogger.info("微信有授权:" + session.getId()); |
| | | LogUtil.loggerDebug.warn("GEO信息:{}-{}-{}", user.getId(),ip, new Gson().toJson(ipInfoMap.get(ip))); |
| | | try { |
| | | addKey(keyInfo, user.getId()); |
| | | return JsonUtil.loadTrueResult(""); |
| | |
| | | |
| | | wxLogger.info("从session读取到key:{}", alipayKeyInfo); |
| | | if (alipayKeyInfo != null) { |
| | | if(!ipInfoMap.containsKey(alipayKeyInfo.getIp())){ |
| | | try { |
| | | IPUtil.IPInfo ipInfo = IPUtil.getLocalIPInfo(alipayKeyInfo.getIp()); |
| | | ipInfoMap.put(alipayKeyInfo.getIp(), ipInfo); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | addKey(alipayKeyInfo, user.getId()); |
| | | } |
| | | response.sendRedirect(successLink); |