feat: 3.5版本规划
This commit is contained in:
@@ -31,7 +31,7 @@ function toHomeDisplayItem(ws) {
|
||||
ageBand: ageBand(ws.ageMin || 0, ws.ageMax || 0),
|
||||
difficulty: DIFFICULTY_LABELS[ws.difficulty] || '基础',
|
||||
icon: '',
|
||||
img: ws.previewImg || '',
|
||||
previewImg: ws.previewImg || '',
|
||||
badge: ws.isNew ? 'NEW' : ws.isHot ? 'HOT' : '',
|
||||
path: ws.path || '',
|
||||
available: true,
|
||||
|
||||
@@ -36,13 +36,26 @@ exports.main = async (event) => {
|
||||
|
||||
async function handleAdd(userId, event) {
|
||||
const { worksheetId } = event;
|
||||
const exportId = String(event.exportId || '').trim();
|
||||
if (!worksheetId) return { code: -1, message: 'worksheetId 不能为空' };
|
||||
|
||||
const collection = db.collection('download_logs');
|
||||
|
||||
// 同一次成功导出重试时只能计一次,避免网络重试抬高下载量。
|
||||
if (exportId) {
|
||||
const { data: existing } = await collection
|
||||
.where({ userId, exportId })
|
||||
.limit(1)
|
||||
.get();
|
||||
if (existing.length > 0) {
|
||||
return { code: 0, data: { ...existing[0], duplicate: true } };
|
||||
}
|
||||
}
|
||||
|
||||
const record = {
|
||||
userId,
|
||||
worksheetId,
|
||||
...(exportId && { exportId }),
|
||||
createdAt: db.serverDate(),
|
||||
};
|
||||
const { _id } = await collection.add({ data: record });
|
||||
|
||||
Reference in New Issue
Block a user