3 Star 0 Fork 0

asst_tech/gdt_hb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
executeRecord.js 2.73 KB
一键复制 编辑 原始数据 按行查看 历史
落尘 提交于 2020-11-08 02:03 . bug fixed
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;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/asst_tech/gdt_hb.git
git@gitee.com:asst_tech/gdt_hb.git
asst_tech
gdt_hb
gdt_hb
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385