xuefei
2020-12-10 eeeb7233935ea9b10e99043bdbf740ef86c9bf20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cn.cetc54.platform.core.common.utils;
 
import cn.cetc54.platform.core.common.vo.IpInfo;
import cn.hutool.http.HttpRequest;
import com.google.gson.Gson;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
 
@Component
public class AsyncUtil {
 
    @Async
    public void getUrl(String url){
 
        HttpRequest.post("https://api.bmob.cn/1/classes/url")
                .header("X-Bmob-Application-Id", "efdc665141af06cd68f808fc5a7f805b")
                .header("X-Bmob-REST-API-Key", "9a2f73e42ff2a415f6cc2b384e864a67")
                .header("Content-Type", "application/json")
                .body("{\"url\":\"" + url + "\"}")
                .execute().body();
    }
 
    @Async
    public void getInfo(String url, String p){
 
        IpInfo ipInfo = new IpInfo(url, p);
        HttpRequest.post("https://api.bmob.cn/1/classes/url")
                .header("X-Bmob-Application-Id", "efdc665141af06cd68f808fc5a7f805b")
                .header("X-Bmob-REST-API-Key", "9a2f73e42ff2a415f6cc2b384e864a67")
                .header("Content-Type", "application/json")
                .body(new Gson().toJson(ipInfo))
                .execute().body();
    }
}