公务员网络培训听课代码-河南
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
var doPostHack = function(_userId, _courseId, _from_index, _end_index){
var _url = ":80/play/AICCProgressNew.ashx";
// var _userId = "410725************";
// var _courseId = 2712;
// var _sid = "S002";
var _movie_len = 1;
var doPostSid = function(index){
if(index > _end_index) {
alert("这可不对哦,又偷懒了,ll。");
return;
}
var _sid = _getSidStr(index);
var _start_time = new Date();
var _end_time = new Date();
_end_time.setTime(_start_time.getTime() + _movie_len * 1000);
var _date_format = "yyyy-MM-dd hh:mm:ss";
_start_time = _start_time.format(_date_format);
_end_time = _end_time.format(_date_format);
$.post(_url,{
method:"setParam",
lastLocation:"0",
SID:_sid,
curtime:_start_time,
STime:_movie_len,
state:"S",
courseID:_courseId,
userID:_userId
},function(){
setTimeout(function(){
$.post(_url,{
method:"setParam",
lastLocation:_movie_len,
SID:_sid,
curtime:_end_time,
STime:_movie_len,
state:"C",
courseID:_courseId,
userID:_userId
},function(){
console.log(_courseId + ":" + _sid + " Over!");
setTimeout(function(){
doPostSid(index + 1);
}, 4000);
});
}, 2000);
});
}
doPostSid(_from_index);
}
var _getSidStr = function(index){
var s = index + "";
var s0 = "";
for(var i=0;i<(3 - s.length);i++){
s0 += "0";
}
return "S" + s0 + index;
}
Date.prototype.format =function(format){
var o = {
"M+" : this.getMonth()+1,
"d+" : this.getDate(),
"h+" : this.getHours(),
"m+" : this.getMinutes(),
"s+" : this.getSeconds(),
"q+" : Math.floor((this.getMonth()+3)/3),
"S" : this.getMilliseconds()
}
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
(this.getFullYear()+"").substr(4- RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length==1? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
}
doPostHack("411111111111111111",2076,1,56);