Compare commits

..

No commits in common. "a05dc15f69678e6ba916cd8a78c49931dd1c1cb8" and "4ff8b0b7a04eae91a1eb1296e43b7877bd4253a9" have entirely different histories.

5 changed files with 46 additions and 1390 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1247,30 +1247,18 @@ function addTodo(todoData) {
// 打开数据库连接 // 打开数据库连接
const db = new Database(dbPath); const db = new Database(dbPath);
// 获取当前本地时间
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const localDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const result = db.prepare(` const result = db.prepare(`
INSERT INTO todos ( INSERT INTO todos (
project, subproject, title, text, adduser, project, subproject, title, text, adduser,
exeuser, completed, created_at, sche_time completed, created_at, sche_time
) VALUES (?, ?, ?, ?, ?, ?, 0, ?, ?) ) VALUES (?, ?, ?, ?, ?, 0, CURRENT_TIMESTAMP, ?)
`).run( `).run(
todoData.project || '其它', todoData.project || '其它',
todoData.subproject || '其它', todoData.subproject || '其它',
todoData.title, todoData.title,
todoData.text || '', todoData.text || '',
todoData.adduser || '系统', todoData.adduser || '系统',
todoData.exeuser || null, todoData.sche_time || new Date().toISOString()
localDateTime,
todoData.sche_time || localDateTime
); );
db.close(); db.close();
@ -1306,16 +1294,6 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
// 打开数据库连接 // 打开数据库连接
const db = new Database(dbPath); const db = new Database(dbPath);
// 获取当前本地时间
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const localDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const result = db.prepare(` const result = db.prepare(`
UPDATE todos UPDATE todos
SET completed = ?, SET completed = ?,
@ -1323,7 +1301,7 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
title = ?, title = ?,
text = ?, text = ?,
sche_time = ?, sche_time = ?,
complete_time = CASE WHEN ? = 1 THEN ? ELSE complete_time END complete_time = CASE WHEN ? = 1 THEN CURRENT_TIMESTAMP ELSE complete_time END
WHERE id = ? WHERE id = ?
`).run( `).run(
completed ? 1 : 0, completed ? 1 : 0,
@ -1332,7 +1310,6 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
text || '', text || '',
sche_time || null, sche_time || null,
completed ? 1 : 0, completed ? 1 : 0,
completed ? localDateTime : null,
id id
); );