浏览代码

剔除非全能卡

jinxia.mo 3 年之前
父节点
当前提交
8dc8d07409
共有 2 个文件被更改,包括 12 次插入1 次删除
  1. 11 0
      src/main/java/com/mingxue/spider/utils/ApiUtil.java
  2. 1 1
      src/test/java/spider/CollegeData.java

+ 11 - 0
src/main/java/com/mingxue/spider/utils/ApiUtil.java

@@ -108,6 +108,17 @@ public class ApiUtil {
                 String token = data.getString("accessToken");
                 requestBuilder.addHeader("accessToken", token);
                 this.user.setProvinceId(provinceId).setToken(token);
+                Integer utype = data.getInteger("utype");
+                if(utype!=8){
+                    log.error("user is not valid: {}",JSONObject.toJSONString(user));
+                    //全能卡用户
+                    return false;
+                }
+                if(utype==1){
+                    //普通用户
+                    return false;
+                }
+
                 return true;
             } else {
                 System.out.println(res);

+ 1 - 1
src/test/java/spider/CollegeData.java

@@ -47,7 +47,7 @@ public class CollegeData {
     }
 
     public void collegeList() throws SQLException {
-        int count = 0, total = 5000, page = 74;
+        int count = 0, total = 5000, page = 116;
         JSONObject res=new JSONObject();
         do {
             try {