• 获取短信


    /**
     * Created by wj49476 on 2018/1/10.
     */
    
    
    /*http://iservice.10010.com/e4/query/smss/sms_sms-iframe.html?menuCode=000100030002
    提取短信记录
    *
    * */
    function extractSmsRecords() {
    
    
        function getNear6Montgh(){
            var near6MonthArray = [];
    
            for (var i=0;i<6;i++){
                var d = new Date();
                d.setMonth(d.getMonth() - i);
                var yy1 = d.getFullYear();
                var mm1 = d.getMonth() + 1;//因为getMonth()返回值是 0(一月) 到 11(十二月) 之间的一个整数。所以要给其加1
                var dd1 = d.getDate();
    
                if (dd1 < 10) {
                    dd1 = '0' + dd1;
                }
                //console.info(yy1 + '-' + mm1 + '-' + dd1);
                near6MonthArray.push([yy1,mm1]);
            }
            return near6MonthArray;
        }
    
        //按照年月,获取一个月有多少天 mGetDate(2004,2)
        function mGetDate(year, month){
            var d = new Date(year, month, 0);
            return d.getDate();
        }
    
        var smsRecordsArray = [];
        function  extractSmsRecordsInner() {
    
            var near6MonthArray = getNear6Montgh();
            var j = 0;
            for (var i=0; i< near6MonthArray.length; i++) {
                var dates = mGetDate(near6MonthArray[i][0], near6MonthArray[i][1]);
                if ( j === 0){
                    var myDate = new Date();
                    dates = myDate.getDate();
                    if (dates < 10) {
                        dates= '0' + dates;
                    }
                }
                j++;
                var mm1 = near6MonthArray[i][1];
                if (mm1 < 10) {
                    mm1 = '0' + mm1;
                }
    
                var yearMonth = near6MonthArray[i][0] + '' + mm1;
    
                var smsRecordsObj = {};
                smsRecordsObj.pagelist = [];
                smsRecordsObj.yearMonth = yearMonth;
    
                function extractSmsRecordByPage(page) {
                    var page = page || 1;
    
                    var url = 'http://iservice.10010.com/e3/static/query/sms?_=1515572703231&accessURL=http://iservice.10010.com/e4/query/calls/call_sms-iframe.html?menuCode=000100030002&menuid=000100030002';
                    var data = {
                        pageNo: page,
                        pageSize: 200,
                        begindate: yearMonth + '01',
                        enddate: yearMonth + dates
                    };
                    console.debug('data:',data);
                    var htmlObj = $.ajax({
                        type: 'POST',
                        url: url,
                        data: data,
                        async: false
                    });
                    var htmlStr = htmlObj.responseText;
                    console.debug('htmlStr:',htmlStr);
                    var smsRecordsRawObj = JSON.parse(htmlStr);
                    if (smsRecordsRawObj.pageMap && smsRecordsRawObj.pageMap.result){
                        smsRecordsObj.pagelist = smsRecordsObj.pagelist.concat(smsRecordsRawObj.pageMap.result);
                        smsRecordsObj.mmsCount = smsRecordsRawObj.mmsCount;
                        smsRecordsObj.totalfee = smsRecordsRawObj.totalfee;
                        console.debug('result:',smsRecordsRawObj.pageMap.result);
                        var totalpage = smsRecordsRawObj.pageMap.totalPages;
                        if (page < totalpage) {
                            extractSmsRecordByPage(page + 1);  //翻页回调自己
                        }
                    }
                }
                extractSmsRecordByPage();
                smsRecordsArray.push(smsRecordsObj);
            }
            smsRecordsInfoObj = {
                smsRecordsInfo:smsRecordsArray
            };
            return JSON.stringify(smsRecordsInfoObj);
    
        }
    
        return extractSmsRecordsInner();
    }
    
    //extractSmsRecords();

    js获取联通短信记录

  • 相关阅读:
    10.19NOIP模拟赛(DAY2)
    bzoj1880: [Sdoi2009]Elaxia的路线(spfa,拓扑排序最长路)
    P3469 [POI2008]BLO-Blockade(Tarjan 割点)
    P2746 [USACO5.3]校园网Network of Schools(Tarjan)
    10.17NOIP模拟赛
    10.16NOIP模拟赛
    P3953 逛公园(dp,最短路)
    牛客OI周赛2-提高组
    洛谷 P1948 [USACO08JAN]电话线Telephone Lines 题解
    洛谷 P2563 [AHOI2001]质数和分解 题解
  • 原文地址:https://www.cnblogs.com/ydf0509/p/8510607.html
Copyright © 2020-2023  润新知