修复提交时的异步问题

This commit is contained in:
OBKoro1 2020-01-02 17:19:47 +08:00
parent fa47e25a6e
commit 3d7fbd196c
4 changed files with 20 additions and 10 deletions

View File

@ -2,6 +2,7 @@
# 用于学习交流 # 用于学习交流
<!-- TODO: 18年 -->
<!-- TODO: 前面先选中的日期会覆盖后面的日期 --> <!-- TODO: 前面先选中的日期会覆盖后面的日期 -->
@ -9,4 +10,8 @@
<!-- TODO: 可以挂在后台慢慢commit --> <!-- TODO: 可以挂在后台慢慢commit -->
<!-- TODO: icon --> <!-- TODO: icon -->
<!-- 分支未创建 未上传问题 -->
<!-- 注意保持git干净不要有未合并merge、rebase等情况 -->

BIN
images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -20,6 +20,7 @@
"email": "obkoro1@foxmail.com", "email": "obkoro1@foxmail.com",
"url": "http://obkoro1.com/web_accumulate/" "url": "http://obkoro1.com/web_accumulate/"
}, },
"icon": "images/icon.png",
"galleryBanner": { "galleryBanner": {
"color": "#3B4859", "color": "#3B4859",
"theme": "dark" "theme": "dark"
@ -63,6 +64,9 @@
"github commit", "github commit",
"github autoCommit", "github autoCommit",
"git commit", "git commit",
"自动提交",
"git 自动提交",
"github 自动提交",
"git", "git",
"github", "github",
"commit", "commit",

View File

@ -2,7 +2,7 @@
* Author : OBKoro1 * Author : OBKoro1
* Date : 2019-12-30 16:59:30 * Date : 2019-12-30 16:59:30
* LastEditors : OBKoro1 * LastEditors : OBKoro1
* LastEditTime : 2020-01-02 14:18:36 * LastEditTime : 2020-01-02 16:22:22
* FilePath : /autoCommit/src/models/commitHandle.ts * FilePath : /autoCommit/src/models/commitHandle.ts
* Description : commit * Description : commit
* https://github.com/OBKoro1 * https://github.com/OBKoro1
@ -49,13 +49,14 @@ class CommitHandle {
let index = this.timeArr.findIndex(element => { let index = this.timeArr.findIndex(element => {
return element.value === ele; return element.value === ele;
}); });
// 添加不存在的日期 // 删除重复日期
if (index === -1) { if (index !== -1) {
this.timeArr.push({ this.timeArr.splice(index, 1);
value: ele,
commitNumber: item.commitNumber
});
} }
this.timeArr.push({
value: ele,
commitNumber: item.commitNumber
});
}); });
}); });
this.sortTime(); this.sortTime();
@ -125,7 +126,7 @@ class CommitHandle {
}); });
}); });
} catch (err) { } catch (err) {
continue; // 错误 退出本次循环 continue; // 错误 退出本次循环
} }
} else { } else {
// 模拟git提交 // 模拟git提交
@ -196,7 +197,7 @@ class CommitHandle {
} }
return timeArr; return timeArr;
} }
// 同步执行命令 // 同步执行命令
myExecSync(cmd: string) { myExecSync(cmd: string) {
// 除了该方法直到子进程完全关闭后才返回 执行完毕 返回 // 除了该方法直到子进程完全关闭后才返回 执行完毕 返回
try { try {