代码拉取完成,页面将自动刷新
var _ = require("./Underscore.js");
var executeRecord = {};
executeRecord.STORAGE_KEY = "EXECUTE_RECORD";
var executeRecordStorage = storages.create(executeRecord.STORAGE_KEY);
//持久化
executeRecord._persistent = function(config){
executeRecordStorage.put(executeRecord.STORAGE_KEY, JSON.stringify(config));
}
//get
executeRecord._get = function(){
return executeRecordStorage.get(executeRecord.STORAGE_KEY);
}
executeRecord.getConfig = function(){
if(executeRecord._get()){
return JSON.parse(executeRecord._get());
}
return null;
}
//开始执行
executeRecord.startExecuteRecord = function(apps){
executeRecord._persistent({
//开始时间
start:java.lang.System.currentTimeMillis(),
//结束时间
end:-1,
//运行的app
apps:apps,
//执行中的app
executeIng:null,
//错误的app
error:[],
//重复完成的app
repeat:[],
//正常完成的app
finish:[]
});
}
//app开始执行
executeRecord.startAppRecord = function(appName){
var config = executeRecord._get();
config = JSON.parse(config);
config.executeIng = {
start:java.lang.System.currentTimeMillis(),
end:-1,
appName:appName,
progress:0,
errorMsg:"",
}
executeRecord._persistent(config);
}
//app更新进度
executeRecord.updateAppProgress = function(progress){
var config = executeRecord._get();
config = JSON.parse(config);
config.executeIng.progress = progress;
executeRecord._persistent(config);
}
//app异常结束
executeRecord.endAppRecordWithError = function(errorMsg){
var config = executeRecord._get();
config = JSON.parse(config);
config.executeIng.errorMsg = errorMsg;
config.executeIng.end = java.lang.System.currentTimeMillis();
config.error.push(config.executeIng);
executeRecord._persistent(config);
}
//app重复执行结束
executeRecord.endAppRecordWithRepeat = function(){
var config = executeRecord._get();
config = JSON.parse(config);
config.executeIng.end = java.lang.System.currentTimeMillis();
config.repeat.push(config.executeIng);
executeRecord._persistent(config);
}
//app正常结束
executeRecord.endAppRecordWithFinish = function(){
var config = executeRecord._get();
config = JSON.parse(config);
config.executeIng.end = java.lang.System.currentTimeMillis();
config.finish.push(config.executeIng);
executeRecord._persistent(config);
}
//执行结束
executeRecord.endExecuteRecord = function(){
var config = executeRecord._get();
config = JSON.parse(config);
config.end = java.lang.System.currentTimeMillis();
executeRecord._persistent(config);
}
module.exports = executeRecord;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。