Skip to content

Instantly share code, notes, and snippets.

@gMan1990
Created September 8, 2018 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gMan1990/f8cec27ed78bcdef575e6b8a2919d62c to your computer and use it in GitHub Desktop.
Save gMan1990/f8cec27ed78bcdef575e6b8a2919d62c to your computer and use it in GitHub Desktop.
杭州驾考初学体验预约筛选
// URL: http://syjy.5u5u5u5u.com/syjy/reserve/toLessonReservePage_xianxietiyan.htm
// 步骤: 一步步拷贝执行
// 1. get map
jQuery(function ($) {
window._resultMap = {};
$('#areaSwitch>li').each(function (i, v) {
var areaId = $(v).attr('areaid');
$.get('http://syjy.5u5u5u5u.com/syjy/reserve/queryExperienceLessonReserveData.htm', {
areaId: areaId
}, function (data) {
$.each(data.data[areaId].busOrgDtoS, function (k1, v1) {
$.each(v1.weekDtos, function (k2, v2) {
$.each(v2.lessonDtoS, function (k3, v3) {
if (v3.remainNum > 0 && v2.date == '2018-09-09') {
var quKey = data.data[areaId].name;
var quVal = window._resultMap[quKey];
var luKey = v1.address;
if (!quVal) {
quVal = {};
window._resultMap[quKey] = quVal;
quVal[luKey] = [];
var luVal = quVal[luKey];
} else {
var luVal = quVal[luKey];
if (!luVal) {
quVal[luKey] = [];
luVal = quVal[luKey];
}
}
luVal.push({
beginTime: v3.beginTime,
endTime: v3.endTime
});
}
});
});
});
});
});
});
// 2. sort arr
jQuery(function ($) {
$.each(window._resultMap, function (quKey, quVal) {
$.each(quVal, function (luKey, luVal) {
luVal.sort(function (a, b) {
return a.beginTime > b.beginTime;
});
});
});
});
// 3. filter
jQuery(function ($) {
window._resultArr = [];
$.each(window._resultMap, function (quKey, quVal) {
$.each(quVal, function (luKey, luVal) {
for (var i = 0; i < luVal.length - 1; i++) {
if (luVal[i].endTime == luVal[i + 1].beginTime) {
window._resultArr.push([luVal[i].beginTime, luVal[i].endTime, luVal[i + 1].endTime, quKey, luKey].join(' '));
}
}
});
});
});
// 4. output
/* _resultArr.sort().join('\n'); */
@gMan1990
Copy link
Author

gMan1990 commented Nov 9, 2018

暂存,与此gist无太大关系

// URL: http://hgh.122.gov.cn/drv/apply/v201705/normalbd/index
setInterval(jQuery.bind(document, function ($) {
        /*
        http://hgh.122.gov.cn/drv/apply/v201705/normalbd/getAfterKskmPageData
        2018-11-08, startTime: 2018-11-14 endTime: 2018-11-28
        Fri, 09 Nov 2018 04:38:02 GMT, startTime: 2018-11-16 endTime: 2018-11-29
         */
        $.get("http://hgh.122.gov.cn/drv/apply/v201705/normalbd/getKscc", {
            startTime: "2018-11-14",
            endTime: "2018-11-28",
            ksddqy: 3301045
        }, function (data) {
            $.each(data.data, function (i1, v1) {
                var _return = true;
                $.each(v1.grids, function (i2, v2) {
                    if (v1.ksrq == "2018-11-15" && v2.pxh) {
                        _return = false;
                        alert("已报" + v2.sqrs + ", 可容纳" + v2.kkrs + ", 您排名" + v2.pxh);
                    }
                    return _return;
                });
                return _return;
            });
        });
    }), 2000);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment