Skip to content

js——tools

殷泽凌 edited this page Feb 18, 2019 · 2 revisions

tools是用于发起网络请求的

tools有4个方法

String getData(String url, String param);//发起get请求
String getData(String url, String param, Map<String, Object> head);
String postData(String url, String param);//发起post请求
String postData(String url, String param, Map<String, Object> head);

//群里接收到消息hello bang的时候,发起get网络请求
//发送消息到url,参数为k1=v1&k2=v2,header为accept: "*/*",connection: "Keep-Alive"
//并且将获取的消息发送到群里
var praiseBang = {
    check: "hello bang",
    operate: function(){
        return praiseBang.tools.getData("url","k1=v1&k2=v2",{
            accept: "*/*",
            connection: "Keep-Alive"
        });
    }
};