完善c端接口
This commit is contained in:
@@ -10,12 +10,12 @@ import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -25,10 +25,10 @@ import java.util.Map;
|
||||
@Component
|
||||
public class UmengConfig {
|
||||
|
||||
public CloseableHttpResponse send(String token){
|
||||
String umAppkey = "xxxx";
|
||||
String appKey = "5df88f83570df3b8d40012337";
|
||||
String appSecret = "xxxx";
|
||||
public static CloseableHttpResponse send(String token){
|
||||
String umAppkey = "5df88f83570df3b8d40012337";
|
||||
String appKey = "LTAI5tDWWzwqxumUXTFnkQFd";
|
||||
String appSecret = "KOD3y6OxbHJ23wxAf68NFpUQXCQEPX";
|
||||
// 下面的url要和阿里云云市场购买的商品对应
|
||||
String url = "https://verify5.market.alicloudapi.com/api/v1/mobile/info?appkey=" + umAppkey;
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
@@ -85,8 +85,11 @@ public class UmengConfig {
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws InvalidKeyException, NoSuchAlgorithmException {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
CloseableHttpResponse sss = send("1234");
|
||||
String reponseContent = EntityUtils.toString(sss.getEntity());
|
||||
System.out.println(reponseContent);
|
||||
System.out.println(sss.getStatusLine().getReasonPhrase());
|
||||
}
|
||||
|
||||
private static String getSignString(HttpPost httpPost) {
|
||||
|
||||
Reference in New Issue
Block a user