Initial commit: gamer project

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
lizhilun
2026-03-12 11:23:10 +08:00
co-authored by Claude Opus 4.6
commit a0d7bfdc3d
26 changed files with 5410 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
// 日期范围辅助函数
function getMonthRange(qYear, qMonth) {
const now = new Date();
const y = Number(qYear) || now.getFullYear();
const m = Number(qMonth) || (now.getMonth() + 1);
const startDate = `${y}-${String(m).padStart(2, '0')}-01`;
const nm = m + 1 > 12 ? 1 : m + 1;
const ny = m + 1 > 12 ? y + 1 : y;
const endDate = `${ny}-${String(nm).padStart(2, '0')}-01`;
return { startDate, endDate };
}
// CSV行解析(处理引号内的逗号)
function parseCSVLine(line) {
const result = [];
let current = '';
let inQuotes = false;
for (let i = 0; i < line.length; i++) {
const ch = line[i];
if (inQuotes) {
if (ch === '"' && line[i + 1] === '"') { current += '"'; i++; }
else if (ch === '"') { inQuotes = false; }
else { current += ch; }
} else {
if (ch === '"') { inQuotes = true; }
else if (ch === ',') { result.push(current); current = ''; }
else { current += ch; }
}
}
result.push(current);
return result;
}
module.exports = { getMonthRange, parseCSVLine };