| | |
| | | import com.taoke.autopay.entity.KeyOrder; |
| | | import com.taoke.autopay.entity.SystemConfigKeyEnum; |
| | | import com.taoke.autopay.entity.WxUserInfo; |
| | | import com.taoke.autopay.entity.agent.ChannelAgent; |
| | | import com.taoke.autopay.exception.KeyOrderException; |
| | | import com.taoke.autopay.exception.KeyVerifyException; |
| | | import com.taoke.autopay.exception.WxOrderCountException; |
| | |
| | | import com.taoke.autopay.service.KeyOrderService; |
| | | import com.taoke.autopay.service.SystemConfigService; |
| | | import com.taoke.autopay.service.WxUserService; |
| | | import com.taoke.autopay.service.agent.ChannelAgentService; |
| | | import com.taoke.autopay.utils.*; |
| | | import com.taoke.autopay.vo.SubmitKeyInfo; |
| | | import net.sf.json.JSONObject; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.util.AntPathMatcher; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.UrlUtils; |
| | |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | @Autowired |
| | | @Resource |
| | | private PayCountVerifyManager payCountVerifyManager; |
| | | |
| | | @Resource |
| | | private ChannelAgentService channelAgentService; |
| | | |
| | | |
| | | private KeyOrder addKey(SubmitKeyInfo keyInfo, Long wxUid) throws KeyVerifyException, KeyOrderException, WxOrderCountException { |
| | |
| | | } |
| | | 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("暂时无法上传口令"); |
| | | AntPathMatcher pathMatcher = new AntPathMatcher(); |
| | | |
| | | Map<String, String> paramsMap = HttpUtil.getPramsFromUrl(keyInfo.getReferer()); |
| | | if (paramsMap.containsKey("a") && ipInfoMap.get(ip) != null) { |
| | | String alias = paramsMap.get("a"); |
| | | ChannelAgent agent = channelAgentService.selectByAlias(alias); |
| | | if (!StringUtil.isNullOrEmpty(agent.getShieldedAreas())) { |
| | | String[] res = agent.getShieldedAreas().split(","); |
| | | String ipInfoStr = ipInfoMap.get(ip).getProvince() + "/" + ipInfoMap.get(ip).getCity(); |
| | | boolean shield = false; |
| | | for (String pattern : res) { |
| | | if (pathMatcher.match(pattern, ipInfoStr)) { |
| | | shield = true; |
| | | break; |
| | | } |
| | | } |
| | | if (shield) { |
| | | // 判断用户是否为白名单 |
| | | if (user.getStatus() != WxUserInfo.STATUS_WHITE) { |
| | | // 不是白名单才限制 |
| | | LogUtil.loggerDebug.warn("区域屏蔽:{}-{}", ip, new Gson().toJson(ipInfoMap.get(ip))); |
| | | return JsonUtil.loadFalseResult("暂时无法上传口令"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |