admin
2021-09-30 42411e4a26461229c6bca6e89ca55e98a80f5a4e
fanli/src/main/java/com/yeshi/fanli/util/wx/WXInterceptorUtil.java
@@ -1,54 +1,54 @@
package com.yeshi.fanli.util.wx;
import java.util.HashMap;
import java.util.Map;
import org.yeshi.utils.HttpUtil;
import net.sf.json.JSONObject;
/**
 * 微信域名拦截
 * @author Administrator
 *
 */
public class WXInterceptorUtil {
   public static final int STATUS_NORMAL=1;//正常
   public static final int STATUS_INTERCEPTOR=0;//被拦截
   public static final int STATUS_UNKNOWN_=2;//检测失败
   /**
    * 微信域名检测
    * @return
    */
   public static int getDomainStatus(String domain)
   {
      Map<String,String> params=new HashMap<>();
      params.put("domain",domain);
      Map<String,String> headers=new HashMap<>();
      headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
      headers.put("X-Requested-With","XMLHttpRequest");
      headers.put("Referer","http://www.yumingjiance.net/index.php?s=/weixin/index/cate/weixinjiance.html");
      String result=   HttpUtil.post("http://www.yumingjiance.net/index.php?s=/Index/ck_weixin", params,headers);
    JSONObject resultJson=   JSONObject.fromObject(result);
      if(resultJson.optInt("status")==1)
         return STATUS_NORMAL;
      else if(resultJson.optInt("status")==0)
         return STATUS_INTERCEPTOR;
      else
         return STATUS_UNKNOWN_;
   }
}
package com.yeshi.fanli.util.wx;
import java.util.HashMap;
import java.util.Map;
import org.yeshi.utils.HttpUtil;
import net.sf.json.JSONObject;
/**
 * 微信域名拦截
 * @author Administrator
 *
 */
public class WXInterceptorUtil {
   public static final int STATUS_NORMAL=1;//正常
   public static final int STATUS_INTERCEPTOR=0;//被拦截
   public static final int STATUS_UNKNOWN_=2;//检测失败
   /**
    * 微信域名检测
    * @return
    */
   public static int getDomainStatus(String domain)
   {
      Map<String,String> params=new HashMap<>();
      params.put("domain",domain);
      Map<String,String> headers=new HashMap<>();
      headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
      headers.put("X-Requested-With","XMLHttpRequest");
      headers.put("Referer","http://www.yumingjiance.net/index.php?s=/weixin/index/cate/weixinjiance.html");
      String result=   HttpUtil.post("http://www.yumingjiance.net/index.php?s=/Index/ck_weixin", params,headers);
    JSONObject resultJson=   JSONObject.fromObject(result);
      if(resultJson.optInt("status")==1)
         return STATUS_NORMAL;
      else if(resultJson.optInt("status")==0)
         return STATUS_INTERCEPTOR;
      else
         return STATUS_UNKNOWN_;
   }
}