fix: worksheet 展示时间修改

This commit is contained in:
R524809
2026-06-15 16:40:20 +08:00
parent 0bcf846857
commit b802709517
5 changed files with 20 additions and 7 deletions
+8 -3
View File
@@ -15,6 +15,13 @@ function ageBand(min, max) {
return `${min}-${max}`;
}
function toContentDate(ws) {
const ts = ws.contentUpdatedAt || ws.createdAt;
return ts
? new Date(ts).toISOString().slice(0, 10)
: new Date().toISOString().slice(0, 10);
}
function toDisplayItem(ws) {
return {
id: ws._id,
@@ -30,9 +37,7 @@ function toDisplayItem(ws) {
available: true,
likes: (ws.likes || 0) + (ws.likes_seed || 0),
downloads: (ws.downloads || 0) + (ws.downloads_seed || 0),
date: ws.updatedAt
? new Date(ws.updatedAt).toISOString().slice(0, 10)
: new Date().toISOString().slice(0, 10),
date: toContentDate(ws),
};
}
@@ -105,6 +105,7 @@ exports.main = async (event) => {
likes: payload.likes,
status: payload.status,
updatedAt: db.serverDate(),
contentUpdatedAt: db.serverDate(),
};
try {
@@ -127,6 +128,7 @@ exports.main = async (event) => {
data: {
...record,
createdAt: db.serverDate(),
contentUpdatedAt: db.serverDate(),
},
});