微信网页版自动回复

setInterval(function(){
if ($(".js_message_plain").length == 0) {
   return;
}
var msg = $(".js_message_plain")[$(".js_message_plain").length-1].innerHTML;
if (msg.indexOf("天气") > -1 ) {
       $.ajax({
                type:"get",
                url:"https://www.tianqiapi.com/api/?version=v1&city=南京",
                success:function(responseData){console.log(responseData);
                    $('.edit_area').html("南京" + responseData.data[0].day +":" + responseData.data[0].wea + ",最高温度:" + responseData.data[0].tem1 + ",最低温度:" + responseData.data[0].tem2 + ",风速:" + responseData.data[0].win_speed + "。"+' \n '
                    + responseData.data[1].day +":" + responseData.data[1].wea + ",最高温度:" + responseData.data[1].tem1 + ",最低温度:" + responseData.data[1].tem2 + ",风速:" + responseData.data[1].win_speed + "。"+' \n '
                    + responseData.data[2].day +":" + responseData.data[2].wea + ",最高温度:" + responseData.data[2].tem1 + ",最低温度:" + responseData.data[2].tem2 + ",风速:" + responseData.data[2].win_speed + "。"+' \n '
                    + responseData.data[3].day +":" + responseData.data[3].wea + ",最高温度:" + responseData.data[3].tem1 + ",最低温度:" + responseData.data[3].tem2 + ",风速:" + responseData.data[3].win_speed + "。"+' \n '
                    + responseData.data[4].day +":" + responseData.data[4].wea + ",最高温度:" + responseData.data[4].tem1 + ",最低温度:" + responseData.data[4].tem2 + ",风速:" + responseData.data[4].win_speed + "。"+' \n '
                    + responseData.data[5].day +":" + responseData.data[5].wea + ",最高温度:" + responseData.data[5].tem1 + ",最低温度:" + responseData.data[5].tem2 + ",风速:" + responseData.data[5].win_speed + "。"+' \n '
                    + responseData.data[6].day +":" + responseData.data[6].wea + ",最高温度:" + responseData.data[6].tem1 + ",最低温度:" + responseData.data[6].tem2 + ",风速:" + responseData.data[6].win_speed + "。"
                    );
                    $(".edit_area").trigger($.Event("keydown", { keyCode: 13,ctrlKey: true}));
                    $('.btn_send').click();
 
                }
            });
}


},300);


$(".js_message_plain ng-binding").eq(0)

posted @ 2019-01-23 13:00  前度刘郎  阅读(973)  评论(0编辑  收藏  举报
欢迎来到戴建伟的博客!