var doPostHack = function(_userId, _courseId, _from_index, _end_index){
var _url = "v: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(_Time() + _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",
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+" : Month()+1,
"d+" : Date(),
"h+" : Hours(),
"m+" : Minutes(),
"s+" : Seconds(),
"q+" : Math.floor((Month()+3)/3),
"S" : Milliseconds()
}
if(/(y+)/.test(format)) place(RegExp.$1,
(FullYear()+"").substr(4- RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = place(RegExp.$1,
RegExp.$1.length==1? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
}
doPostHack("411111111111111111",2076,1,56);