异步调用重复发送header

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
cmdlib.run_sql(config.ser_dbip, config.ser_dbuser, config.ser_dbpasswd, config.ser_dbport, config.ser_dbname, websql, 'select', function(r) {
    for (var i = 0; i < r.length; i++) {
        request.post({
                url:'http://' + r[i].game_host + ':' + gop_port,
                form: {
                    cmd: 105,
                    port: r[i].web_port,
                    gamesite: r[i].game_site
                }
            },
            function(err,httpResponse,body){
                if(httpResponse.statusCode == 200){
                    console.log(body);
                    send.push(body);
                }else {
                    send.push({'status': "err"});
                }
                if(send.length == gammee.length){
                    console.log(send);
                    res.json({'status': send});
                }
            });
    }
 
});

  将所有结果放在一个数组中 再res

 

posted on   思此狂  阅读(257)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示