|
|
@@ -1,27 +0,0 @@
|
|
|
-package com.happy.common.http;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.google.gson.Gson;
|
|
|
-import com.happy.Model.weixin.AccessToken;
|
|
|
-import com.happy.Until.HttpUtils;
|
|
|
-
|
|
|
-public class Get_airticle {
|
|
|
-
|
|
|
- public String get(int page, int rows) throws Exception {
|
|
|
- Gson gson = new Gson();
|
|
|
- String appid = "wx19d0b6ab36feedf4";
|
|
|
- String secret = "309fca4f1a682e6c3d3ecf3b577b0707";
|
|
|
- int start = (page - 1) * rows;// 每页的起始下标
|
|
|
- String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
|
|
|
- + appid + "&secret=" + secret;
|
|
|
- String access_token = HttpUtils.get(url);
|
|
|
- System.out.println(access_token);
|
|
|
- access_token = gson.fromJson(access_token, AccessToken.class).getAccess_token();
|
|
|
- System.out.println(access_token);
|
|
|
- JSONObject data = new JSONObject();
|
|
|
- data.put("offset", start);
|
|
|
- data.put("count", rows);
|
|
|
- data.put("no_content", 0);
|
|
|
- return HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/freepublish/batchget?access_token="+access_token, data);
|
|
|
- }
|
|
|
-}
|