first commit
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,48 @@
|
||||
package com.budwk.app;
|
||||
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.sms.impl.njupt.SmsNjuptServiceImpl;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String appId = "1926887238437818370";
|
||||
String secret = "32df31fcf4fc43f9a647ee1f47134f36";
|
||||
long ts = System.currentTimeMillis();
|
||||
|
||||
String sign = Base64.encode(DigestUtil.md5Hex(appId + secret + ts, CharsetUtil.CHARSET_UTF_8));
|
||||
|
||||
HttpRequest httpRequest = HttpUtil.createPost("https://sjzcpt.nnu.edu.cn/cdsp/data-api/v2/DS0005");
|
||||
httpRequest.header("Content-Type", "application/json");
|
||||
httpRequest.header("appId", appId);
|
||||
httpRequest.header("timestamp", String.valueOf(ts));
|
||||
httpRequest.header("sign", sign);
|
||||
httpRequest.body("{}");
|
||||
String body = httpRequest.execute().body();
|
||||
System.out.println(body);
|
||||
|
||||
JSONObject entries = JSONUtil.parseObj(body);
|
||||
JSONArray value = entries.getJSONArray("value");
|
||||
|
||||
for (Object o : value) {
|
||||
JSONObject jsonObject = (JSONObject) o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user