Compare commits
No commits in common. "a05dc15f69678e6ba916cd8a78c49931dd1c1cb8" and "4ff8b0b7a04eae91a1eb1296e43b7877bd4253a9" have entirely different histories.
a05dc15f69
...
4ff8b0b7a0
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
@ -1247,30 +1247,18 @@ function addTodo(todoData) {
|
||||
// 打开数据库连接
|
||||
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(`
|
||||
INSERT INTO todos (
|
||||
project, subproject, title, text, adduser,
|
||||
exeuser, completed, created_at, sche_time
|
||||
) VALUES (?, ?, ?, ?, ?, ?, 0, ?, ?)
|
||||
completed, created_at, sche_time
|
||||
) VALUES (?, ?, ?, ?, ?, 0, CURRENT_TIMESTAMP, ?)
|
||||
`).run(
|
||||
todoData.project || '其它',
|
||||
todoData.subproject || '其它',
|
||||
todoData.title,
|
||||
todoData.text || '',
|
||||
todoData.adduser || '系统',
|
||||
todoData.exeuser || null,
|
||||
localDateTime,
|
||||
todoData.sche_time || localDateTime
|
||||
todoData.sche_time || new Date().toISOString()
|
||||
);
|
||||
|
||||
db.close();
|
||||
@ -1306,16 +1294,6 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
|
||||
// 打开数据库连接
|
||||
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(`
|
||||
UPDATE todos
|
||||
SET completed = ?,
|
||||
@ -1323,7 +1301,7 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
|
||||
title = ?,
|
||||
text = ?,
|
||||
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 = ?
|
||||
`).run(
|
||||
completed ? 1 : 0,
|
||||
@ -1332,7 +1310,6 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
|
||||
text || '',
|
||||
sche_time || null,
|
||||
completed ? 1 : 0,
|
||||
completed ? localDateTime : null,
|
||||
id
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user